Wednesday, 23 March 2016

Arduino signal aspect control

The first Arduino project was to modify the shuttle control system, which has settled in nicely and is a vast improvement on the old one, much simpler and far fewer components and wiring needed.

Modern technology and old trains don't generally mix that well (as the DCC experiment proved) but it can provide subtle little tweaks that can accentuate things like operation of the end to end shuttle, and now the signal controls. 

The current arrangement works reasonably well but isn't perfect. On the inner loop the train passes through the colour light signals, then though a home and distant double semaphore, passing one final signal before entering the tunnel. There are three trigger points to operate the signals and two PCBs control the operation - one for the colour light signals and one for the semaphores. The semaphore PCB utilises a number of capacitors, the board itself is too small the capacitors protrude making them vulnerable. Also the power consumption of this board is questionable, when the signal arms move the lights dim. I suspect that's putting unnecessary load on the power supply, as a semaphore only needs a minimal pulse of power to operate the arms.

The other minor issue is that the current controllers work on a timed basis, which is the time taken for a charged capacitor, wired to the base of a transistor and a relay, to discharge - typically 12 to 25 seconds depending on the size of the capacitor and resistor. Once the train passes the various triggers, the timing cycles begin and can't be stopped, meaning that if a train is detached and reversed into the turntable sidings, the signal will reset while the manoeuvres are going on. The ideal solution would be for the Arduino to oversee the control of all three signals, using the three triggers as it does now, with the timing cycle for the three signals paused until the train has passed the last trigger. 

After some head scratching and some research, I mocked up a test board, using push buttons to replicate the track triggers and wrote a basic control sketch. Unlike the shuttle system, which is purely a time based program and relies on no sensors, this time I have to incorporate the three track triggers and make sure that the Arduino can see them. The best way to do this is to use a similar trigger design,  a relay coil wired to each trigger section. I could have used current sensors but these are not straightforward and the relay switching method should prove more reliable. Plus the Arduino is then not directly connected to the tracks, which provides some protection from short-circuits etc. The Arduino units are very delicate and it doesn't take much to blow one up, as I've found out a few times.

For the colour light signals, there are two sets due to the double track and the trigger is wired to the points. As the points are changed, the relevant signal aspect changes, via a changeover relay. I could have done away with this design and written extra code to th Arduino but this complicates the programming and a simple changeover relay mounted within the PCB makes this job much simpler.

The new signal control system will work as follows:

Train passes the first trigger point (points after colour light signals) both signals set to red.

Train passes the second trigger (sidings points) 300 millisecond pulse of power to upper semaphore, followed by 300 millisecond pulse to the lower semaphore (to reduce the power consumption) both arms drop. 

Train passes the third trigger (before tunnel) green colour light aspect restored, corresponding signal controlled via changeover relay (as this signal block is now clear) third signal semaphore arm drops via 300 millisecond pulse. After a further five second delay, the home semaphore arm of the first signal resets, via another 300 millisecond pulse. Five seconds later and the distant aspect, and the second semaphore arm is reset, again with a separate pulse to each in quick succession.  The cycle is then complete ready for the next pass of the train through the trigger sections. 

As with the shuttle, all of the timings are adjustable so once installed into the layout and tested, the timings can be tweaked if needed.

This will leave only one capacitor controlled signal aspect controller, as this only controls the one colour light signal on the outer loop, it draws very little power and isn't worth replacing. 

If time allows then this new circuit will be installed before the next outing. 


The LED signals are fed directly from the D11 and D12 outputs of the Arduino via the changeover relay. The six transistors connected to pins D5 - D10 control the semaphore arms. The signal itself is wired common live, switching the 0v through the transistors, which again protects the device.

The three track triggers are connected to pins D2 - D4, with the device configured to recognise these pins as inputs, with the rest set as outputs (anyone familiar with Arduino sketches will be familiar with this)

The cost of construction works out cheaper than a shop-bought signal sequencer and I don't know of a commercially produced system that would work with both signal types and give me this level of control adjustment. 

Plus there's the satisfaction of seeing it all work after spending hours soldering and writing the program.

It's the little touches that make all the difference!

No comments:

Post a Comment