I’m having some difficulty with my project. I’m using an UNO board with a 4-relay opto-isolated shield to reverse the current for a model train system so the train will auto-reverse when particular switches are activated. More simply put I have an adjustable 0-17V DC transformer feeding power to a DC motor (through the model railroad tracks). The relays shut off and/or reverse the current when needed.
The project runs almost flawlessly. The only problem I have is that when there is a load going through the relays I get intermittent phantom button presses and resets. The phantom button presses don’t necessarily happen when the relay’s click on or off, it can happen at any time while a load is present through the relay’s. The higher the voltage applied to the motor from the transformer through the relays, the more frequent the glitching. At close to 17 volts the UNO will constantly and instantly reset the moment one of the relays click.
I provided a (crude) diagram of my circuit. The relay board and UNO sit inside of a 4” x 8” project box, the transformer is mounted 12” away from the project box and the track rails that provide power to the train’s DC motor is roughly 23’ in length and the power wires from the relays are soldered to the track in the middle of the line (12’ on each side) .
Some side notes:
The code, switches, and relays work perfectly as long as no power is going through the relay contacts.
I tried powering the relay board through the UNO and also with an independent 5v 1amp switching DC power supply (though JD-VCC, ground connected to UNO, jumper removed). This made no difference. Also, if relay 5V power’s ground was not also connected to the UNO’s ground then the relay board did not function. See wiring diagram.
I tried a 9v DC 1amp switching power supply and also USB port power for the UNO but this made no difference.
From what I read this is a somewhat common relay issue and someone mentioned something called a “snubber”. Would this apply to this situation and if so how would I connect one (or more) in this setup where multiple relays shut off and reverse variable-voltage DC current? Any other suggestions as to how to correct this problem?