I am fortunate enough to operate a layout called Buckingham West created by a friend of mine. The layout is inspired by Peter Denny's Buckingham layout and features a single track branch line. The creator asked if I could help him with some electronics projects, one of these was a set of crossing gates for this branch. The branch is a single track that climbs out of an intermediate station, it was signalled and fully interlocked for bi-directional working. The gates were to be interlocked with the signals for the branch.
It will come as no surprise, given which section of the site we are in, that my plan was to use an Arduino to control the crossing gates. The next decision was choose the means of movement.
I chose instead to use a pair of readily available stepper motors. In part this choice was because I wished to try something different and in part because I have had issues previously with jitter from servos.
These stepper motors are readily available and very cheap to purchase. They are included in many Arduino starter kits and can be bought from a number of internet sites, just search for "Arduino Stepper Motor".
A stepper motor is a type of motor that has individual coils that can be controlled externally. Energising the coils in order will cause the motor to rotate. Changing the order you can make it run in the opposite direction, the rate at which the coils are energised controls the speed of rotation.
These motors can also be stopped very precisely. The addition of a gearbox means they can be used to very accurately control the rotational position of the output.
The chosen motor comes complete with a small controller board, which is a Darlington Transistor array. This means the motors can be directly connected to the output pins of the Arduino. The stepper motor has a step angle of 5.625 degrees and a 1.64 reduction gearbox resulting in an output step of just under 0.09 degrees. Allowing accurate movement of each gate.
The gates are simply attached to the output shaft of each motor. The cost of the motor and gearbox was approximately £2.50, having a motor for each gate was therefore not an extravagance. It also allows the gates to be opened and closed one at a time.
The signals and the interlocking for the signals was already in place, each signal was controlled by a switch on the signal box panel. Rather than add an extra layer of complexity I decided the approach for control would be to use the existing switches for the signals to move the gates. Both signals at danger and the gates are open for road traffic. Pull off either signal and the gates close to road traffic. As soon as the gates complete the movement then the signal is moved and hence the interlocking connects the controller to the track.
This way the gates must always be clear of the lines before a train an be driven and hopefully a train will never drive into the closed gates.
The software for this was a little more complex than some of the other projects, it would
Monitor the two switches for the signals in each direction.
As soon as either switch is thrown the first gate starts to close.
Once the first gate closes the second gate starts to close.
When both gates are closed the signal selected by the switch is pulled off.
When the switch is thrown back to danger the process happens in reverse.
The software is available on the internet if anyone would like to look at it. Simply click on this link.