A relay is just a coil of wire around an iron core — an inductor. And an inductor has one stubborn habit: its current cannot change instantly. Switch a relay off and the coil fights back, generating a voltage spike big enough to destroy the transistor that switched it. The cure is a single diode, connected across the coil. This article works out how big the spike is, how the diode tames it, and why the diode makes the relay release more slowly.
Figure 1: The flyback diode (a) gives the coil current a safe path, and the decay curves (b) show how fast the relay releases with a diode and with a Zener clamp. (Schematic, not to scale.)
The steady state — current, energy and time constant
Take a typical 12 V relay with a coil resistance of 120 Ω and an inductance of 100 mH. While it is switched on, the steady coil current is:
I = V / R = 12 / 120 = 0.1 A = 100 mA
The coil stores energy in its magnetic field, exactly like a capacitor stores energy in an electric field:
E = ½ × L × I² = 0.5 × 0.1 × 0.1² = 0.5 mJ
Half a millijoule sounds tiny — but it is released in a very short time, and that is what makes the voltage so large. The coil's own time constant, which sets how fast its current can change, is:
Ï„ = L / R = 0.1 / 120 = 0.83 ms
Worked example — the spike without a diode
An inductor obeys v = L × di/dt: the voltage across it is proportional to how fast its current changes. When the transistor switches off, the coil current tries to fall from 100 mA to zero. If the switch forced it to zero in, say, 10 µs, the coil would generate:
V = L × Î”I / Δt = 0.1 × 0.1 / 10 µs = 1000 V
In practice the voltage rises until something gives way — usually the switching transistor avalanches and breaks down (a common transistor is rated for only 40–60 V), or the switch contacts arc. The spike also radiates electrical noise into nearby circuits. So a relay must never be switched without a path for its coil current.
The flyback diode — clamping the spike to 12.7 V
The diode in Figure 1(a) sits across the coil, anode at the transistor's collector and cathode at the +12 V rail. While the relay is on it is reverse-biased and does nothing. The moment the transistor turns off, the coil's bottom end rises above +12 V, the diode conducts, and the coil current circulates through the diode and the coil's own resistance instead of through the transistor. The collector is clamped to:
Vcollector = 12 V + VF = 12 + 0.7 = 12.7 V
— a voltage any transistor can survive. The stored 0.5 mJ is then burned off harmlessly as heat in the coil resistance. The diode only has to carry the 100 mA coil current, so a common 1N4007 is more than enough, and it must be connected the right way round: cathode to +12 V, anode to the collector. Reversed, it would short the supply the moment the relay switches on.
Worked example — how fast does the relay release?
With the diode in place, the coil current decays exponentially with the coil's time constant, Ï„ = 0.83 ms:
i(t) = 100 mA × e−t/Ï„
A relay does not release the instant the current starts to fall — its contacts open when the current drops to the dropout level, typically about a quarter of the operate current. Take 25 mA:
t = Ï„ × ln(100 / 25) = 0.83 × 1.386 = 1.16 ms
So the relay takes about 1.16 ms to release. That is fine for most jobs, but it is slow for a relay that must switch fast — and the slow release also means the contacts open while current is still flowing, which can cause a small arc.
Faster release — add a Zener diode in series
To release faster, put a 24 V Zener diode in series with the flyback diode. The coil voltage is then clamped at 24 + 0.7 = 24.7 V instead of 0.7 V, so the energy burns off much faster. The exact decay is:
i(t) = (100 + 24.7 / 120 × 1000) × e−t/0.83 − 24.7 / 120 × 1000
which reaches 25 mA in only 0.23 ms — about 5 times faster, as Figure 1(b) shows. The price is a higher voltage on the transistor: the collector now rises to 12 + 24.7 = 36.7 V, so the transistor needs a voltage rating comfortably above that — a 40 V part is uncomfortably close, so choose a 60 V transistor. A resistor in series with the diode is another, cheaper way to speed the release: a 120 Ω resistor doubles the decay rate by doubling the effective resistance, while clamping the collector to 12 + 0.7 + 100 mA × 120 Ω = 24.7 V.
Key points to remember
- A relay coil is an inductor: its current cannot stop instantly, so switching it off generates a back-EMF, v = L × di/dt.
- Worked example: a 12 V relay (120 Ω, 100 mH) draws 100 mA, stores 0.5 mJ, and has a time constant of 0.83 ms; forcing its current to zero in 10 µs would generate about 1000 V.
- A flyback diode across the coil (cathode to +12 V, anode to the collector) clamps the collector to 12.7 V and lets the 0.5 mJ burn off in the coil resistance.
- Worked example: with the diode alone the current falls to the 25 mA dropout level in 1.16 ms; adding a 24 V Zener in series clamps the collector to 36.7 V but releases the relay in only 0.23 ms — 5 times faster.
- Never reverse the diode — it would short the supply when the relay switches on. Choose the transistor's voltage rating for the clamp you use: 12.7 V with a diode, 36.7 V with a 24 V Zener.
- The same flyback rule applies to every inductive load: solenoids, motors and contactor coils all need a diode (or another clamp) across them.
