When you need to switch an inductive load like a relay coil, solenoid, or DC motor with a transistor, the most critical diode circuit diagram you will build is the flyback (or freewheeling) diode configuration. The direct answer for 90% of hobbyist and industrial 5V-12V DC relay applications is this: place a standard 1N4148 or 1N4007 silicon diode in parallel with the coil, with the cathode (stripe) pointing toward the positive supply and the anode connected to the switching transistor's drain or collector.
Without this diode, the collapsing magnetic field generates a massive voltage spike ($V = -L \frac{di}{dt}$) that will instantly avalanche and destroy your switching MOSFET or BJT. This guide breaks down the exact topology, component sizing, failure modes, and bench-testing procedures for designing a robust flyback protection circuit.
Topology and Node Mapping
A flyback diode circuit relies on a specific parallel topology to create a localized recirculation loop for the inductive current when the main power path is interrupted. Let's map the nodes using a standard 12V DC relay (like the Omron G5LE-14-DC12) driven by an N-channel MOSFET (like the 2N7000).
- Node A (VCC): 12V DC Supply. Connects to Relay Coil Pin 1 and Diode Cathode (Stripe).
- Node B (Switched Low): Relay Coil Pin 2, Diode Anode, and MOSFET Drain. This is the switch node.
- Node C (Gate Drive): MOSFET Gate. Driven by your microcontroller GPIO (via a 100Ω gate resistor).
- Node D (GND): MOSFET Source and System Ground.
When the MOSFET turns on, Node B is pulled to ground. The diode is reverse-biased (12V at cathode, 0V at anode) and blocks current, allowing the full 12V to energize the coil. When the MOSFET turns off, the coil's inductance forces current to keep flowing in the same direction. Node B's voltage spikes upward until the diode becomes forward-biased (around 0.7V above VCC). The current circulates through the coil and the diode, dissipating the stored magnetic energy as heat safely.
Component Selection and Behavior Matrix
Selecting the right diode requires looking at the coil's steady-state current and the switching frequency. Below is a data-dense matrix of common diodes used in flyback circuits, detailing their real-world limits.
| Diode Model | Type | Max $V_R$ (PIV) | Max $I_F$ (Continuous) | Reverse Recovery ($t_{rr}$) | Best Application |
|---|---|---|---|---|---|
| 1N4148 | Signal (PN) | 100V | 300mA | 4 ns | Standard 5V/12V relays (<150mA coil), fast PWM |
| 1N4007 | Rectifier (PN) | 1000V | 1.0A | 30 µs | Heavy contactors, solenoids, high-voltage margins |
| 1N5819 | Schottky | 40V | 1.0A | N/A (Majority carrier) | Low-voltage (<24V) systems where $V_F$ drop matters |
| 1N4742A + 1N4148 | Zener + PN Series | 12V Zener + 100V | ~76mA (Zener limit) | Fast decay | High-speed switching where relay must drop out instantly |
For a standard Omron G5LE-14-DC12 relay, the coil resistance is 360Ω, drawing exactly 33.3mA at 12V. The 1N4148 is the optimal choice here: its 300mA continuous rating provides a 9x safety margin over the 33.3mA coil current, and its 100V PIV easily survives the 12V supply. Using a bulky 1N4007 is acceptable but unnecessary, and its slower 30µs reverse recovery time can cause issues if you are PWM-switching the relay at high frequencies.
Circuit Behavior Under Parameter Shifts
Inductive loads are not static. Here is how the circuit behaves when environmental or component parameters change:
| Parameter Change | Physical Effect on Circuit | Required Design Adjustment |
|---|---|---|
| Coil heats up (Resistance drops 10%) | Steady-state coil current increases; more magnetic energy stored. | Ensure diode $I_F$ rating and MOSFET $I_D$ rating have >20% thermal derating margin. |
| VCC spikes to 24V (Automotive load dump) | Diode reverse bias increases; clamp voltage during turn-off rises. | Upgrade from 1N4148 (100V) to 1N4007 (1000V) to prevent PIV breakdown. |
| Switching frequency increases to 1kHz | Diode must recover before next turn-on; $t_{rr}$ losses generate heat. | Switch to a fast-recovery diode (UF4007) or Schottky (1N5819) to eliminate $t_{rr}$ losses. |
Why a Standard PN Diode Over Alternatives?
Makers often ask why we don't just use a Zener diode, an RC snubber, or a TVS diode across the coil. The choice depends entirely on release time versus component cost.
- Standard PN Diode (The Baseline): Clamps the flyback voltage to roughly $V_{CC} + 0.7V$. Because the voltage across the coil is low, the current decays slowly ($di/dt = V/L$). This keeps the relay armature pulled in slightly longer after the MOSFET turns off. It is cheap, reliable, and perfectly fine for human-scale switching (pushing a button to turn on a motor).
- Zener Diode in Series with PN (Fast Decay): If you place a 12V Zener diode in series with a standard 1N4148 (cathode-to-cathode), the flyback voltage is clamped to $V_{CC} + 12V + 0.7V$. The higher reverse voltage forces the coil current to collapse much faster. Use this topology when driving relays with high-frequency PWM or when precise drop-out timing is critical. See SparkFun's relay guide for more on relay timing mechanics.
- RC Snubber: A resistor and capacitor in series. Used primarily across the relay contacts (the load side) to suppress arcing when switching AC loads, not across the coil for transistor protection.
Extreme Failure Modes: What Breaks When?
Understanding how a diode circuit diagram fails is just as important as knowing how it works. Here is the failure-mode contrast for the flyback topology.
- The Diode is Open (or missing): When the MOSFET turns off, the inductive spike has nowhere to go. Node B voltage rockets upward until it exceeds the MOSFET's $V_{DS(max)}$ (e.g., 60V for a 2N7000). The MOSFET enters avalanche breakdown, overheats, and fails short-circuit. Your microcontroller pin may also blow if the gate-drain capacitance couples the spike back to the gate.
- The Diode is Shorted: The diode acts as a wire. When the MOSFET turns on, it pulls Node B to ground, creating a direct short from VCC through the relay coil and the shorted diode to ground. The coil draws massive current, the MOSFET exceeds its $I_D$ limit and melts, or the PCB trace vaporizes.
- The Diode is Reversed (Anode to VCC, Cathode to Drain): This is the most common breadboard mistake. When the MOSFET turns on, the diode becomes forward-biased. VCC flows directly through the diode and the MOSFET to ground, bypassing the relay coil entirely. The diode will likely explode from overcurrent, and the MOSFET will be destroyed.
Step-by-Step Breadboard Verification
Before applying power to a newly wired flyback diode circuit, follow this bench-testing sequence to verify the topology and prevent silicon death. For a deeper theoretical background on semiconductor junctions, refer to the All About Circuits diode textbook chapter.
Phase 1: Cold Checks (Power Off)
- Verify Coil Resistance: Set your multimeter to resistance mode. Measure across the relay coil pins. For a 12V G5LE, you should read ~360Ω. If it reads infinite, the coil is internally open.
- Verify Diode Orientation and Health: Set the DMM to Diode Test mode. Place the red probe on the diode anode (Node B) and black on the cathode (Node A/VCC). You should read a forward voltage drop of 0.5V to 0.7V. Reverse the probes; the meter should read "OL" (Open Loop). If it reads 0.0V or beeps in both directions, the diode is shorted.
- Check for Solder Bridges: Verify continuity between Node B (Drain) and Node D (GND). It should read open. If it beeps, your MOSFET is already dead or you have a breadboard short.
Phase 2: Live Scope Verification
- Probe the Switch Node: Connect your oscilloscope ground clip to Node D (GND) and the probe tip to Node B (MOSFET Drain). Never probe the high-side VCC node for this test, as you want to see the clamp action at the switch node.
- Trigger on Falling Edge: Set the scope to single-trigger mode, triggered on the rising edge at Node B (which happens when the MOSFET turns off).
- Fire the Circuit: Send a 5V logic HIGH to the MOSFET gate, wait 100ms, then pull it LOW.
- Analyze the Clamp: The scope should show Node B sitting at 0V while the relay is on. When the gate drops to 0V, Node B should spike up to exactly 12.7V (12V VCC + 0.7V diode drop) and then decay exponentially back to 12V as the magnetic field collapses. If you see a spike exceeding 15V, your diode is not clamping properly, or your scope probe ground lead inductance is ringing (use a coaxial tip adapter for accurate high-speed measurements).
By treating the flyback diode not as an afterthought, but as a precision clamping circuit, you ensure your switching transistors survive the harsh physics of inductive loads. Always match the diode's $I_F$ and PIV ratings to the worst-case thermal and transient realities of your specific relay coil.






