Relay and back EMF

Hi everyone,

I am debugging a garbage-character LCD problem which only happens when the relay is turned on and drives a 1A/12V solenoid. Initially I thought maybe my custom-designed relay board was the problem, so I ordered a simple relay from eBay:

http://www.ebay.com/itm/221162886568?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

Then I stripped down my circuit to bare minimum consisting only of Arduino Uno, relay module from eBay, and the 1A/12V solenoid. All I do is turn on the relay every two seconds and turn it off every two seconds. What happens now is that when the relay is triggered and solenoid is active, I lose my PC's serial port connection to the Arduino. If the relay is triggered without the solenoid connected to it, the serial port connection is rock solid.

Is this normal for PC's serial port connection to drop when solenoid is active? It seems like back EMF to me. Your advice is appreciated.

Thanks,
George

It sounds like a wiring or power supply issue to me. Post a photo of your setup and preferably a schematic too, then it will be easier for us to help.

Back emf is generated when the solenoid is switched off rather than on, and can be tamed by connecting a diode in parallel with the solenoid, cathode to positive end, anode to negative end.

dc42:
It sounds like a wiring or power supply issue to me. Post a photo of your setup and preferably a schematic too, then it will be easier for us to help.

Back emf is generated when the solenoid is switched off rather than on, and can be tamed by connecting a diode in parallel with the solenoid, cathode to positive end, anode to negative end.

Attached is a photo of my barebone circuit. The wires are labelled in red. Please let me know if you need more info.

One correction to my previous posting. The serial connection drops when the relay/solenoid is turned OFF, not ON as stated in my previous posting.

Many thanks!
George

Try moving the Arduino further away from the solenoid and its wiring. In particular, that coil of red wire will create a varying magnetic field when the solenoid switches on or off, which will induce currents in anything close to it.

Also connect a power diode in parallel with the solenoid (1N4001 will do), or a snubber network across the relay contacts.

dc42:
Try moving the Arduino further away from the solenoid and its wiring. In particular, that coil of red wire will create a varying magnetic field when the solenoid switches on or off, which will induce currents in anything close to it.

Also connect a power diode in parallel with the solenoid (1N4001 will do), or a snubber network across the relay contacts.

Many thanks. Removing the coil of red wire and placing the Arduino further away indeed did the trick. Using the relay module from eBay, the serial port connection does not drop after the solenoid is deactivated. Then I switched back to my own custom-designed relay module. The serial port connection does not drop, but the text from Arduino stops after about 30 seconds of activating/deactivating the solenoid. The main difference between the relay module from eBay and my own relay module is the addition of a photo-coupler for the eBay one. Is the photo-coupler recommended for the relay module? It seems to isolate the "noise" better. Thanks a lot.

If you are driving the eBay relay module from the Arduino's 5V supply or from the same supply that is powering the Arduino, then the optical isolation is doing nothing useful. It's only helpful if the relay board has an independent power supply.

On your custom relay board, did you remember to include a diode across the relay coil?

dc42:
If you are driving the eBay relay module from the Arduino's 5V supply or from the same supply that is powering the Arduino, then the optical isolation is doing nothing useful. It's only helpful if the relay board has an independent power supply.

On your custom relay board, did you remember to include a diode across the relay coil?

Yes, there is a diode across the relay coil. Attached is the schematic of my 8-relay module. The diodes across the relay coil are D2, D4, D6, D8, D10, D12, D14 and D16. There are two inputs to each relay because I use a matrix configuration to control 256 relays. Please let me know if you see anything fishy. Many thanks.

Protel Schematic.pdf (23.8 KB)

That looks like a big solenoid - the flywheeling diode is not optional if you want the rest of the circuit to work
(or even survive).

I suspect the large inductive spikes it was generating were putting large transients on all the wiring nearby (if
you run power+ground as a twisted pair you'll get better immunity to interference BTW, but here the lack of
a diode (or snubber) is crucial.

Hello, I found an identical issue issue here.. Sae symptoms... serial monitor and webserver stop at relay switching off.
It seems that we have similar relay boards..
http://arduino.cc/forum/index.php/topic,161087.0.html
I'm trying to collect and advice all the people that had our similar troble..
thanks

Another thing people often do wrong is running the power and ground wires separately, rather than as a
closely spaced pair (twisted pair is ideal). The current from power supply to power and ground are
equal and opposite so running them together cancels out any tendancy to radiate noise/interference.

The absolute worst case was as above with one wire formed into a coil. Coils radiate, they are efficient antennas. You can get away with coiling up a twisted pair though as the currents all cancel.

also since that is a pretty big solenoid, throw a low ohm resistor behind your flywheel diode, this lets the resistor dump the power instead of the diode. google info on it, but I think a 1ohm or so would be a nice number. I dont remember, it was a wihle ago I needed to look up some stuff like that.

permnoob:
also since that is a pretty big solenoid, throw a low ohm resistor behind your flywheel diode, this lets the resistor dump the power instead of the diode. google info on it, but I think a 1ohm or so would be a nice number. I dont remember, it was a wihle ago I needed to look up some stuff like that.

Most of the flyback energy gets dumped in the resistance of the solenoid winding, not in the diode. The main benefit of putting a resistor in series with the diode is that, if the resistance is comparable with or larger than the DC resistance of the solenoid, adding the resistor speeds up the current decay in the solenoid, which may be important in some applications. However, adding a resistor also increases the peak voltage applied to whatever device is turning off the solenoid.

Unless, the solenoid is generating a huge EMF wave (sound's like an EMI PULSE) and frying everything within 3feet of it....

The interference is coming down a digital pin or via (more likely) the 5v rails...

  1. Separate the power supply (give it a 2nd USB fed 5v supply if you have to) 2 5v supplies, and then use an Optoisolator to trigger off the Relay pin, that way it's isolated.
  2. Dump the relay board, buy an SSR. (Solid State Relay)
  3. Connect the wires to a breadboard then from the breadboard, link it to the solenoid, relay then place a 1000uf cap between VIN and GND, maybe even use an RF choke.
  4. Buy 2 cheap transceivers or use a Radio Link, to remotely trigger the relay :slight_smile:

I have an embarrassing EMF problem. I forgot to pay attention to the 5V rail, which powers the relay, and the 12V rail, which powers the solenoid. Now whenever the solenoid is turned off, back EMF is generated, resulting in resetting the Arduino, which powers and controls the relay circuit board. Attached are photos of the PCB layout highlighting the 5V and 12V rails. As you can see, the 5V and 12V rails run parallel to each other, which is foolish. I have gone through cutting the traces on several of these boards, and found out that by cutting the 12V at the point shown in the photo, the occurrence of the back EMF is about 20%, instead of 100%.

Now even more embarrassing - I have 250 of these boards! I am wondering if there is a solution which involves cutting tracing and soldering, so I can salvage these 250 boards. Many thanks!

Have you connected a flyback diode across the solenoid yet? The best place to put it is right at the solenoid terminals.

dc42:
Have you connected a flyback diode across the solenoid yet? The best place to put it is right at the solenoid terminals.

Thanks for the suggestion. I just tried it. It seems to help a bit, but the back EMF is still there as the Arduino gets reset from time to time.

Why not use an optoisolator ?

or was that ruled out?

cjdelphi:
Why not use an optoisolator ?

or was that ruled out?

Actually I have not tried an optoisolator yet. Do you have a particular IC in mind? I will buy one and try it. Thanks.

Any will do, all you need to do is drive a transistor the other end if you need more power...