Author Topic: Relay switching causing voltage spike  (Read 11930 times)

0 Members and 2 Guests are viewing this topic.

Offline SethGITopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: us
Relay switching causing voltage spike
« on: July 14, 2017, 04:46:26 pm »
Hi,

I'm building a robot which uses a large automotive relay to control power to motors. (https://www.digikey.com/product-detail/en/te-connectivity-potter-brumfield-relays/V23720A0001A001/PB1985-ND/5215141). Every time we switch the relay, it causes a voltage spike across the system. This has killed two raspberry Pis. I have a flyback diode (1n4007) across the coil in reverse parallel. This did not seem to help at all. The spikes range from about .5 volts to about 4 volts (measured on a scope). Any ideas of how to deal with this? One thought was to use a transient voltage suppressor, but I have no clue if that's right. 

Thanks,
Seth
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4952
  • Country: gb
Re: Relay switching causing voltage spike
« Reply #1 on: July 14, 2017, 04:54:42 pm »
The 1N4007 is a very slow (recovery time) diode. Have you tried a much faster diode ?
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6268
  • Country: de
Re: Relay switching causing voltage spike
« Reply #2 on: July 14, 2017, 05:03:07 pm »
It says coil resistance 4 ohms, meaning it's pulling 3 A.
That a lot of noise on your power lines, and a bit much for a 1N4007.

I think you need to look at your power distribution, separating electronics and power completely, and seriously consider optoisolation between power and logic.
 
The following users thanked this post: MK14, omulki

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4952
  • Country: gb
Re: Relay switching causing voltage spike
« Reply #3 on: July 14, 2017, 05:08:18 pm »
It says coil resistance 4 ohms, meaning it's pulling 3 A.
That a lot of noise on your power lines, and a bit much for a 1N4007.

I think you need to look at your power distribution, separating electronics and power completely, and seriously consider optoisolation between power and logic.

I second that. Using opto-isolators, is a very good idea.
I did not realize it was a 3 amp coil relay. I should have looked at the link.

Motors can be very (electrically) noisy. So it is a bad idea, for them to share the same supply rails, as the rest of the circuitry. I.e. The MCU.
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7526
  • Country: ca
Re: Relay switching causing voltage spike
« Reply #4 on: July 14, 2017, 05:14:32 pm »
Many things can be causing your trouble.

That big relay/contactor (450VDC, 250A) 3A coil current, switching that alone can damage things.

The diode must be located close to the relay coil wiring, and the MOSFET grounded away from the Rpi and a gate resistor there too. Isolated I/O there is best. If you post pics or your schematic that makes it easier.

The contactor usually arcs and makes a burst of EMI during switching, and large back-EMF voltae spike from the motor too.  If the RPi is physically close it will probably crash. I would have an RC snubber across the contacts. Not sure what the motor voltage is.


In all likelyhood it is the RPi power supply getting damaged by the huge motor currents getting switched on/off. I would have a filter and transient supressor on the PSU input.

If this is a big motor and can kill people, then you need a decent emergency stop switch that overrides the Rpi and its hardware. Forklifts use this, in series with the contactor coil, or a second (safety) contactor altogether.
« Last Edit: July 14, 2017, 09:14:19 pm by floobydust »
 
The following users thanked this post: MK14

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4952
  • Country: gb
Re: Relay switching causing voltage spike
« Reply #5 on: July 14, 2017, 05:30:29 pm »
It probably would have helped if you had provided some more details about your robot.
Assuming it is the one you already posted about.
So it apparently already has a kill switch (but its design maybe is dubious) and needs to be water proof, for going underwater, etc etc.

EDIT:
The details above, can be important. Because having interference and back-emf effects, messing up circuit operation, in something which can be dangerous, to people. Is a very bad idea.

E.g. your killswitch should be an effective 100% power off/isolator, rather than something which may not always work correctly (if I understand the other thread, where you seem to be criticized about it).
« Last Edit: July 14, 2017, 05:47:42 pm by MK14 »
 

Offline SethGITopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: us
Re: Relay switching causing voltage spike
« Reply #6 on: July 15, 2017, 02:44:08 pm »
Ok here's an update that should cover everything.

