Model Scenery Tutorials

Comprenshive Tips. Hints And Techniques For Budget Minded Diorama Maker, Model Train Enthusiast And Wargammer

How To Make Automated Level Crossing With Flashing Lights Plus 2 Gates For 1 To 3 Tracks

A model railroad level crossing with gates, flashing roadside lights and optional alarm bells and flashing gate lights. A complete tutorial  with the Arduino sketch, materials list, wiring instructions,  and video demonstration of sketch performance.

Click To Get A Free Copy

We recommend that you get a copy of the book on making level crossings.  It covers all aspects of making a grade crossing module from a complete scratchbuild to using commercial parts.  The book is free.  Click on the image to get a free copy.



The gates on the road crossing entrance and road crossing exit close at different times.  This mimics the prototypes that allow vehicles that are on the tracks to properly exit when the entrance gates start to close.

Multiple trains can be in the crossing at the same time.  The gates will not open until the last train leave the protected area.

After the sensors signal that the last train has left the protected area, there is a 20 second delay (adjustable) to ensure that the signal detected all cars in the consist.

You can use this for one or more tracks.  The upper limit it the number of pins on your Arduino board.  The board used in this project is an Arduino Nano.

For a single road lane crossing, just eliminate the road exit gate.


Materials Needed To Make A Level Crossing With Automated Lights

There are two basic parts to a level crossing with automated lights. Those are the lights themselves and the control  circuitry.

This page focuses on the control circuitry The lights are covered in detail in this page (How To Make Level Crossing Flashing Lights) and a video showing how to make them is in the gallery above.

Control Circuitry

The control circuitry is made up of two things.  The operating program (code) and the circuit board.


Note that the code is versatile. It can be used to control gates and lights on a crossing with 1 to 3 tracks. It also has provisions to add warning bells, and lights on the barriers..  If you want lights only, just don’t make connections to gate servos.

We recommend using this sketch rather than one that only controls the lights because you may want to use it later on another crossing that has gates. And it also has provisions for warning bells.  Adding those is shown in one of the videos above and  a text guide is at this page.

The code can be downloaded from Pastebin   Click here.


Circuit Board

The images below show the circuit board.

level crossing circuit boardNote that there are 4 resistors that are not connected.  If you wish to have flashing lights on your gates, it is just a matter of adding wires to the appropriate pins.  The pins are shown in the program.






level crossing circuit board wiring

There is a gap shown in the image.  That ensures that the entrance and exit gates can be controlled separately.

I used perf board.  You might find it easier to use vero board and arrange the pin headers to take advantage of the continuous strips.



Materials Used

Servos x 2


Arduino Board – A Nano is fine.

IR Sensors – 2 for each track

Female Dupont Pin Headers

Pin Connectors

Mechanical Pin Headers

3mm replacement IR Sensitive LEDs

Prototype Board

You can get all these parts in a package at this link.

Grade Crossing Tutorials

To stay up to date and be notified as we add to this series, subscribe and click on the bell in one of the videos below.


Scroll to top