I am, once again, battling a problem I've battled on every such project, with varying degrees of success. I have an Arduino Nano controlling a set of 8 relays, using 4 of the little widely available Arduino dual-relay boards. Each relay is controlling a pneumatic solenoid valve, with a 12V/5W coil. The problem is, de-energizing ANY solenoid coil causes the Arduino to reset! It all works perfectly with the solenoid coils disconnected, or un-powered. I've tried everything I can think of - snubber diodes, separate power supplies, etc. Right now, I have a separate 120VAC->12VDC/2.5A wall wart connected to the relay contacts to power the solenoid coils. I have a separate 120VAC->12VDC wall wart which powers a 12VDC->5VDC DC-DC converter, which in turn powers the Arduino and the relay boards. There are NO shared connections between the two power supplies, other than the AC line. Even grounds are not connected to each other. Yet, every time I turn ANY solenoid coil OFF, the Arduino resets itself.
Snubber diode across the solenoid, on the solenoid.
No solenoid wiring near Arduino/relay wiring. No solenoid near the Arduino.
Use opto isolation if possible, which gives you a second layer of isolation.
a) Relays need a separate supply
b) JD-VCC jumper must be removed
c) NO ground wire between Arduino and relay board.
Snubber diode across the solenoid, on the solenoid.
No solenoid wiring near Arduino/relay wiring. No solenoid near the Arduino.
Use opto isolation if possible, which gives you a second layer of isolation.
a) Relays need a separate supply
b) JD-VCC jumper must be removed
c) NO ground wire between Arduino and relay board.
Leo..
The relay boards are exactly like these:
What does the "JD-VCC" jumper actually do? How should it be wired if that jumper is pulled? How do the control signals work if there is "NO ground wire between Arduino and relay board?"
OK, found what claims to be a schematic for that relay board. So:
Remove VCC-to-JD-VCC jumper
Connect Arduino VCC to VCC pin
Connect Arduino output pins to IN1/IN2 pins
Connect a separate 5V supply to the Gnd and JD-VCC pins?
In my case, the relay itself is NEVER a problem. Even with the JD-VCC jumper installed, I NEVER have a problem cycling all 8 relays in any way I choose. There is ONLY a problem when the 12V solenoid coils are connected so they can be energized by the relay contacts. The problem NEVER occurs when energizing the solenoid coils, but ONLY when de-energizing them. Since there is NO electrical connectivity between the solenoid coils/relay contacts and the "logic" side of the relay boards and the Arduino itself, it seems to me the problem has to be EMI affecting the Arduino itself.
Have you implemented the first and most important recommendation of Wawa's?:
Snubber diode across the solenoid, on the solenoid.
Actually the diode should go on the relay terminals for best effect. It provides a diversion
path for the solenoid current when the contacts open, preventing a huge voltage spike
(and preventing lots of interference and possible damage to solenoid winding insulation too).
Having the snubber on the solenoid means the current in the wiring between relay and
solenoid has to change extremely rapidly, which will radiate some EMI. Having the diode
at the relay limits the region of rapid current change to just the relay contacts...
MarkT:
Having the diode at the relay limits the region of rapid current change to just the relay contacts...
Sorry, but that is just wrong. Current continues to flow specifically because of the inductance of the solenoid coil.
V = L * di/dt
It is the inductance that causes the large voltage spike that causes arcing of the relay contacts. The current through a wire CAN be stopped almost instantly, due to the very low inductance. The coil, however, has a great deal of stored energy, which must be dissipated over a significant period of time.
Regards,
Ray L.
Putting the snubber diodes directly on the solenoid coils solved that problem, which makes sense - this is snubbing the reverse current WITHOUT sending high current through the wires, which will make them act as an antenna. I can now de-energize all the solenoid coils at once, without crashing the Arduino!
Next problem - I have two solenoid valves with 120VAC coils, which I just wired up. They are now causing the Arduino to crash when turned off. Since it is AC, can't use diodes. Only thing I can come up with is non-polarized capacitors, but I don't have any of those handy, and nowhere close by I can get them from...
Luckily, I had a couple of 12VDC solenoids I could swap in, to replace the 120VAC ones. They don't have quite the flow rate I need (they are providing air to a pair of vacuum ejectors), but are close enough for my short-term needs. I'll order some better 12VDC valves to drop in soon.
RayLivingston:
I am, once again, battling a problem I've battled on every such project, with varying degrees of success. I have an Arduino Nano controlling a set of 8 relays, using 4 of the little widely available Arduino dual-relay boards. Each relay is controlling a pneumatic solenoid valve, with a 12V/5W coil. The problem is, de-energizing ANY solenoid coil causes the Arduino to reset! It all works perfectly with the solenoid coils disconnected, or un-powered. I've tried everything I can think of - snubber diodes, separate power supplies, etc. Right now, I have a separate 120VAC->12VDC/2.5A wall wart connected to the relay contacts to power the solenoid coils. I have a separate 120VAC->12VDC wall wart which powers a 12VDC->5VDC DC-DC converter, which in turn powers the Arduino and the relay boards. There are NO shared connections between the two power supplies, other than the AC line. Even grounds are not connected to each other. Yet, every time I turn ANY solenoid coil OFF, the Arduino resets itself.
Any suggestions?
Regards,
Ray L.
Maybe a EMF spike from the collaping coil current (similar to a radio transmitter) - try shielding (ensuring the shield is grounded - (put the controller in a metal box, or wrap the solenoid in tin foil (careful not to short the wiring out).