For the sake of testing, I completely disconnected the coil from everything else. I'm till seeing the voltage spike on the completely disconnected coil. I'm powering the relay off a bench supply. I'm still seeing the voltage spikes. This means it must be caused by the magnetism. How would you recommend dealing with the spikes? We only have a few days to get this worked out.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6268
  • Country: de
Re: Relay switching causing voltage spike
« Reply #7 on: July 15, 2017, 05:41:39 pm »
Nobody ever doubted that it's from the coil, that was clear from the start.
You get a double "kickback" effect, first from the coil inductance itself, and second from the mechanical movement of the actuator away from the coil.

There are two options (or perhaps even a combination) for solving this.

One is diverting the energy stored in the coil by sending it back on your supply line. That's what the reverse diode does.

Second is dissipating the stored energy, this can only be done through heat in some resistive snubber.

Diverting brings it own problems: as the coil voltage is limited to perhaps 1 V by the diode-to-supply during turnoff, the release time of the relay switch is prolonged and will probably cause contact arcing/burning.

Dissipating can be done, but normally means you have to isolate the coil during turnoff, meaning you need both high-side and low-side switches for the coil, plus a diode/resistor/capacitor snubber to absorb the energy.

There's no easy solution, especially with a contactor as large as this one (and probably a motor that's even bigger).

My original suggestion of having separate supply circuits for control and power still stands, where you allow the power side to be "dirty" with spikes and sparks being kept somewhat in rein by a couple of fat MOVs or/and tranzorbs across the supply, and the control side having a quiet supply.
Optoisolation on all signal lines between the two circuits, of course.

But doing this in two days is probably not possible.

Best I can do, sorry.
« Last Edit: July 15, 2017, 05:50:50 pm by Benta »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20004
  • Country: gb
  • 0999
Re: Relay switching causing voltage spike
« Reply #8 on: July 15, 2017, 06:03:09 pm »
One is diverting the energy stored in the coil by sending it back on your supply line. That's what the reverse diode does.
Not quite. No energy goes back to the supply line. The energy is dissipated in the coil's resistance and diode. The problem with that is, it takes while to decay, causing the contacts to open slowly, resulting in arcing.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6268
  • Country: de
Re: Relay switching causing voltage spike
« Reply #9 on: July 15, 2017, 07:24:26 pm »
Hero, you're absolutely right, mea culpa.

Which makes me think, that the sudden loss of 3 A current draw makes a voltage regulator somewhere act up...
 

Offline Damianos

  • Frequent Contributor
  • **
  • Posts: 268
  • Country: gr
Re: Relay switching causing voltage spike
« Reply #10 on: July 15, 2017, 08:33:26 pm »
Except of the (obvious?) separation of the control and high power circuits supplies:

- Did you studied the data-sheet? I am not meaning looking at it from a distance!
- Did you reduce the power (voltage/current) of the coil, after the activation? They provide also a circuit ...
- What you expect from a diode to do, with this coil? It can destroy it in some cases!

 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7988
  • Country: nl
  • Current job: ATEX product design
Re: Relay switching causing voltage spike
« Reply #11 on: July 16, 2017, 12:02:53 pm »
It says coil resistance 4 ohms, meaning it's pulling 3 A.
That a lot of noise on your power lines, and a bit much for a 1N4007.

I think you need to look at your power distribution, separating electronics and power completely, and seriously consider optoisolation between power and logic.

I second that. Using opto-isolators, is a very good idea.
I did not realize it was a 3 amp coil relay. I should have looked at the link.

Motors can be very (electrically) noisy. So it is a bad idea, for them to share the same supply rails, as the rest of the circuitry. I.e. The MCU.
Rule of thumb is that the diode nominal current capability should be equal to the relay current. And as fast as possible.
Another rule of thumb is 1000uF / 1 A for the capacitors. If you dont use low ESR caps.
 
The following users thanked this post: MK14

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4952
  • Country: gb
Re: Relay switching causing voltage spike
« Reply #12 on: July 16, 2017, 07:21:36 pm »
The 1N4007 is a very slow (recovery time) diode. Have you tried a much faster diode ?

Correcting my own post.

As long as it is not being driven by a PWM or other complicated output driving schemes. According to the following link, it should be fast enough. Because it is basically the forward bias switching time (which is not too bad), rather than the reverse recover time, which can be considerably longer with a 1N4000 series device (and many other diodes).

