Skip to main content

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

JGL,

I hope you don't mind that I am working on this at the same time as you. I initially wanted to learn enough so that I would understand what you are doing, but I got interested in the Arduino and decided to go ahead and take a stab at the program. I'm also becoming comfortable with the components so you won't have to hold my hand through the wiring process.

I have an unused fixed 10V post on my transformer that I plan to connect to the optocoupler.  Do you think that would be okay? It would be easy to switch to another source at this point. 

Here is a link to the relay board that I purchased for testing. It uses a separate 12v power supply to run the relays. The relays are activated by a LOW signal from the shift register, and I read somewhere that this only uses 3 mA of current.  I can also power the indicator lights through a relay to reduce current flow through the shift register. Let me know if you think I need the transistors with this setup. I am going to need some help on the transistor circuit if you think it is necessary.

I was aware of the memory issue with the Arduino. I'm trying to be careful while testing, but I will probably shift the storage to a different memory location once I've finished all the testing. The code is written so that it only writes to memory when a switch is thrown and only reads once in the startup.

Let me know if you need an explanation of anything in my sketch. Here is a basic outline of the flow of the sketch:

1. Read all inputs from shift registers (assumes 4 switches to each register, each switch on 2 consecutive pins)

2. Check to see if a timer is running for each input (a timer running indicates that power has already been turned on to the switch coil and led)

3. If the timer has been running less than 1 second then maintain power to the switch coil

4. If the timer is between 1 and 3 seconds then remove power from switch coil (this keeps down chatter from the insulated rail)

5 After 3 seconds reset the timer to 0 unless the input indicates that the insulated rail section is still occupied or a button is being held down. (This way the sketch will keep checking every loop and reset the timer to 0 once it no longer senses a signal from the insulated rail.)

6. If no timer is running then if a signal is present at an input, turn on power to switch coil and led. Also turn off power to opposite led and start timer.

7. Send all outputs to shift registers. ( 2 output registers for each input register. 1 for switch coils and 1 for led's)

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

×
×
×
×
×