top of page
Search
  • Writer's picturegomathi gomathi

5.IoT Smart Track Control System - Using Arduino and ESP8266

Updated: Oct 12, 2023

Hello friends,

Welcome back to Superhobbies Channel for Marklin Toporama Z Scale Build video series.


In the last blog we saw the compact and multipurpose table design and the electronic

components that go in to the hatch of the table.




In this post, we are going to see how the Smart Layout Control System is implemented.


  1. How each of these elements are installed inside table hatch.

  2. What are the power design considerations of the layout to achieve single wall socket input.

  3. How the Wireless Smart Control system is implemented with its wiring details and program logic.

The complete Making video and the demonstration is available in the following YouTube Channel



Installation of the Electronic components

All the electronic components are mounted on 450MM X 300MM Hylum Sheet. Which is generally used for electrical switch boards. The Sheet is Pre-cut and predrilled according to the size the Arduino, Relay modules, Motor controller etc.


The Heart of the Smart Control System is the Arduino Microcontroller. Its installed on the layout using a screw terminal shield.



The rest of the supporting components such as the Relay modules, DB25 Bus, Magno-Car and the Motor controller are all installed using spacers




Power design considerations

While considering the power requirements for the layout, it demanded various operating voltages ranging from 3.3v dc to 12 v ac with difference amperage.

The unit will become clumsy with multiple power adaptors having to connect to a spike,, so I decided to come with a solution that the entire unit will run on a single power socket.


Following diagram explains how it is distributed using a powerful Dell SMPS module that was providing 12 V supply at 18 amps, which is later split various voltages according to different circuit needs.




IoT Smart layout control panel architecture


In my previous blog, i had posted various options of layout automation, including that Touch Toggle Control panel and my own Touch Sensor based control panel.


While the touch sensor solution appeared to be a more cost-effective and versatile option compared to technologies like those from Marklin or the seemingly expensive Touch Toggle, I encountered some shortcomings in the Touch Sensor control system. Specifically, each track turnout point required a minimum of 2 Input Ports for Switch Port, 2 Output Ports, and an additional 2 for the LED Indicator—totaling 6 Ports for each turnout. Given that the Toporama Layout required 9 Track Turnout switches, 3 Uncouplers, 3 Signal controllers, and an automated operation for the Loco Shed door, I found myself in need of at least 60 GPIO Ports. The Arduino Mega, with a maximum of 56 ports, fell short, necessitating the addition of another microcontroller. This, in turn, meant a more complex wiring and relay mechanism. Faced with this challenge, I began exploring alternative ways to reduce port consumption. After some research and online exploration, I arrived at the idea of installing the ESP8266-02 WIFI Module. This module interfaces with the Arduino primarily through TX/RX Serial Communication ports, allowing for the infinite interfacing of elements. As a result, it completely eliminated the need for input ports. The following architecture illustrates how controlling a point switch now requires only 2 Output Ports with no need for input ports or output ports for LEDs.






Function Logic.

Following the sequence of numbers in the diagram above, the architecture operates as follows:

  1. Web APP User Interface: The initial component of this architecture is a web-based application user interface designed for remotely controlling the layout. Users can operate the layout by simply pressing the necessary switch points or buttons provided within the application. The design of the application is such that it indicates the active and inactive tracks with red and green indicators, respectively.

  2. User Input Transmission: When the user presses any turnout switch point within the application, the information is transmitted to the web server along with the IP address of the ESP8266 Module. This transmitted information typically includes the tag number to indicate which switch was operated and whether it was set to the left or right position.

  3. IOT Module This data can be accessed from anywhere in the world over the internet as long as the WIFI module's IP address is reachable over the Internet, LAN, or WAN. Thus, this operation aligns with the principles of the Internet of Things (IoT).

  4. ESP8266 WIFI Module Reception: The WIFI Module receives this information and collects it at the RX terminal of the Arduino Microcontroller. The Arduino board runs a program that continuously listens to the RX Terminal or the Serial Port. Upon receiving the information, it processes it immediately. In this case, it identifies which turnout switch was operated and whether it should be set to the left or right position. Subsequently, it sends the corresponding signal to the relay channel to open for 1 second duration.

  5. Relay Activation: The relay, upon receiving the command from the Arduino, opens its respective channel, enabling the 12VAC to flow through and operate the turnout switch.

  6. Turnout Switch Activation: In the final step, as the turnout switch receives the 12VAC, it activates the solenoid coil motor, which moves the switch point in the desired direction, thereby setting the track's flow as required.

And that's how the wireless IoT SMART Control system works !. The below picture is the completed WebApp Design and Circuit Connections.




That's about it on this blog. In the next blog we will be covering the DCC conversion of the Tiniest Locos to operate on our Toporama SMART Layout !!!




78 views0 comments
bottom of page