https://www.scribd.com/document/40610418/Diode-Turn-On-and-Off-Time

That still leaves other issues, such as the fact that 3 Amps is probably too much for a 1N4000 series diode (although they will take higher than 1 A, short duration pulses, but probably not a good idea, in this case).

Quote

11SQ05I took these measurements to answer a debate on the PIC mailing list concerning theturn-on time of typical silicon power diodes. In particular, whether a silicon power diode,such as the common 1N400x series, has an appreciable turn-on delay such that itrenders it unsatisfactory to clamp the inductive kickback of an inductor, such as a relaycoil, when switched with a MOSFET.On 08 April 2009, I've extended the measurements to include release voltages andoperating time for a typical relay without a snubbing diode and with 1N4148 and1N4007 snubbing diodes. As my December 2007 measurements demonstrated, a1N4007 power diode is quite effective as a relay snubbing device, since the diode'sturn-on time is the critical element. As a preliminary matter, it's well known that standard silicon power diodes, such as the1N400x series have a significant turn-off time, commonly called the "reverse recoverytime."The reverse recovery timeinvolves a diode switching from forward biased (conducting)to reverse biased (non-conducting). The diode's PN junction, when conducting, hasexcess minority carriers and it requires a finite time for these excess minority carriers tobe neutralized when the PN junction switches from forward to reverse bias. For moredetail, seehttp://www.microsemi.com/micnotes/302.pdf . Standard silicon power diode,intended for use in 50/60 Hz power systems, exhibit a reverse recovery time of severalmicroseconds, although higher performance devices are available.Less common considered is the forward recovery time,
i.e.
, the time it takes the diode toconduct when switched from reverse to forward bias. This mode is involved in thetypical inductive clamp circuit, as can be seen from the circuit fragment below. Whenthe relay coil is energized (the 2N7000 MOSFET is biased into saturation), diode D8 isreversed biased. When the 2N7000 MOSFET is turned off, the relay's magnetic fieldcollapses and induces a
« Last Edit: July 16, 2017, 07:24:38 pm by MK14 »
 

Offline GoneTomorrow

  • Regular Contributor
  • *
  • Posts: 125
  • Country: nz
Re: Relay switching causing voltage spike
« Reply #13 on: July 18, 2017, 11:24:39 am »
The Vf of a 1N4007 is ~1.5V at 10A. The back EMF from a 3A coil collapsing might be substantially higher than that. You might just be needing a beefier diode, perhaps an actual unidirectional TVS diode.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20004
  • Country: gb
  • 0999
Re: Relay switching causing voltage spike
« Reply #14 on: July 18, 2017, 12:23:46 pm »
The Vf of a 1N4007 is ~1.5V at 10A. The back EMF from a 3A coil collapsing might be substantially higher than that.
How can the current due to the back EMF be any higher than that? It's not possible.

The diode allows the current to continue to flow through the coil, after the power has been removed, so the maximum current through the diode will be equal to the coil current, no more.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6268
  • Country: de
Re: Relay switching causing voltage spike
« Reply #15 on: July 18, 2017, 12:54:47 pm »
Quote
How can the current due to the back EMF be any higher than that? It's not possible.

Actually it can get higher, due to the mechanical movement of the plunger. Depends on the design of the contactor.
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: Relay switching causing voltage spike
« Reply #16 on: July 18, 2017, 01:00:25 pm »
Place a proper transient-voltage-suppression diode cross the power supply and place a fast schottky-diode across the coil.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20004
  • Country: gb
  • 0999
Re: Relay switching causing voltage spike
« Reply #17 on: July 18, 2017, 03:47:24 pm »
Quote
How can the current due to the back EMF be any higher than that? It's not possible.

Actually it can get higher, due to the mechanical movement of the plunger. Depends on the design of the contactor.
Have you made any measurements or seen any actual data?

The inductance will decrease slightly, when the spring returns the contacts to the off state but that won't be until the current has already decayed significantly and I don't see how any increase in current, would be above the initial state.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6268
  • Country: de
Re: Relay switching causing voltage spike
« Reply #18 on: July 18, 2017, 04:05:09 pm »
Quote
Have you made any measurements or seen any actual data?

I've seen it in solenoids. Don't know how this contactor is made, though.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8905
  • Country: fi
