The traditional model railway controller is so time consuming and faulty. For this reason I developed a modern ESP32 Model Railway Controller which can control 24 switches one time. This system is ESP32 based, ESP32 works as a main controller of this system because they can help communist between model and user’s device.
This project allows users to manage multiple railway accessories including track switches, lightning, and movement of trains.
Features
- ESP32-based wireless controller
- Wi-Fi web interface for remote operation
- Servo-controlled railway turnouts
- LED railway signal management
- Relay outputs for track power control
- Expandable I/O architecture
- OTA firmware updates
- Low-power operation
- Compatible with custom PCB designs
System Overview
The ESP32 acts as the central controller of the railway network. Once powered, it connects to a Wi-Fi network and hosts a web dashboard that allows users to operate the railway remotely.
Each turnout is driven by a servo motor, while LEDs simulate railway signals. Relays can switch power to isolated track sections, enabling realistic train movement and automated scheduling.
The modular design makes it easy to add more tracks, signals, and accessories as the layout grows.
Web-Based Control Panel
One of the biggest advantages of using the ESP32 is its built-in Wi-Fi capability.
The control dashboard allows users to:
- Change turnout positions
- Toggle signal lights
- Enable or disable track power
- Monitor controller status
- Trigger predefined railway routes
- Update firmware wirelessly
This eliminates the need for dedicated desktop software and allows complete control from any smartphone, tablet, or laptop connected to the same network.
Servo-Controlled Turnouts
Railway switches are controlled using compact SG90 servo motors.
Each turnout has two predefined positions:
- Straight Route
- Diverging Route
The ESP32 sends precise PWM signals to position the servo accurately, ensuring reliable switching every time.
Railway Signal Automation
Realistic signaling greatly enhances a model railway.
Each signal consists of:
- Green – Proceed
- Yellow – Caution
- Red – Stop
Signal states can be changed manually or automatically based on turnout positions and predefined operating logic.
Track Power Control
Relay outputs allow independent control of different track sections.
This makes it possible to:
- Stop trains at stations
- Isolate maintenance areas
- Prevent collisions
- Simulate real railway operations
Custom PCB Design
Instead of using loose jumper wires, the project uses a custom PCB that integrates:
- ESP32 module
- Servo connectors
- Relay drivers
- Signal LED outputs
- Power regulation
- Expansion headers
The PCB keeps wiring organized while improving reliability and simplifying future maintenance.
Himanshu Dada