I designed and built a DCC+RailCom command station in Rust, based on an ESP32-C6 and the Embassy asynchronous framework. The system generates the DCC waveform with the precise timing required by the standard, receives RailCom feedback from locomotive decoders, and supports wireless control through the Z21 UDP protocol.
The firmware uses the ESP32-C6 RMT peripheral for real-time DCC signal generation, a hardware timer and UART for RailCom communication, and interrupts for emergency-stop and short-circuit protection. A scheduler coordinates DCC packets, RailCom cutouts, locomotive commands, and CV read operations.
The main hardware consists of an ESP32-C6 Mini, a DRV8874 H-bridge, 74HC08 and 74HC14 logic gates, an LM339 comparator, current-sense resistors, control buttons, and separate USB and 15 V power supplies. The result is a compact prototype combining DCC control, RailCom feedback, Wi‑Fi connectivity, and safety functions in a single embedded Rust application.