For fun, at the end of the head shunt I'm putting a bumper with blinking lights. To check for scale I set two 5mm LEDs on the bumper. I think they look too big. If scaled up, each of these lights would be ~1½ feet across and ~2½ feet high. On the other hand the two red 3mm LEDs are closer to 10 inches across and ~1½ feet high when scaled up.
Having blinking lights is straight forward using a 555-timer IC.
This circuit is a variation of an astable multivibrator. The output square wave on pin #3 goes from 0vdc to Vcc. The frequency is controlled by the 33kΩ resistor and the 10μf capacitor connected to pins #2 and #6 on the left. The unique feature of this circuit is that when the output, pin #3, is low current flows from Vcc to pin #3 lighting the red LED. When pin #3 is high current flows from pin #3 to ground lighting the green LED.
The voltage across the LEDs is the difference between pin #3 (0 or +Vcc) and ½ Vcc at the middle of the voltage divider. I find using 12vdc for Vcc works better. 12vdc is already available powering the Arduino Base Station. In breadboard testing, the higher voltage provided a more stable results.
Not being happy with just having blinkie lights I wanted to:
- Turn the lights on and off when the switcher was present.
- Flash faster when the switcher gets close to the bumper.
This takes some extra circuitry.
1. As part of the basic puzzle there is a need for a sensor on the head shunt. The software needs to know when the switcher, cars in tow, is clear of the turnout and then command the Base Station to stop the train. This same sensor can be used by software to turn the blinkers on when the switcher enters the head shunt, and off when the switcher is stopped. When the switcher is headed to a siding the blinkers can stay off.
Arduino Base Station pins can be configured as outputs and can source/sink 5vdc, enough to drive a LED. The 555 circuit configured to drive the blinking LEDs, require Vcc , more than 20ma. To bridge this I use a PVT312 Photovoltaic Relay. This is a single-pole, normally open solid-state relay. Turning the control LED on/off controls the output circuit. So with 5vdc, <20ma we can control as much as ±250v, 320ma.
Required changes are nominal:
- In the Base Station configure an additional output pin.
- In the Laptop control software:
- In the routine waiting for the switcher to return to the head shunt, add a command to turn on the blinkers.
- In the routine stopping the switcher in the head shunt, add a command to turn off the blinker.
2. The flashing rate of the LEDs can be changed by changing the values of the 33kΩ or 10μf capacitor referenced above. My choice is to divide the resistance and then under control bypass (short) one resistor to change the resistance/frequency.
All of this results in the following schematic.
Blinking LED schematic description.
- On the left the Photovoltaic Relay controls the 12vdc to the 555-timer and the blinking LEDs on the bumper. When the Base Station output pin goes low, current flows through the control side of the relay and power is provided to the timing circuit. The output is wired to handle max current.
- The 555-timer is configured as an astable multivibrator with output on pin 3. The frequency of the output square wave is controlled by the 10μf capacitor and the 33kΩ and 47kΩ resistors. When pin 3 is high, Vcc, the capacitor charges through the two resistors. When pin 3 is low, 0vdc, the capacitor discharges through the same two resistors.
- When the output, pin 3, is high, the capacitor charges until pin 6 reaches the threshold-voltage (~0.67xVcc) then the state changes and the output goes low. The capacitor then discharges until pin 2 drops to the trigger-voltage (~0.33xVcc) at which time the output again goes high.
- The two 270Ω resistors form a Vcc voltage divider keeping one end of the two LEDs at ~½Vcc. When the output, pin 3, is high, current flows from pin 3, through one of the LEDs and one resistor to ground. When pin 3 is low, current flows from Vcc through the other resistor and LED to pin 3.
- The flashing rate of the LEDs is changed by bypassing the 47kΩ resistor so the capacitor charges and discharges quicker through just the 33kΩ resistance. When the IR sensor detects the switcher its output goes actively low. This closes the Photovoltaic Relay bypassing (shorting) the 47kΩ resistor. This reduces the resistance the capacitor changes and discharges through increasing the frequency. The relay output is wired in an alternating current mode.
- Each of the 330Ω resistors limit the current through the control side of a Photovoltaic Relay protecting the internal LED.
Breadboard of the Blinkie circuit and a demo-video. The blinking rate changes when the HOG covers the IR sensor.
Moving from the breadboard to circuit board layout. Explanation of the figure below:
- The gray circles are the holes in the circuit board. Holes are on 0.1" centers. Board has solder pads for each hole on the back side. Think I will use a plan board with no power rails.
- Top left is a 3-pin male receptacle to receive a cable from the Base Station; receiving 5vdc and the output active low pin, used to turn the blinking warning lights on or off.
- The 2-pin receptacle next to the 3-pin may be a terminal block to receive 12vdc.
- On the right is a 3-pin female receptacle to receive a cable from the IR Sensor. The plug sends 5vdc to power the sensor and receives the active low from the sensor.
- In the middle is a 2-pin female receptacle for the cable coming from the two blinking LEDs on the bumper.
- Red wires (lines) are on the underside of the circuit board.
- Black wires, components are on the top of the board.
- The dark circles are where wires go from one side of the board to the other.
There are two spots that maybe should be fixed:
- On the back side of the board, behind the 555, wires connecting pins 2 & 6 and 4 & 8 cross. This could be fixed by moving one of the wires to the top of the board under the 555 socket.
- On the left side of the board the ground wire from the Base Station crosses under the resistor from 5vdc to pin #1 of the PVT312. Could be fixed by weaving the ground wire through the holes a little more.
Not sure either fix is worth the effort. Don't really like the 555 fix. And we are not building a satellite or nuclear assured device.
The wiring to get the two LEDs up to the bumper is simple. A 2-pin male plug, enough wire and some shrink wrap.
The final blinkie circuit board and a test. The diagram above has been updated to reflect 'as built.' 1) Move one of the wires under the 555 IC. 2) Wove the ground wire under the resistor. 3) Moved the resistor and capacitor next to thePVT312 on the right over one hole. 4) Added tick marks for the white lines on the pinched circuit board.
When the HOG covers the IR sensor you can see the onboard red LED light when the blinking rate increases.