# Circuit Protection re: Relay Coil

Is the flyback diode adequate protection in for the microcontroller in the following circuit?

simulate this circuit – Schematic created using CircuitLab

Will my circuit experience over voltage conditions on the 5V rail despite the flyback diode? My 5V is generated by a step-down switching regulator if that matters, and that switcher circuit has a 220uF capacitor on it's LX node.

No energy goes directly into the power supply in this configuration- on turn off, the current just recirculates in the diode and coil until it dies off through the coil resistance and diode forward drop. Turn-off is indistinguishable from a resistive load from the point of view of the power supply.

The only issue is if the sudden removal of a load (doesn't have to be a relay, a resistor would behave the same) will cause the supply to overshoot too much (a small blip is inevitable), or undershoot too much at turn-on (turn-on is a bit gentler than with a resistor because of the coil inductance).

Chances are it will not bump much with 220uF on the rails but it depends on how much current the relay coil draws and how the power supply behaves. You can look at it with an oscilloscope and see. 125 ohms -> 40mA is not much current.

Also depends a bit on how sensitive your circuit is.. if you're using the 5V rail for an ADC reference (ugh) you might see the blip.

• thanks... so this is a case where I have two answers that are in direct contradiction... guess I'll wait for more people to cast their votes – vicatcu Oct 23 '14 at 23:11
• Keep in mind that it's much, much later at night for @Andyaka. – Spehro Pefhany Oct 23 '14 at 23:36
• Yeah Spehro is quite correct. My analysis is flawed. The kick back when the transistor opens circulates in the coil. I was thinking of a H bridge scenario. +1 – Andy aka Oct 24 '14 at 8:38

EDIT This answer is incorrect - I was thinking of a H bridge scenario where the power supply capacitor will receive energy via the protection diodes. Sorry. If anyone wants this answer deleting just say. I guess it's still useful somewhat but it doesn't apply to the OP's scenario.

If the relay coil is 200 ohm and has an inductance of 100mH (not the unlikely 1uH as shown in your diagram), the energy it stores is: -

$\dfrac{L.I^2}{2}$ where I is 5 volt / 200 ohm = 25 mA

Energy is therefore 31.25 micro joules.

If this energy is fully released (via the diode, assumed to be perfect)) into the 220uF capacitor, the voltage rise on the capacitor is determined by

Energy = $\dfrac{C.V^2}{2}$

Or put another way, voltage rise = $\sqrt{\dfrac{2\times energy}{C}}$ = 0.533 volts.

I hope I calculated this correctly but if I didn't you should have the mathematical means for solving this based on what your relay current actually is and what your relay inductance actually is. Note this is very much a worst case scenario because the diode has a forward volt drop which will turn some energy into heat (thus reducing the rise on C). Ditto the resistance of the coil - this will lose energy as heat and reduce the voltage rise on C.

If you need a more accurate answer may I direct you to using something like LTSpice to simulate the real result.

• ah thanks, I my relay datasheet says the current at 5V is 40mA (coil impedance of 125 ohms) – vicatcu Oct 23 '14 at 23:09
• note your answer is in contradiction to SpehroPefhany's answer... you guys should duke it out! – vicatcu Oct 23 '14 at 23:58
• The power supply capacitor is not actually in the current loop, so it will not absorb any voltage (due to the inductive current discharge of the relay coil through the diode). – W5VO Oct 24 '14 at 1:17