Close
0%
0%

ESP32 Model Railway Controller

The system is designed to be modular, allowing hobbyists to expand their layouts without redesigning the entire control system.

Public Chat
Similar projects worth following
0 followers
Modern model railway layouts are no longer limited to manual switches and simple DC controllers. With the power of the ESP32, it's possible to create an intelligent railway control system that offers wireless operation, automated signaling, turnout control, and real-time monitoring—all from a smartphone or web browser. 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.
Modern model railway layouts are no longer limited to manual switches and simple DC controllers. With the power of the ESP32, it's possible to create an intelligent railway control system that offers wireless operation, automated signaling, turnout control, and real-time monitoring—all from a smartphone or web browser.

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.

  • 1 × ESP32 Development Board
  • 1 × SG90 Servo Motors
  • 1 × Relay Module
  • 1 × Red, Yellow, and Green LEDs
  • 1 × Push Buttons

View all 9 components

  • About

    Himanshu Dadaan hour ago 0 comments

    Future Improvements

    Several advanced features can be added in future versions:

    • Automatic train detection using IR sensors
    • RFID-based locomotive identification
    • Mobile application
    • MQTT integration
    • Home Assistant support
    • Timetable automation
    • DCC compatibility
    • Cloud monitoring

    Applications

    This controller can be used for:

    • Home railway layouts
    • Railway exhibitions
    • STEM education
    • Electronics learning
    • Robotics workshops
    • Embedded systems demonstrations

    Projects like this also showcase practical engineering skills that are valuable for companies offering embedded development services, combining firmware development, PCB design, wireless communication, and real-world hardware automation into a single platform.

    Conclusion

    The ESP32 provides an excellent foundation for building a modern model railway controller. By combining Wi-Fi connectivity, servo control, relay switching, and a responsive web interface, it's possible to transform a traditional railway layout into a fully automated smart system.

    Whether you're an electronics enthusiast or a railway hobbyist, this project demonstrates how affordable hardware and open-source development can deliver professional-grade automation with plenty of room for future expansion.

View project log

Enjoy this project?

Share

Discussions

Does this project spark your interest?

Become a member to follow this project and never miss any updates