Pages: [1] 2   Go Down
Author Topic: Relay and back EMF  (Read 2972 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 1
Posts: 43
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: December 20, 2012, 02:00:16 am by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 1
Posts: 43
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


* arduino-relay.jpg (249.93 KB, 960x720 - viewed 152 times.)
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 1
Posts: 43
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 1
Posts: 43
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.81 KB - downloaded 26 times.)
Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11694
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11694
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Full Member
***
Karma: 0
Posts: 171
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Edison Member
*
Karma: 29
Posts: 2361
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley

 
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 43
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!


* 5V.jpg (397.46 KB, 1417x775 - viewed 51 times.)

* 12V_label.jpg (409.22 KB, 1405x767 - viewed 40 times.)
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1] 2   Go Up
Jump to: