</>EmbeddedInterview

What is a flyback diode and why is it needed?

EasyElectronics & Hardware Basics

Short answer: When current through an inductive load (relay coil, motor, solenoid) is switched off suddenly, the inductor's stored energy produces a large voltage spike (V = L × di/dt, often hundreds of volts) that can destroy the switching transistor or MCU pin. A flyback (freewheeling) diode across the load, reverse-biased in normal operation (cathode to the positive supply), gives the current a path to circulate and decay safely, clamping the spike to about one diode drop above the supply.

Trade-off: release time. A plain diode lets the current decay slowly, so a relay opens more slowly (and motors keep spinning). For faster release, add a Zener or TVS in series with the diode (clamps at a higher voltage, dissipating energy faster) while keeping the voltage below the transistor's rating.

Motors driven in both directions (H-bridges) have four freewheeling diodes (often the MOSFETs' body diodes, or synchronous rectification by switching on the opposite MOSFETs).

Choosing the diode: reverse voltage above the supply, current rating at least the load current (for the decay time), fast or Schottky types for PWM-driven loads.

Firmware symptom of a missing or failed diode: the MCU resets or a GPIO dies when a relay switches; noise on ADC readings at each motor commutation.