I’m using an UNO with a 4-relay shield (each relay is SPDT with vcc/JD-Vcc jumper that has built in optoisolator) to periodically reverse a DC current for a model train track setup so the train moves in both directions. The transformer that powers the train track has an adjustable pot and the voltage can be anywhere from 0 to 17 volts DC.
The UNO is powered through the usb port and a wall charger. I have tried the relay board powered both solely from the UNO and also from a 4.5v 1amp DC switching power supply (with JD-Vcc jumper removed). This does not seem to have any effect on the problem whatsoever. When the relays have no load on them then everything functions perfectly both with the relay board being powered by the UNO or with external power supply.
The problem is that at when there is no load between the tracks and the transformer (i.e. no train car with DC motor completing the circuit) the UNO and relay board function perfectly. Once a load is placed on the tracks and power is pulled through the relay output then things become glitchy. If the train moves slowly and voltage is, say, around 5v or under, the glitching is sporadic and infrequent, but it works for the most part. I get occasional phantom button presses on the UNO input pins and random resets. If I turn the power up on the transformer to a full 17v and try to run the train car, then the UNO almost immediately resets, and once the relays re-initialize and close the track circuit the UNO immediately resets again, over and over.
I cannot figure out why this is happening. The train track circuit powered by the DC transformer is a completely isolated circuit, simply using the relays to turn it off and on and reverse the current. The max current/voltage is well within the specs of the relays. When the circuit controlled by the relays is off then the relay board and UNO function normally.
What could be causing this? The relay itself (if not malfunctioning) should offer 100% isolation from the 5v control circuit and the output circuit it mechanically controls, without either circuit sharing Ground, correct?