Skip to main content

Reply to "Using an optocoupler to connect insulated rail to input pin of shift register"

RTR12,

For the first part of my project I used the circuit proposed by Professor Chaos. 

schmittTrigger

I only made a few small changes. I am using 10V AC Hot as an input so I changed the resistor to 1k from 1.5k. The arrow going to AC common leads to an insulated rail section and a momentary push button on the control panel. The AC is connected to this optoisolator , and this is the Schmitt trigger that I used. It is slightly different from the one drawn above because it inverts the output signal. (When the button is pressed or the insulated rail connected, the signal going into the Schmitt trigger is LOW and the signal coming out is HIGH). I had to use this part because I could not find a non-inverting one with through hole mounting. The Schmitt trigger is connected directly to an input pin of a 74HC165 parallel in shift register.  My Arduino sketch requires that the 2 inputs (straight and diverging route) on each switch are connected to adjacent pins on the shift register. I plan to chain 6 shift registers together on one board so I can handle a total of 24 switches. The basic purpose of the Arduino sketch is to make sure that power is only applied to switch coils for a short period of time even if a train is parked on an insulated rail. The sketch also maintains power to the appropriate indicator light and will remember the switch positions even after power is turned off.

The shift registers are connected to the Arduino by 4 wires. The connections are described in the comments at the top of my Arduino sketch. The sketch outputs data to twice as many 74HC595 parallel out shift registers. These are connected to the Arduino by 3 wires. The data is output in the following order: input from the first register (closest to Arduino in chain) is sent to the last (farthest in chain) output shift register. This register controls the relays for the switch coils. The next to last output shift register controls the relays for the led's. The data output continues in this alternating pattern of coil / led control.

I am using this relay module to receive the output from the shift registers. It does not come with instructions, but the only required connections are the 12v dc power source (2.1mm plug), a 5v connection from the Arduino, and one wire from each shift register pin to a numbered pin on the relay board. John Galt Line suggested using transistors to power the indicator lights instead of the relays. I ordered a few transistors, and I am going to experiment with them. At first glance it seems like they would be less expensive and take up less room.

I am planning to build permanent boards to control 8 switches and try them out on my layout for a few weeks before continuing. Let me know if you have any questions about the details.

John

 

OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

×
×
×
×
×