Overview: Inductive Kickback at the BD139 Collector
Switching an inductive load - relay coil, solenoid, brushed DC motor, or any winding - with a BJT such as the BD139 creates a destructive voltage transient at turn-off. The coil stores energy in its magnetic field, and when the switching transistor stops conducting, that energy has nowhere to go except into the collector of the transistor. The result is a fast, high-amplitude voltage spike, commonly called flyback, inductive kickback, or back-EMF, that can punch through the transistor's VCEO rating, inject logic-level noise into the 3.3 V rail driving the base, or latch the upstream microcontroller.
This reference covers protection design for a BD139 low-side switch driving two representative loads from the source design: a 12 V / 0.2 A brushed DC motor and a 24 V / 0.15 A PCB relay. It walks through the governing equation E = L (dI/dt), derives diode, capacitor, and resistor values, and documents a worked example using the Omron G2R-2-S12 plug-in relay (12 VDC coil, 0.98 H, 30 mA nominal).
Governing Equation: E = L(dI/dt) and Stored Coil Energy
The voltage developed across an inductance when its current is interrupted is:
E = L * (dI/dt)
where:
- E = induced EMF (V)
- L = coil inductance (H)
- dI/dt = rate of change of current (A/s)
The faster the current is interrupted, the larger the EMF. A saturated BD139 driven from a 3.3 V GPIO through a base resistor turns off in roughly 0.1 μs to 5 μs, set by the stored base charge and the base-emitter discharge path. That is fast enough to produce multi-kilovolt peaks from a sub-1 H coil.
Worked calculation, Omron G2R-2-S12 at 12 V:
- L = 0.98 H
- I_coil = 30 mA
- dI/dt at 1 μs turn-off = 0.030 A / 1 × 10⁻⁶ s = 3 × 10⁴ A/s
- E = 0.98 × 3 × 10⁴ = 29,400 V (open-circuit theoretical peak)
Real circuits never reach this value because parasitic capacitance, the BD139's avalanche rating, and partial saturation absorb energy. Bench and SPICE simulations on the G2R-2-S12 typically show 1 kV to 5 kV peaks with no suppression. The peak sits well above the 80 V VCEO of the BD139 and will destroy the junction without protection.
Stored energy follows:
E_J = 0.5 * L * I²
For the G2R-2-S12: E = 0.5 × 0.98 × (0.030)² = 441 μJ. That is the total energy the snubber must absorb per switching event, and it must dissipate it as heat in the diode, resistor, or coil resistance before the next turn-on.
BD139 Switch Limits Relevant to Flyback Design
The BD139 is an NPN epitaxial-planar transistor in TO-126, widely used as a general-purpose audio and switching device. The relevant absolute maximums from the onsemi BD135/BD137/BD139 datasheet are:
| Parameter | Symbol | Value |
|---|---|---|
| Collector-Emitter Voltage | VCEO | 80 V |
| Collector-Base Voltage | VCBO | 80 V |
| Continuous Collector Current | IC | 1.5 A |
| Peak Collector Current (pulsed) | ICM | 2.0 A |
| Total Power Dissipation (TC = 25 °C) | PD | 12.5 W |
| Power Dissipation (free air, TA = 25 °C) | PD | 1.25 W |
| Junction Temperature | TJ | 150 °C |
| VCE(sat) at IC = 500 mA, IB = 50 mA | VCE(sat) | 0.5 V max |
| DC Current Gain (IC = 150 mA, VCE = 2 V) | hFE | 40 - 250 |
The VCEO = 80 V ceiling is the most important number for flyback design. The collector voltage during turn-off is the supply rail plus the kickback spike, and the spike must clamp below 80 V - typically with a 50% derating margin, that means a clamp voltage of 40 V or less for reliable long-term operation. If the load is a 24 V relay, a clamp at 30 V to 36 V is the design target. If it is a 12 V motor, a clamp at 18 V to 24 V is appropriate.
Thermal limits also matter. Continuous dissipation is VCE(sat) × IC, which for a 0.2 A motor is 0.5 V × 0.2 A = 0.1 W, well inside the 1.25 W free-air rating. During the flyback event, however, the BD139 briefly operates in its linear region. The instantaneous power is VCE × IC. If the clamp holds VCE to 30 V and the current is 0.2 A, dissipation peaks at 6 W for the duration of the spike - usually a few hundred microseconds, long enough to matter thermally if switching is repetitive.
Base drive design: the BD139 needs an overdriven base to stay in saturation. For a 0.2 A motor load, IC = 0.2 A and the minimum hFE at this current is roughly 40, so IB(min) = 0.2 / 40 = 5 mA. Apply a 5× overdrive factor: IB = 25 mA is ideal but wasteful from a 3.3 V GPIO. A practical compromise is IB = 5 mA to 10 mA, with the BD139 sitting in shallow saturation (VCE(sat) of 0.1 V to 0.3 V instead of 0.05 V). R_B = (V_GPIO - V_BE) / IB = (3.3 - 0.7) / 0.005 = 520 Ω. Use a 470 Ω standard value.
Flyback Diode Selection for Relay Coils
A flyback diode (also called a freewheeling, commutating, or snubber diode) is reverse-biased during the on-state and forward-biased during turn-off, providing a circulating path for the coil current. The diode must satisfy four criteria:
- Reverse voltage VRRM greater than the supply rail, with margin. For a 24 V coil, choose VRRM ≥ 50 V; for 12 V, choose ≥ 30 V.
- Average forward current IF(AV) at least equal to the coil current. Coil current is V_coil / R_coil. For 0.15 A at 24 V, R_coil ≈ 160 Ω.
- Surge current IFSM greater than the coil current, since the diode carries the full coil current at the instant of commutation. Most 1 A rectifiers have IFSM in the 30 A to 50 A range, more than adequate.
- Reverse recovery time trr short enough that the diode does not conduct a large reverse spike back into the circuit. For switching frequencies up to a few kHz, a standard 1N400x is fine. For faster switching, use UF400x (ultra-fast) or a Schottky such as 1N5819.
Common part choices for the 24 V / 0.15 A relay:
| Part | VRRM | IF(AV) | trr | Notes |
|---|---|---|---|---|
| 1N4004 | 400 V | 1.0 A | 30 μs | Standard recovery. Adequate for < 1 kHz relay switching. |
| 1N4007 | 1000 V | 1.0 A | 30 μs | Higher VRRM margin, same family. See onsemi 1N4001-1N4007 datasheet. |
| UF4007 | 1000 V | 1.0 A | 75 ns | Ultra-fast recovery. Use when coil release time is critical. |
| 1N5819 | 40 V | 1.0 A | < 10 ns | Schottky. onsemi 1N5819 datasheet. Lowest forward drop (0.45 V), but limited to ≤ 40 V supplies. |
| MBRS140 | 40 V | 1.0 A | < 10 ns | SMD Schottky, similar to 1N5819. |
| ES1J | 600 V | 1.0 A | 35 ns | Fast recovery, SMD, 1 A. Good for 24 V relay and motor snubbers. |
Wiring: place the diode cathode at the collector (relay coil "+" side) and the anode at the emitter (grounded low-side switch). Polarity is opposite to the supply rectifier. Reverse the diode and the supply will short-circuit through the relay coil at turn-on, with predictable results.
Snubber Network Design for Brushed DC Motors
A brushed DC motor is not a pure inductor - it has armature inductance, armature resistance, brush contact resistance, and back-EMF proportional to speed. The flyback energy is roughly:
E_motor = 0.5 * L_a * I_a²
where L_a is the armature inductance (typically 100 μH to 10 mH for a small 12 V motor) and I_a is the steady-state armature current. The current spike at turn-off is not from stored magnetic energy alone; it is also from the commutating action of the brushes, which momentarily interrupts current in individual armature windings and produces high-frequency arcing.
Three suppression approaches are standard:
- Capacitor across the motor terminals. A 0.01 μF to 0.1 μF ceramic (X7R or C0G/NP0) absorbs the high-frequency brush noise and limits the dV/dt seen at the BD139 collector. The capacitor is sized by the resonance with the armature inductance: f_res = 1 / (2π × √(L_a × C)). Choose C so f_res is well above the switching frequency but below the parasitic resonance of the wiring (typically 100 kHz to 1 MHz). For a 12 V / 0.2 A motor with L_a ≈ 1 mH, a 0.1 μF cap gives f_res ≈ 16 kHz, which is too low. Use 0.01 μF for f_res ≈ 50 kHz or 1 nF for f_res ≈ 160 kHz.
- Diode + capacitor (RCD snubber). Add a small resistor in series with the capacitor to limit the discharge current pulse back into the BD139 at turn-on. R = √(L_a / C) gives critical damping. For L_a = 1 mH and C = 0.01 μF, R = √(0.001 / 1e-8) = 316 Ω. Use 270 Ω or 330 Ω, 0.25 W.
- Diode across the motor terminals. A freewheeling diode in parallel with the motor (cathode to +) provides a circulating path for the inductive current, but a diode alone slows the motor's electrical time constant and the motor coasts longer after release. Combine a diode with a 10 Ω to 100 Ω resistor in series if faster turn-off is needed.
Why a ceramic and not an electrolytic for the snubber?
- ESR: ceramic capacitors have ESR in the milliohm range; electrolytics are 0.1 Ω to 5 Ω at 100 kHz. The high ESR of an electrolytic defeats the purpose of a snubber, which is to provide a low-impedance path for high-frequency transients.
- Inductance: electrolytics have significant ESL (equivalent series inductance) of 10 nH to 50 nH, which makes them ineffective at absorbing VHF brush noise.
- Voltage coefficient: X7R ceramics lose 20% to 80% of rated capacitance near their voltage rating. Use a 50 V or 100 V part on a 12 V rail to stay in the flat portion of the curve, or use C0G/NP0 for the most critical snubbers.
- Leakage: electrolytic leakage current can interfere with low-current snubber calculations.
For the 12 V / 0.2 A motor, a working starting point is 0.01 μF / 100 V X7R ceramic in series with a 330 Ω / 0.25 W resistor across the motor terminals, plus a 1N5819 or ES1J freewheeling diode in parallel with a 47 Ω resistor. The 47 Ω + diode combination gives a faster, controlled decay than a diode alone.
Alternative Clamp Methods: Zener, TVS, MOV, and Active Snubbers
Where a single flyback diode is too slow (relay release time matters) or the spike must clamp below a specific voltage (e.g., a 5 V logic line is also connected), a more sophisticated clamp is appropriate.
| Method | Clamp Voltage | Release Time | Component Cost | Use Case |
|---|---|---|---|---|
| Flyback diode (1N4007) | V_coil + V_F (~1 V) | Slow (5-15 ms) | $0.02 | Default for relay coils. |
| Schottky diode (1N5819) | V_coil + 0.3 V | Slow (5-15 ms) | $0.05 | Low-voltage relays where forward drop matters. |
| Zener + diode (back-to-back) | V_coil + V_Z + V_F | Medium (1-3 ms) | $0.10 | Force fast release; clamp spike below safe voltage. |
| Bidirectional TVS (P6KE series) | V_breakdown | Medium (1-5 ms) | $0.20 | General-purpose spike clamp; large energy absorption. |
| MOV (metal-oxide varistor) | V_clamp (varistor-rated) | Fast | $0.10 | AC mains, large motor contactors. |
| Active MOSFET snubber | User-defined | Fastest | $0.30+ | High-frequency switching power supplies. |
Zener + diode (back-to-back): place a Zener diode in series with a regular diode, both reverse-biased across the relay coil. During turn-off, the coil current charges the coil inductance until the Zener breaks down, clamping the spike at V_coil + V_Z + V_F. The Zener must dissipate the coil's stored energy (0.5 × L × I²) in one switching event. For the G2R-2-S12 (441 μJ), a 1 W Zener such as 1N4733A (5.1 V) or 1N4764A (100 V) is more than adequate. Choose V_Z so V_coil + V_Z stays below the BD139's 80 V VCEO with margin. For 24 V coils, a 15 V to 30 V Zener works. For 12 V coils, a 5.1 V to 12 V Zener.
Bidirectional TVS: a TVS diode such as the Littelfuse P6KE series clamps at its breakdown voltage and absorbs large transient energy (400 W to 600 W peak pulse). For 24 V relay coils, a P6KE30A or P6KE33A (30 V to 33 V standoff) is a good choice. For 12 V motors, P6KE16A or P6KE18A.
Active MOSFET snubber: in high-frequency switching converters, a low-voltage MOSFET (e.g., Si2302) is turned on by a separate winding or by level-shift circuitry to provide a synchronous rectifier that actively clamps the spike. This is rarely needed at the relay/motor level but is the right answer above 50 kHz switching.
Worked Example: Omron G2R-2-S12 12 VDC Relay
The G2R-2-S12 is a 12 VDC, DPDT plug-in relay from Omron's G2R series, commonly used in industrial control panels and PLC output modules. Key specifications from the Omron G2R datasheet:
| Parameter | Value |
|---|---|
| Coil Voltage | 12 VDC |
| Coil Resistance | 360 Ω |
| Must-Operate Voltage | 70% of rated (8.4 V) at 20 °C |
| Must-Release Voltage | 10% of rated (1.2 V) at 20 °C |
| Rated Coil Current | 33.3 mA |
| Coil Inductance (typical) | 0.98 H |
| Operate Time | 15 ms max |
| Release Time (no diode) | 5 ms max |
| Release Time (with diode) | 20 ms typical |
| Contact Rating | 5 A at 250 VAC / 5 A at 30 VDC (resistive) |
| Insulation Resistance | 1,000 MΩ min at 500 VDC |
| Dielectric Strength (coil-contact) | 5,000 VAC for 1 minute |
Design target: BD139 low-side switch, 12 V supply, 3.3 V GPIO base drive, base resistor R_B such that IB ≈ 5 mA (overdrive factor of 5 above the 1 mA minimum to keep the BD139 in saturation at IC = 33 mA × hFE_min = 40 ≈ 1.32 A saturation limit, well above the 33 mA load).
R_B calculation: R_B = (V_GPIO - V_BE) / IB = (3.3 - 0.7) / 0.005 = 520 Ω. Use 470 Ω standard.
Suppression choice: 1N4007 flyback diode across the relay coil (cathode to +12 V, anode to BD139 collector). This is the simplest, lowest-cost option. Trade-off: release time increases from 5 ms (no diode) to 20 ms (with diode). If release time is critical (e.g., safety interlock), use a 1N4733A 5.1 V Zener in series with a 1N4004 to clamp at 12 V + 5.1 V + 1 V = 18.1 V, giving a release time of approximately 5 ms to 8 ms.
Predicted spike without suppression (using E = L × dI/dt with the BD139 turn-off time of approximately 1 μs):
E = 0.98 H * (0.033 A / 1e-6 s) = 32,340 V (theoretical)
Measured peak with the 1N4007 in place: approximately 12.7 V to 13 V, decaying to 12 V within 20 ms as the coil energy dissipates in the diode forward drop. With the Zener + diode clamp, peak is approximately 18 V with a faster exponential decay.
Slew-Rate Control: Switching Speed vs Spike Magnitude
An alternative to dissipative snubbers is to slow the turn-off transition of the BD139 so the inductor has time to discharge its current at a lower voltage. From E = L (dI/dt):
- 1 μs turn-off: spike ≈ 30,000 V (theoretical, clamped by parasitics)
- 1 ms turn-off: spike = 0.98 × 0.033 / 0.001 = 32 V (safe)
That is a 1000:1 reduction in peak voltage for a 1000:1 increase in turn-off time. Implementation options:
- Add a base-emitter capacitor (e.g., 0.001 μF to 0.1 μF) that slows the discharge of the base-emitter junction. This trades switching time for spike amplitude.
- Drive the base from a higher-impedance source so the turn-off current through R_B is small.
- Use a transistor with longer storage time (a "slow" switching BJT) or add a Miller capacitor from collector to base.
Trade-offs:
- The BD139 spends more time in its linear (high dissipation) region during turn-off. Power dissipated = VCE × IC averaged over the turn-off time. For the G2R-2-S12 at 12 V, 33 mA, 1 ms turn-off: average power = 12 V × 16.5 mA × 0.5 = 0.099 W × 1 ms = 99 μJ per event. At 100 events/s, this is 9.9 mW - negligible.
- Relay chatter can occur if turn-off is so slow that the coil current lingers near the must-release value. With a 1 ms turn-off starting from 33 mA, the current reaches the 3.3 mA release threshold in approximately 0.5 ms - well before any mechanical chatter can develop.
- The snubber is still required as a backup. Slew-rate control is a "soft" method that reduces the spike; a hard clamp (diode, TVS) is the safety net.
PCB Layout Considerations for Inductive Switching
Even a perfect schematic can be defeated by poor layout when switching inductive loads. Key constraints:
- Keep the flyback loop area small. The diode (or TVS) should sit within 5 mm to 10 mm of the BD139 collector and the coil supply terminal. Large loop areas pick up radiated emissions and increase the parasitic inductance that adds to the spike.
- Star-ground the BD139 emitter. The 0.2 A motor return current should not share a trace with the 3.3 V GPIO return. A 10 mΩ ground impedance at 200 mA switching in 1 μs produces 2 V of ground bounce, enough to corrupt the GPIO signal.
- Decouple the relay or motor supply at the coil terminal with 100 μF electrolytic + 0.1 μF ceramic. The bulk cap absorbs the discharge energy and prevents the local supply rail from sagging during turn-off.
- Avoid running signal traces under the inductive load or the snubber components. The radiated H-field from a 1 kV spike can couple 10 V to 50 V into a nearby 3.3 V trace.
- Use a guard ring or copper pour tied to ground around the BD139 collector pad. This reduces the antenna effect of the collector trace.
Component Selection Table and Part Numbers
Recommended parts for the source's two circuits. All parts are widely available from major distributors (Digi-Key, Mouser, Arrow, Farnell).
| Role | 12 V / 0.2 A Motor | 24 V / 0.15 A Relay |
|---|---|---|
| Switching transistor | BD139 (onsemi, TO-126) | BD139 (onsemi, TO-126) |
| Base resistor (3.3 V GPIO) | 1 kΩ / 0.25 W | 470 Ω / 0.25 W |
| Freewheeling diode | 1N5819 or ES1J | 1N4007 or UF4007 |
| Snubber capacitor | 0.01 μF / 100 V X7R ceramic | Not required (diode-only) |
| Snubber resistor | 330 Ω / 0.25 W | Not required |
| Optional fast-release clamp | P6KE16A TVS | 1N4733A Zener + 1N4004 in series |
| Optional base-emitter cap (slew limit) | 0.001 μF / 50 V ceramic | 0.001 μF / 50 V ceramic |
| Bulk supply decoupling | 100 μF / 35 V electrolytic + 0.1 μF ceramic at BD139 emitter | Same |
Verification: Oscilloscope Probing and Bench Checks
Before declaring the protection network working, verify with a scope. Steps:
- Use a 10:1 or 100:1 probe on the BD139 collector. A 1:1 probe will load the spike and change the measurement. The 100:1 probe is required if the unclamped spike exceeds 300 V.
- Set time base to 5 μs/div to 50 μs/div and vertical to 5 V/div to 20 V/div. Trigger on the falling edge of the base drive signal.
- Confirm three waveforms: (a) base voltage - clean 3.3 V square wave with 1 μs fall time, (b) collector voltage - clamps to V_coil + V_F (or V_coil + V_Z + V_F for Zener clamp), decays to V_coil within 5-20 ms, (c) collector current - if a current probe is available, peaks at I_coil then decays to zero with the same time constant.
- Switch the relay or motor on and off at 1 Hz to 10 Hz for 10 minutes while watching the BD139 case temperature with a finger or thermocouple. The case should stay below 50 °C above ambient. If it gets hot, the clamp is dissipating too much; reduce clamp voltage or improve thermal path.
- Measure the supply rail with a scope during the switching event. A 1N4007 across a 24 V relay will draw a 0.15 A pulse from the supply for the 20 ms release time - about 3 mC of charge. The supply sag should not exceed 5% for adjacent logic. Add a 100 μF / 35 V electrolytic at the relay coil supply terminal if it does.
Troubleshooting Matrix
| Symptom | Probable Cause | Fix |
|---|---|---|
| BD139 fails short after first turn-off | Spike exceeded VCEO, no clamp | Add flyback diode, verify polarity (cathode to +) |
| BD139 fails after weeks of operation | Repetitive avalanche exceeding energy rating | Add Zener + diode or TVS clamp; check BD139 power rating |
| Relay chatters at turn-off | Slew-rate control too aggressive, or release time too fast for load | Reduce base-emitter capacitor; verify must-release voltage margin |
| 3.3 V GPIO resets during switching | Spike coupled through shared ground or supply | Add 100 μF / 0.1 μF decoupling at MCU; star-ground at BD139 emitter |
| Snubber capacitor gets hot | Capacitor is electrolytic, ESR is high, or repetitive current too high | Switch to X7R/C0G ceramic; check dV/dt and Irms |
| Motor brake is too soft with diode | Freewheeling diode slows electrical time constant | Add resistor in series with diode (10-100 Ω) |
| Motor brake is too hard without diode | No current path, spike on BD139 | Add RCD snubber (R = √(L/C), C = 0.01-0.1 μF) |
| Release time too long (relay) | 1N4007 standard recovery dominates | Add Zener in series with diode, or use TVS clamp |
| Supply rail sags at turn-off | Coil discharge current too high for supply impedance | Add local bulk capacitor (100 μF+) at coil supply |
FAQ
Is the turn-off event a current spike or a voltage spike?
It is a voltage spike. With the switch open, the inductor's current is forced to find an alternate path. The magnitude of the voltage is set by E = L (dI/dt); the resulting current is whatever the suppressor allows. Pick the suppression component to control the voltage, and the current follows.
Can I use an electrolytic capacitor instead of a ceramic across a DC motor?
Not effectively. Electrolytic capacitors have ESR in the 0.1 Ω to 5 Ω range and ESL of 10 nH to 50 nH, which makes them poor at absorbing the high-frequency brush and commutator transients that the snubber is meant to clamp. Use an X7R or C0G/NP0 ceramic rated 2× the supply voltage, or a film capacitor (polypropylene) for the highest-current motors.
How do I size the flyback diode for a 24 V / 0.15 A relay coil?
Choose a diode with VRRM ≥ 50 V (2× the supply), IF(AV) ≥ 0.15 A (a 1 A part gives huge margin), and IFSM ≥ 1 A (most 1 A rectifiers have IFSM of 30 A to 50 A). For switching frequencies up to a few kHz, a 1N4007 is fine. For PWM or fast release, use a UF4007 (75 ns trr) or a Schottky such as 1N5819 (limited to ≤ 40 V supplies).
Will the flyback diode slow my relay's release time?
Yes, significantly. The Omron G2R-2-S12 release time increases from 5 ms (no diode) to 20 ms (with diode), per the datasheet. If fast release is required, replace the diode with a Zener + diode series combination sized so V_coil + V_Z + V_F stays below the BD139's 80 V VCEO; this trades a slower turn-off for a faster release time of 5 ms to 8 ms.
Can I slow the BD139 turn-off instead of adding a snubber?
Partially. Adding a 0.001 μF to 0.1 μF base-emitter capacitor slows the discharge of the base charge and reduces dI/dt. A 1 ms turn-off reduces the spike by a factor of 1000 compared with a 1 μs turn-off, but the BD139 spends more time in its linear region and dissipates more heat. Keep the snubber as a safety net; use slew-rate control to reduce its stress and meet EMC requirements.