Flyback diode selection - Page 1
Forum section: electronics / beginners

author: Veketti
author_rank: Regular Contributor
timestamp: January 06, 2023, 02:12:13 pm
content: Hi,I've been trying to search what might be good enough flyback diode for relay coil but more I search more I get confused. I've got 24VDC relay coil which draws 85mA. Sharing the same power is connected Lilygo ESP32 wireless module. Currently I've connected 1N4007 diodes accross the relay coils. However I've found numerous posts telling that these 1N400x diodes are too slow to protect and that you need Schotty diode etc. and whatnot and some posts say it is ok. That makes me so confused that is the 1N400x diodes ok or not? According to my searches its recovery time is 30us.I already ordered some fast diodes UF4007 75ns recovery time, 1N5822 Schotty diode (advertized as extremely fast recovery time, but no values given) and BYV27-200 ultra fast recovery diode 25ns. Now I'm starting to hesitate that are any of these overkill and totally unnecessary and 1N4007 is plenty to protect the controller or not? If not then what of those three should I use instead? I hope there is consensus within you pros about this.Thank you in advance.

author: Siwastaja
author_rank: Super Contributor
timestamp: January 06, 2023, 02:35:51 pm
content: The key is, diode must switch ON quickly after the transistor switches OFF. This is so-called forward recovery and I think it's OK with 1N4007.Now, these classic diodes have crappyreverse-recovery, meaning if you switch the transistor onwhile the diode is still conducting, it takes time for the diode to turn off, causing a short circuit for a while.People who recommend schottkys think about reverse recovery instead.Diode conducts as long as it takes for the relay coil current to decay to zero: dI/dt = V/L.But usually you don't switch the transistor on that quickly (within maybe a millisecond or so), unless you PWM the relay coil; thus, reverse recovery does not matter.In any case, do remember that using a diode slows down the release action of the relay, possibly causing excessive sparking and quick wear of contacts. This is because diode has low Vf, so the energy stored in the relay coil inductance, is mostly spent in that relay coil itself, making it pull.I already mentioned dI/dt = V/L; by losing more voltage over the diode, larger part of the stored energy is wasted in the diode, making the relay turn off more quickly. This is why instead of a diode, do consider using a bi-directional TVS, with clamping voltage somewhat higher than the supply voltage (so that it does not conduct inadvertently), but significantly less than the maximum voltage rating of the transistor. For example, for a 12V relay, one could use a TVS with 15V of clamping voltage, and MOSFET with Vds_max = 30V.Also layout is important. The diode needs to be physically closest to the transistor, not next to the relay coil. Don't forget a capacitor between supply and GND, physically close to the transistor and diode. In other words, minimize the loop inductance (length) going from capacitor +, through the diode, through the MOSFET, back to capacitor -.

author: Veketti
author_rank: Regular Contributor
timestamp: January 06, 2023, 02:50:14 pm
content: Ah, ok. I was in assumption that when the coil is energized, the diode is in reverse state (non conductin) and when coil switched off it takes 30us until it switches to conducting and starts suppress the current. So this time is the time which might damage other devices. In my case the coil will be energized again after minimum of 15 minutes so then the 30us reverse recovery time is plenty.

author: Siwastaja
author_rank: Super Contributor
timestamp: January 06, 2023, 02:54:06 pm
content: Reverse-recovery is time from conducting to non-conducting state. This is indeed irrelevant because when you are turning the transistor on, current through diode is already zero, has been zero for 15 minutes.But imagine yourself driving the coil (or say, a DC motor!) with square wave at say 100kHz. Then the current would be continuous, still freewheeling through the diode, when the transistor switches on. Now both diode and transistor are on simultaneously - short-circuiting whatever capacitors you have between the supply and GND, until finally the diode stops conducting after the reverse recovery time. This short circuit current can be quite massive, rise time limited by the small amount of loop inductance from the layout only. You would want to use a schottky type for such PWM application.

author: wasedadoc
author_rank: Super Contributor
timestamp: January 06, 2023, 03:21:36 pm
content: Quote from: Siwastaja on January 06, 2023, 02:35:51 pmI disagree. The diode is to enable the energy stored in the coil to dissipate. The back EMF appears across the coil's ends. Confining the current to the shortest round route of coil and diode minimises the impact on any other components

author: Siwastaja
author_rank: Super Contributor
timestamp: January 06, 2023, 05:10:58 pm
content: Quote from: wasedadoc on January 06, 2023, 03:21:36 pmYou can disagree, and this is a reappearing discussion, but you are still wrong.The back-EMF appears across any inductance; in this case, L_coil + L_wiring in series. Physics does not know whether the wire belongs to the coil, or is outside of it. It nevertheless has inductance, and stores energy.Obviously, having hundreds of turns plus a core, the coil is maybe 99.99% of this total inductance, so depending on the length of wiring, it may or may not be good enough or acceptable to place diode at the coil. Usually it works, at least if you don't have to do EMC emission / immunity acceptance testing, or don't care about weird spurious MCU resets people sometimes have with designs with relays. It's a compromise.The purpose of the diode is to offer path for the current to keep flowing uninterrupted. If you place the diode at the coil, you have missed the inductive loop caused by wiring.It is interesting how absolutely no one ever has any problem understanding this when they design a buck converter or a motor controller; they place the two switches (sometimes two MOSFETs, sometimes one MOSFET + diode; doesn't make a difference) as close as possible to each other, even understanding the significance of DC link capacitance. Yet, for the exact same situation, when it comes to relay, people stop thinking and get confused, exactly like you.

author: Veketti
author_rank: Regular Contributor
timestamp: January 06, 2023, 06:51:09 pm
content: As I don't have TVS diodes on hand would this attached connection help to make the relay release quicker? I have DO-35 0.5W zener diodes and closest is this 27V.

author: jonpaul
author_rank: Super Contributor
timestamp: January 06, 2023, 06:53:58 pm
content: 1N4007 is fine.Jon

author: floobydust
author_rank: Super Contributor
timestamp: January 06, 2023, 08:27:28 pm
content: Another point is the back-EMF diode's current rating. You can't get more current out of a relay coil (inductor) than was flowing in the first place.So your 85mA coil can at most dump 85mA into the diode. I'm not sure why people use a big heavy diode, because the disadvantage is they cost more, take up more space, and are slower recovery (although that is only an issue if you are using peak-hold drive). So I no longer use large 1A diodes i.e. 1N4004 in modern SMT layouts with say a 100mA coil.A good experiment is to use a scope and measure relay coil current to prove it.For faster release times, you can add the zener or use a parallel resistor (keeping spike below the limit of the switching transistor) to save milliseconds and contact life when switching an inductive load that arcs. The faster contact opening does add lifetime. The money is better spent adding an RC snubber across the relay contacts (if it is switching inductive loads) because the contact arcing usually crashes the nearby MCU.

author: srb1954
author_rank: Super Contributor
timestamp: January 06, 2023, 08:33:42 pm
content: Quote from: Veketti on January 06, 2023, 02:12:13 pmYou could use a 1N4148 or similar, which will be smaller, cheaper and faster than most of the options specified above.There is no need to specify a 1A, or larger, rated diode as the maximum current the diode has to carry is the maximum relay current i.e. 85mA when the driver switches off. It is also not necessary to use a 1000V diode like a 1N4007 or UF4007 as the maximum reverse voltage the diode sees is the supply voltage i.e. 24V in this case. It is a myth that you must use a high-voltage diode to counter the high fly-back voltage from a relay coil as the diode is in the forward conduction mode when supressing the fly-back voltage from the relay.

author: Veketti
author_rank: Regular Contributor
timestamp: January 06, 2023, 09:39:22 pm
content: if zener diode in series with the 1N400x works for faster release, what zener voltage does it have to be? Does it need to be higher than the supply voltage or would lower voltage work. Sorry stupid guestion as I don't really understand how it helps faster release..

author: Benta
author_rank: Super Contributor
timestamp: January 06, 2023, 10:17:47 pm
content: Quote from: Siwastaja on January 06, 2023, 02:35:51 pmI'm with Siwastaja all the way here. This is a real issue.I used to place kickback diodes across relay coils but have dropped this in favour of a transient suppressor diode across CE or DS of the coil driving transistor.Example: for a 24 V system, a 100 V transistor and a 75 V (unidirectional) tranzorb across it. Sometimes, additional RC snubbing makes sense as well.Reliability and lifetime of the relays has increased immensely due to the much shorter contact spark time during break. This is of course load dependent and no issue with purely resistive loads. But try to find one of those

author: Siwastaja
author_rank: Super Contributor
timestamp: January 07, 2023, 10:01:35 am
content: Quote from: Veketti on January 06, 2023, 06:51:09 pmYes, unidirectional TVS/zener with normal diode in series works, too. Many other options, too, like diode+resistor, or just a parallel resistor.I simply prefer the bidirectional TVS because it's a single-component solution, and having fewer parts in BOM - and in the inductive loop - is an advantage.

author: Siwastaja
author_rank: Super Contributor
timestamp: January 07, 2023, 10:32:36 am
content: Quote from: Veketti on January 06, 2023, 09:39:22 pmWhy faster release?Let's see what happens.Let relay coil inductance L_coil = 1mH, coil resistance R_coil = 100 ohms, Vcc=10V and diode Vf_diode = 1V, nice round numbers.When transistor is ON, current is limited by R_coil; I_coil = 10V/100ohms = 0.1A.When transistor is suddenly switched off, the coil tries to keep the same 0.1A flowing. The voltage over the coil reverses and increases until the diode starts conducting. This is why you need quick turn-on time ("forward recovery")! OK, diode conducts now, and you have 1V over the diode. Now the equivalent circuit is the inductance supplying 0.1A to the diode. Diode dissipates 1V*0.1A = 100mW. Coil dissipates (0.1A)^2*100ohms = 1W; just like before turn-off. Most importantly, by having 0.1A still running through the coil, it provides exactly the same mechanical force as before turn-off!But the energy stored in inductance is not infinite; it's 1/2*L*I^2. So current will ramp down as energy is consumed by the coil, and by the diode. But mostly by the coil. Diode only drops a little bit of voltage; most energy is consumed by the relay coil itself. If this was a motor controller, it would begood; not much energy wasted, motor would use the stored energy to do themotor thing, creating torque.In the relay coil, current will decay by rate of dI/dt = V / L = 1V / 1mH = 1000 A/s = 1A/ms. From 0.1A to zero in 100µs! At 0.1A, the relay is holding with full strength, not a problem for contacts, just a delay. But think about what happens when the current reaches, say, 0.05A. Holding strength is halved, and you still have 50µs to go. Maybe at 0.03A, the returning spring has equal force to the electromagnet, contacts barely touch, and you have still 30µs to go. At 0.02A, contacts are separated, but the electromagnet still pulls enough against the spring so that the gap is only fractions of millimeters, sustaining an arc.But what if we had a diode with Vf=10V? Initially, current is still 0.1A. But now the relay coil will generate a voltage of 10V, instead of just 1V. Dissipation in the diode will be 10V*0.1A=1W, instead of 0.1W. Current will decay at 10V / 1mH = 10000 A/s. From 0.1A to zero in 10µs!Theoretically, inductance is capable of creating infinite voltage to make the current flow. So we provide a circuit which always has a path for current to flow; diode conveniently switches on automatically when it detects voltage exceeding Vf. If we make that path ideal (Vf=0), with zero voltage drop (short circuit), then the inductive load (relay coil in this case) uses its own stored energy fully, to do whatever it's normally doing. But we can choose to increase voltage loss in this path, forcing the inductance to create higher voltage. Just enough to make the relay open faster, by consuming the stored energy externally, but not too much to damage the transistor by overvoltage, the very reason we added this diode to begin with.A simple way to increase the Vf of the diode is to add a zener/TVS in series. The exact value is not important; something around the rated relay voltage makes it quick enough. Even just a few volts of extra drop already makes a 12V relay turn off more quickly. And of course, the largest voltage the transistor sees is the maximum zener clamp voltage plus diode Vf, so don't use excessively large clamp voltage; you don't want a large voltage spike generator, after all.If you use a bidirectional TVS, the one-component solution I suggest for simplicity, then the breakdown voltage has to be higher than Vcc so that it does not conduct all the time. Something just above the Vcc works well.Finally, if you find struggling with the concepts of inductors and energy storage, just force yourself to think with the capacitor analogy:* Capacitor stored energy is by voltage squared; with inductors, stored energy is current squared.* Capacitors keep their stored energy when open-circuit; inductors when shorted.* Ideal capacitor creates whatever current is required (up to +/- infinite) to keep their voltage* Ideal inductor creates whatever voltage is required (up to +/- infinite) to keep their current* For the same reason you don't want to short-circuit a capacitor (big current ensues), you don't want to open-circuit an inductor (big voltage ensues).

author: Circlotron
author_rank: Super Contributor
timestamp: January 07, 2023, 11:18:07 am
content: Quote from: Benta on January 06, 2023, 10:17:47 pmI've had great success over a number of years using an 80V rated BC639 with a BZX79C75 zener across emitter to collector. Max collector voltage is limited to 75v and relay releases fast. You can plainly hear the difference compared to a diode across the relay coil.

author: Veketti
author_rank: Regular Contributor
timestamp: January 07, 2023, 11:19:36 am
content: Thank you everybody, especially to Siwastaja. You have incredible amount of knowledge and you're willing to share it which is super wonderful.This is chrystal clear to me now. Thanks.

author: jonpaul
author_rank: Super Contributor
timestamp: January 07, 2023, 04:21:07 pm
content: poorly formed title: A flyback is a specific type of SMPS converter, or HV PS.A relay or contactor generates an inductive surge from stored energy when the current flow is interrupted.The transient energy is diverted by a snubber, not a flyback.The snubber is across the relay coil, and dissipates the transient stored energy on turn off.Snubbers:CapacitorR-C series networkNonlinear resistor e.g. MOVZener diodeOrdinary diodeThe relay release time and generated transient voltage will vary with the type of snubber and specific component choice.95% of small relay and coil snubber are either diodes like 1n4001..1N4007 or 100 Ohm 1 W R in series with 10..100 nF plastic or ceramic capacitor.JonJon

author: Siwastaja
author_rank: Super Contributor
timestamp: January 07, 2023, 04:51:20 pm
content: I don't like the use of term "snubber" for a freewheeling diode. I know it is being used, but terminology is matter of taste.I don't like the term "flyback diode" either, but it's very widely used synonymously to "freewheeling diode", which is the term I prefer. So "flyback" is not just a name of SMPS topology.Following the exact same logic, you could call all the switching transistors in any inductive design (say, DC/DC converter, motor controller) "snubbers". Without these switches, voltage spikes would be created, so "snubber" MOSFETs then "suppress" the creation of said spikes. This would be technically correct, but totally ridiculous and confusing.Driving inductive load always requires continuous path for current, so control elements tend to come in pairs (two transistors; or transistor + diode); when one switches off, another switches on, providing route for the current.Whenever you can't have that, for example with stray inductance within the switching loop itself, then you add something I callsnubber.But your mileage may vary. In the end, it's where you draw the line. Maybe one could draw the line to where most of the power is dissipated; so a diode would be "freewheeling diode", but turn into "snubber" when Vf is increased.

author: Smokey
author_rank: Super Contributor
timestamp: October 16, 2023, 04:20:45 am
content: What if it's a really big solenoid, like a car starter solenoid at 24V? I measured the coil current of a system like that at about 6.5A. What do you do with the inductive surge/flyback/whatever with that thing?

author: Konkedout
author_rank: Frequent Contributor
timestamp: October 16, 2023, 05:26:39 am
content: Yes and no. Been there and done that.1) 1N4007 diode recovery is bad, both forward and reverse. I have had them fail due to overheating from slow forward recovery.2) My application was a clamp diode protecting the main switch transistor in a flyback power supply. Much more severe than using across a typical relay coil which switches much more slowly and with less current.3) Even thought the 1N4007 has awful forward recovery, it will probably work well enough to clamp the flyback from a typical relay coil.4) If the current is < 100 mA and the voltage is < 40V (I am being conservative) I would probably use a signal diode such as 1N4148. Inexpensive, Smaller and faster than the 1N4007.5) A schottky diode should certainly work well within its voltage and current ratings. With the low duty cycle the current rating is not likely to much of a problem, but be conservative with the voltage rating.

author: Siwastaja
author_rank: Super Contributor
timestamp: October 16, 2023, 08:27:26 am
content: Quote from: Smokey on October 16, 2023, 04:20:45 amSimple: you provide path for the current. Then there is no surge to begin with. The idea that large inductances create voltage surges which then need to be "suppressed" is a wrong one.Diode does this "continuous path for current" thing automagically. The only question really is, are you OK with the solenoid burning its own stored energy, keeping doing the solenoid thing (pulling/pushing) for some hunderds of microseconds / maybe even milliseconds? Because that's what a diode does - being low voltage drop component, the efficiency is high and energy is spent at the solenoid. This is what is usually wanted when driving e.g. motors, but relays are a special exception where slow release is a problem, which is why alossy diodeis desired.If 6.5A is flowing, then right after switch-off, 6.5A is still flowing through the diode and starts ramping down as the stored energy is spent. So you need a diode rated to 6.5A peak. If youeverchoose to switch back ON quickly after switch-off (e.g., PWM), then you need a diode with fast reverse recovery, e.g. schottky. If you don't PWM and only switch rarely (e.g., every second or minute), then average dissipation by the diode is small and it will see 6.5A only for some sub-millisecond or so, so a surprisingly small diode does fine, something like rated to 2-3A continuous current.

author: Gyro
author_rank: Super Contributor
timestamp: October 16, 2023, 09:05:18 am
content: Quote from: jonpaul on January 07, 2023, 04:21:07 pmI'd suggest that the term 'flyback' was in use in relation to solenoids and relays long before the appearance of SMPSs and TV EHT supplies.