A complete, Arduino-driven railroad crossing package: IR detection, alternating LEDs, dual servos, and a looping crossing bell sound — designed, documented, and taught as a live workshop for the Sun City model railroad club.
The goal: build a reliable, repeatable railroad crossing for a G-scale layout that felt like a real piece of infrastructure — and use it as the centerpiece for a hands-on class.
This page is the portfolio view: the journey, design choices, and finished package. The full step-by-step teaching guide lives with the club materials in Sun City.
This is the hardware that went into the final Sun City demo crossing — the exact stack that drove the IR detection, lights, gates, and sound.
001.mp3 crossing bell soundFor the class handout, these parts were summarized into a printable list along with the wiring diagram so anyone could rebuild the crossing from scratch.
The first requirement was simple on paper: “When the train goes by, make the lights flash and the gates go down.” In practice, it became a small systems project involving sensing, motion, sound, power, and a friendly tuning experience for the club.
What started as a simple toy crossing ended up as a small but complete embedded system with a story, documentation, and a room full of people watching it come to life.
These clips capture how the project evolved — from a bare proof-of-concept on the bench to a full G-scale crossing with sound on the layout.
The final wiring diagram became the core of the handout. It ties together the IR sensor on D2, LEDs and resistors on D3/D4 and D6/D7, servos on D5 and D8, and the serial MP3 board on D10/D11 with a 1 kΩ resistor on the Arduino TX line.
During the workshop, this diagram was projected and printed so builders could trace every connection without feeling lost in the jumper wire jungle.
Click the diagram to zoom in.
The firmware is intentionally straightforward: a small state machine handling three phases (idle, active, returning up), plus a simple servo animator and a few MP3 helper functions. The class could safely experiment by changing only the constants at the top.
The Sun City railroad crossing lives on as both a working feature on the layout and a teaching artifact. The hardware can be cloned from the wiring diagram, the sketch is classroom-friendly, and the project now serves as a jumping-off point for future additions: sensors on other tracks, ambient lighting, or even computer-controlled schedules.
For the club, it was a first dive into microcontrollers. For me, it was a chance to wrap hardware, firmware, documentation, and teaching into one package — and then watch a room full of people light up the first time the gates dropped on their own. The next step will be installing at the Red Poppy Railroad sometime early 2026.