4
\$\begingroup\$

I often see circuits with relays and diodes like this:

enter image description here

Note the diode D1 in parallel with RLY1, at reverse polarity to the driving voltage V1. Per my research, the reason is that the relay coil is basically an inductor, and when an inductor is deenergized it wants to continue forcing current along the same path regardless of external circumstances, and if such path isn't available bad things can happen due to a phenomenon called flyback voltage spike.

I built a circuit (below) which functions as desired without any diodes. I can see no voltage spikes appearing around either relay coil in the simulator. But I'd like to know, do either of the relays need such a diode? If yes, do all relay circuits need such diodes? If no, in what circumstances can designers get by without such diodes?

enter image description here

\$\endgroup\$
12
  • 1
    \$\begingroup\$ Your simulator might not simulate the delay between Relay1 making a connection and breaking it. Some very basic simulators don't even simulate relay coils as coils. You should get a voltage spike between the switch and the Relay1 coil, when you turn the switch off. \$\endgroup\$ Commented Feb 2, 2023 at 1:01
  • \$\begingroup\$ @user253751 So Relay1 is affected, but not Relay2, correct? The simulator I used is falstad.com, link in the post. \$\endgroup\$
    – Jamesfo
    Commented Feb 2, 2023 at 2:06
  • \$\begingroup\$ An R-C snubber can be used instead of a diode. Values can be tweaked to get faster dissipation of stored inductive energy. Or a diode can be used to dump the energy into a capacitor, or back into the power supply for "recycling". \$\endgroup\$
    – PStechPaul
    Commented Feb 2, 2023 at 2:37
  • \$\begingroup\$ falsted is great for ballparks, but does not simulate higher-order effects like coil induction, copper losses, thermal effects, and many other real-world parameters that often do indeed matter. Think of running the relay w/o flyback as like running a car w/o oil; sure it will start and drive off the lot, seeming like "hey, we don't need oil afterall!", but for how long? Don't be too creative or chincy around best-practices, it seldom pays off. \$\endgroup\$
    – dandavis
    Commented Feb 2, 2023 at 6:05
  • \$\begingroup\$ @dandavis I appreciate that insight. Any suggestion how to add a flyback for Relay2, since its coil passes current in both directions depending on Relay 1? \$\endgroup\$
    – Jamesfo
    Commented Feb 2, 2023 at 7:56

5 Answers 5

3
\$\begingroup\$

Yeah, pretty much. If you're switching a coil off, there will be a reverse voltage (flyback). You use either a diode, R-C snubber or some other means to absorb it. The best placement for the diode or other suppressor is right at the coil itself to get maximum effectiveness.

Any coil that is suddenly de-energized will make a fly-back reverse voltage spike as its magnetic flux collapses. The flyback voltage can be estimated as follows:

  • \$V_{ind} = L_{ind}\frac{dI} {dt}\$

A typical switch turning off a coil will result in a near-instant \$dt\$, resulting in a good-sized spike even for a smallish, low-current relay.

Let's work an example. This 5V relay: https://www.farnell.com/datasheets/16770.pdf

  • L = 65mH
  • Coil resistance (current @5V) = 130 ohms (38.5mA)

So now we chop the current from 38.5mA to nothing (\$dI\$) in 1ms (\$dt\$):

  • V = 65mH * -38.5mA/1ms = -38.4V

Note that at 1ms I'm being generous with \$dt\$ here. It would be on the order of microseconds, which could result in hundreds, if not thousands of volts at the coil - well above what your switching components can stand (FET, BJT, etc.) Even switch contacts, such as from a push button or another relay, can be damaged by flyback-induced arcing and eventually fail, not to mention the spike making its way back to the power supply and nerfing other parts of your system.

(Flyback diodes. Cheap insurance.)

If your coil drive voltage is AC, a diode won't work. You can use an RC snubber, back-to-back Zener diodes, or a purpose-built device called a TVS (transient voltage suppressor).

Regardless of type of spike-catcher you use, the best placement for the suppressor is right at the coil itself to get maximum effectiveness.

As for your proposed circuit, the first relay certainly needs a diode. The second relay probably isn't an issue as the current should have decayed to zero by the time the contacts swing. However, tf that time is short (say, if the relay contacts or the switch chatters) you could still have a problem.

\$\endgroup\$
6
  • \$\begingroup\$ Good answer. I'm picking up on the keyword "suddenly" here. Is this on a millisecond scale? Nanosecond? I'm curious about Relay2 in the circuit I specified, which is subject to initial current around 28mA which drops to 1mA after 1.2seconds -- so it is a gradual reduction as the capacitors charge up -- it should be safe, right? \$\endgroup\$
    – Jamesfo
    Commented Feb 2, 2023 at 3:07
  • 1
    \$\begingroup\$ @Jamesfo Coil inductances are on the order of mH~H so milliseconds are relevant here. Incidentally, contacts can go between conducting/non in fractional nanoseconds, making them an absolute menace to EMI! Your simulator almost certainly doesn't model this. \$\endgroup\$ Commented Feb 2, 2023 at 3:56
  • \$\begingroup\$ @TimWilliams Appreciate the insight. In my limited experience with the falstad simulator it seems capable of microsecond resolution, and with the default specs for the modeled relay/coil I scoped a flyback voltage of more than 953V across the open circuit. It's fascinating to ponder what might happen at even smaller timescales. \$\endgroup\$
    – Jamesfo
    Commented Feb 4, 2023 at 0:37
  • \$\begingroup\$ @Jamesfo Falstad isn't really suited to this kind of analysis: a real coil has considerable resistance, both series (the wire itself) and parallel (the core acts like a shorted turn on a transformer). The winding also has capacitance (it's a bunch of wires next to each other!). This will ultimately limit peak voltage at turn-off even for an ideal (non-arcing) switch. A spark gap model is very nonlinear, so is challenging to simulate through numeric analysis (SPICE, let alone this), but can be done; one can use such a model to recreate EFT (electrical fast transient) waveforms. \$\endgroup\$ Commented Feb 4, 2023 at 7:50
  • \$\begingroup\$ @TimWilliams true enough. This is difficult to model even in a ‘real’ spice sim. My model was just the given L and DCR of the coil, not accounting for any other parasitics. That said, it demonstrates the basic vulnerability of the switch and the need for a spike catcher. \$\endgroup\$ Commented Feb 4, 2023 at 21:27
5
\$\begingroup\$

The main purpose of a flyback diode is to protect the switching transistor from inductive high voltage spikes that result when the transistor switches off.

If you are using mechanical switches, they may be more tolerant of such spikes. However, if you are trying to design a long-lasting reliable product, you should consider that high voltage transients still create a small arc when a mechanical switch opens. Repeated arcs will create pitting and start to erode the contacts of the switch, eventually leading to a phenomenon of a "sticky" switch where sometimes contact isn't made or broken as expected (the operator might toggle the switch again and it works fine the second or third time, etc.).

So the answer to your question, "In what circumstances can designers get by without such diodes?" is "When it is a temporary or hobby design where longevity isn't a concern."

\$\endgroup\$
7
  • \$\begingroup\$ Thanks, two questions: If I understand you, "when the transistor switches off" is referring to Q1 in the top image. Is it equivalent, then, to say "when the voltage across the relay coil is removed"? What happens if the 5V source is a USB port and the switch shown is representing the interruption of the voltage as would happen when the computer shuts off? Do the high voltage transients travel all the way back into the PC components? I assume there would be no arc, because there is no air gap when the circuit is "switched" off. \$\endgroup\$
    – Jamesfo
    Commented Feb 2, 2023 at 2:01
  • 2
    \$\begingroup\$ @Jamesfo Technically it is whenever you rapidly reduce current to the coil. \$\endgroup\$
    – DKNguyen
    Commented Feb 2, 2023 at 2:17
  • \$\begingroup\$ @DKNguyen That's clear. So now I'm wondering, what is rapid? In the case of Relay2 in my circuit, the current flowing through the coil hits about 28mA when the switch at 5V is closed, then the capacitors fill up which decreases the current through the coil to <1mA after 1.2s... is that slow enough to not be an issue? What happens if the switch is toggled quickly, such that ~25mA runs through the coil in a forward direction when Relay1 is on and then a much smaller current, say ~5mA runs through it in the reverse direction when Relay1 switches off? \$\endgroup\$
    – Jamesfo
    Commented Feb 2, 2023 at 3:18
  • \$\begingroup\$ @Jamesfo In most cases you won't know or need to know exactly how rapid is rapid. But anything you consider to be interrupting the current is rapid enough. 1.2s is fine. Let's say anything shorter than 100ms starts to matter and the higher the inductance is the longer it needs to be to keep the flyback voltage down. If you toggle 5V quickly then that's a problem because now the RC isn't slowly tapering off the Relay 2's coil current; Relay 1 is rapidly interrupting it. \$\endgroup\$
    – DKNguyen
    Commented Feb 2, 2023 at 3:26
  • \$\begingroup\$ \$V=-L\frac{dI}{dT}\$ is the voltage spike. \$\endgroup\$
    – DKNguyen
    Commented Feb 2, 2023 at 3:32
2
\$\begingroup\$

Do all relays need a diode,

No, not all, only about 90% of them do.

In your circuit if you build it for real you'll see sparking in the switch. a diode on the first relay would help that, and make the switch last for longer. Simulated parts are indestructible, real parts wear out and break.

The second relay will be mostly switched with the coil unpowered so no diode, and probably no snubber even needed,

As the power to this relay's coil is bi-directional a simple diode won't work, you could power it through a bridge rectifier, or go with a resistor-capacitor snubber instead. or just ignore it because mostly the circuit will be switched with no current through the relay.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you for taking the time to understand the circuit and reaffirming my initial suspicions. I have now built it and added a diode across the first relay. \$\endgroup\$
    – Jamesfo
    Commented Feb 4, 2023 at 0:17
1
\$\begingroup\$

It's not always necessary, and not always desirable.

Machine controls that have relays switching relays typically don't have diodes (especially if the coils are AC) or snubbers. The lack of such causes a bit more sparking on opening, but the contacts are generally robust and that is not limiting, even with 24/7 repetitive operation.

The lack of a diode or snubber can lengthen the life of the relay that is being switched since it allows the contacts to open faster and thus arc less. That can be a more important consideration than the small amount of sparking from a mA level coil current. One might note that relay life (in the relay datasheet) is typically specified without a diode across the coil.

The real situation with the open coil after the circuit has been opened is not that the voltage would become enormous anyway, if you measure it, you'll find "ringing" (a damped sinusoidal waveform) as the coil inductance resonates with the distributed capacitance of the coil. That limits the voltage so it's hardly worse than switching a small current at mains voltage. If memory serves, the resonant frequency is typically in the AM radio band, give or take, depending on coil construction etc.

When you have fragile silicon junctions switching the coil rather than macroscopic chunks of metal, a few hundred volts at mA can lead to permanent damage so diodes or similar means (zener with diode in series, for example) are often used. One clever method used in some power shift registers is to fabricate a zener diode on the chip that partially turns on the MOSFET with over-voltage, but that absorbs the energy in the chip.

\$\endgroup\$
1
\$\begingroup\$

I found this on TE Connectivity, in the definitions section of "Automotive, General Purpose and Signal Relays" pdf 05.2018:

Coil suppression circuit

Circuit to reduce the inductive switch off voltage peak of the relay coil (EMC protection, switch off voltage peak). Most of such circuits reduce the armature release speed, which may decrease the relay lifetime depending on the application load. Especially diodes or any PN-junction of the electronic control system in parallel to the coil will significantly reduce the electrical lifetime. Recommended that relay performance testings to be evaluated with the suppression that will be used.

Note: unless otherwise specified the indicated relay data refers to coils without any components in parallel or in series to the coil.

I can warmly recommend also the Panasonic "Automotive relay user guide". It is a treasure.

On DC loads they advice using zener diodes twice the supply / load voltage, either across the coil, with one diode and a zener in series or from low side of coil to ground when the coil is supplied directly from supply or no harm can be done in the supply end of the coil.

Google: "Panasonic automotive relay user guide" and you are good.

There are an extensive elaboration and mostly warnings about slow release times with subsequent arcing and not using caps because of increased arcing when loading the cap.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ @mortenlund - Hi, (a) As you're new here, please see the tour & help center for the main site rules & etiquette, as they differ from typical forums. (b) To comply with the site rule when including material copied or adapted from elsewhere, a direct link to the source material is needed (not a Google/Bing link) and that copied/adapted material must be clearly indicated e.g. using blockquote formatting. I did both things for you here. Please note it's your responsibility to do it in future. || Also make sure to clearly answer the specific original question. Thanks. \$\endgroup\$
    – SamGibson
    Commented Oct 17, 2023 at 13:56
  • \$\begingroup\$ I am sorry for this, thanks for correcting the post and I will do my best in the future to follow site rules. \$\endgroup\$
    – mortenlund
    Commented Oct 17, 2023 at 15:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.