Re: Relay switching causing voltage spike
« Reply #19 on: July 18, 2017, 04:15:34 pm »
I think driving a large relay requires, first and foremost, layout design. Adding suppressors should be thought about after the layout is properly designed first.

You should think about the route the current flows; also, you need to supply the current from somewhere - this means capacitors. If the capacitors are insufficient or in the wrong place, you end up driving peak currents out from the Rpi's onboard capacitors - and, worse, Rpi doesn't provide proper high-ESR dampening bypass cap, so it's sensitive for this kind of abuse, and can easily blow up due to voltage peaks from LC ringing simply caused by switching any external load.

Once you fix the mistake of using a wrong (slow) type of diode in the wrong place (at the relay), you can arrive at a properly decoupled half bridge design; that's what a relay driver is! You should have the FET and the diode tightly coupled with enough low-inductance DC link capacitance at the bridge. This DC link capacitance should then include some ESR to snub parasitic ringing; typically it would be a combination of small MLCCs or film caps in the bridge, no more than a few mm away, and then some large electrolytics to provide the R for dampening the LC.

If you STILL have voltage spike issue after this, in the DC link, adding the TVS can be considered.

Driving a relay using a transistor from a simple microcontroller or computer IO pin is a big catch for young players; it appears utterly trivial, but actually requires much deeper understanding than most people ever realize.
« Last Edit: July 18, 2017, 04:17:16 pm by Siwastaja »
 

Offline SethGITopic starter

  • Regular Contributor
  • *
  • Posts: 51
  • Country: us
Re: Relay switching causing voltage spike
« Reply #20 on: August 07, 2017, 02:43:19 am »
I know it's been a while, but I figure I might as well post the conclusion we came to. Whether it's technically right or wrong can be argued about, but I'm 100% sure it works, because it did.

Diagnosis: It was just a fucking massive relay. It was huge. Too big. Any relay which needs 3A to keep the coil switched is a bit absurd.
Solution: Get a smaller relay. Limited total power draw by our motors, but whatever we never got close to the max anyways.
Results: Worked great. Still got some voltage spikes upon powering up, but that makes sense because all the caps on the motor controllers had to be charged. Obviously circuitry could have been put in place to prevent the inrush current, but given time constraints we didn't have time to play around with that. Absolutely no spikes left on powering down.
Extra safety measure: The only component in the electronics which was susceptible to the voltage spike was the raspberry pi. All of the 5 arduinos have protection, as does the main computer (desktop computer with intel i5 and GTX1060.) So, we added an external switch to turn off the raspberry pi before we turn on the relay. This worked great since we could still turn off the switch without causing damage, and just got a little extra piece of mind by always powering up with the raspberry pi off. We then just implemented some auto-run software to reconnect via ROS and launch all the required nodes, pick back up the I2C communication, and send a heartbeat to the main computer to confirm that all was working well. Near the end of the competition I started getting lazy and just turning the relay on and off without turning off the raspberry pi and we didn't cause any damage.

Thanks to all for the suggestions! This worked fine for us though.
 

Offline Damianos

  • Frequent Contributor
  • **
  • Posts: 268
  • Country: gr
Re: Relay switching causing voltage spike
« Reply #21 on: August 12, 2017, 06:29:12 am »
Instead of blaming the relays you can start using them properly!

The relay mentioned initially does not need 3A to stay activated. The steady 12V was wrong for its coil. The selected solution for suppressing the coil voltage was the worst...

When you have time, visit the manufacturer website, they have data-sheets and some relative application notes. By studying you can learn some more things about these devices.
There is not a need for exotic magic tricks, just a little study.

 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3341
  • Country: au
Re: Relay switching causing voltage spike
« Reply #22 on: August 12, 2017, 12:52:56 pm »
I never use a diode across a relay coil. Whenever I drive a small relay I use a BC639 with 80V rating and a BZX79C75 zener from emitter to collector. This allows the relay to demagnetise much faster because with a 12V supply for example the coil inductance can empty into 63 volts instead of 0.6V. Also the armature separates from the pole piece much quicker so the contacts are less likely to stick. You can clearly hear the difference. If the sudden cessation of coil current is an issue then start off with a 1uF 63V cap from emitter to collector across the switching transistor to slow down the rate the current quits flowing in the coil.
« Last Edit: August 12, 2017, 12:54:55 pm by Circlotron »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf