There are two aspects to a level crossing circuit.
The first is the circuit board and the second the program.
We are going to discuss the circuit board loaded with a clever program that allows you to make level crossings that fit your scenery.
2 Warning Lights And Bells
2 Gates, 2 Warning Lights And Bells
2 Gates, 4 Warning Lights And Bells
Construction of the circuit board is covered here. How To Make A Level Crossing Circuit Board.
Adjusting the Level Crossing Circuit To Fit Your Needs
What The Crossing Circuit Does
The Arduino sketch that controls the lights gates and bells is capable of controlling 2 crossing entrance gates, 2 crossing exit gates and 4 lights on crossings that have 1, 2, or 3 tracks.
The program sits on an Arduino Nano. You just hook up as few or as many lights and gates as you wish.
Trains approaching the crossing from the East or West, trigger an IR Sensor mounted below the track. Upon triggering, the crossing goes into action. If more than one train is in the crossing, the crossing stays active until the last train leaves the crossing, This video shows that in detail. BBBBBBBBBBBBBB
What You Can Do To The Program
At the top of the program there are the following lines of code.
Change these first three lines as you wish.
byte sensor_pin[NUM_SENSORS] = { 2, 3, 4, 5, 6, 7 }; // sensor “OUT” wires connect to these pins.