Skip to content
Electronics 21 min read

How Does an H-Bridge Work? Decay, Dead Time, Losses

Observation recorded
Cinematic poster of a Mars rover's aluminium wheel and suspension resting on red dusty ground, with the title "Inside The H-Bridge" in large condensed type and the line "Decay, dead time, losses.".

Wire a 12 V motor to the red L298N board every robotics kit ships with, run it at 1 A, and put a meter across the motor terminals. The datasheet says you should read somewhere between 8.8 V and 10.2 V. The missing volts become about 2.5 W of heat in a chip that has to sit under a finned heatsink to survive. A MOSFET driver doing the same job loses about half a volt.

Most explanations of the H-bridge stop at the truth table: four switches, close the diagonals to go forward or back, never close both switches on one side. That is correct and it is the easy part. What the switch diagrams leave out is what the motor's inductance does every time a switch opens, which is where shoot-through, dead time, the real difference between braking and coasting, and the strange speed curves you get from PWM all come from.

Quick answerAn H-bridge is four switches with the motor across the middle. Turning on one high-side and the opposite low-side switch drives current one way; the other diagonal reverses it. Both low sides on brakes the motor; all off lets it coast. Dead time stops a leg's two switches conducting together, which would short the supply.
Infographic: How does an H-bridge work? A schematic shows four switches around a motor, with the forward current path through Q1, the motor and Q4 highlighted. Driving a 12 V motor at 1 A, an L298 loses 2.55 V inside the bridge, about 2.6 W of heat, while a DRV8871 MOSFET bridge loses 0.57 V. Closing both switches on one side would pull about 21 A, which 220 ns of dead time prevents. A bar chart compares bridge drops, from 4.9 V for an L298 at 2 A to 0.57 V for the DRV8871. Tiles: a 100 ns overlap wastes 1.0 W; dead time costs 7 mW. Myth: coasting still pushes current back into the supply.
Tap the image to view it full size. View the accessible, editable SVG.

How does an H-bridge reverse a motor?

Figure 1 shows the circuit. Each side of the motor connects to a half-bridge: a high-side switch to the supply and a low-side switch to ground. Q1 and Q2 form the left leg, driving terminal OUT1; Q3 and Q4 form the right leg, driving OUT2. Draw it and it looks like a letter H with the motor as the crossbar.

H-bridge schematic. A 12 volt supply rail at the top and ground at the bottom. Left leg: N-channel MOSFET Q1 from the rail to OUT1 and Q2 from OUT1 to ground. Right leg: Q3 from the rail to OUT2 and Q4 from OUT2 to ground. Each MOSFET has a body diode drawn beside it, anode at source and cathode at drain. A motor M connects OUT1 and OUT2. The forward path through Q1, the motor and Q4 is highlighted in blue. A note warns that Q1 with Q2, or Q3 with Q4, must never be on together.
Figure 1. A full H-bridge built from four N-channel MOSFETs. Forward drive is Q1 + Q4 (blue); reverse is Q3 + Q2. Each MOSFET's body diode is drawn beside it because it carries current whenever the switches are off.

Turn on Q1 and Q4 and OUT1 sits at the supply while OUT2 sits at ground: current flows left to right through the motor and it turns one way. Turn on Q3 and Q2 instead and the voltage across the motor flips sign, the current reverses, and so does the torque. Integrated drivers hide this behind two logic pins. TI's DRV8871, for example, uses IN1 = 1, IN2 = 0 for forward (current OUT1 to OUT2), the reverse for reverse, 1 and 1 for brake, and 0 and 0 for coast.

The switches are almost always transistors. Old and cheap drivers such as the L298 use bipolar transistors; modern ones use MOSFETs. For a discrete bridge, the low-side switches are just low-side switches, driven like the ones in our posts on sizing a transistor base resistor and choosing a MOSFET gate resistor. The high-side switches are harder. An N-channel MOSFET between the supply and OUT1 needs its gate several volts above its source, and when it is on, its source is at the supply. So the gate has to go above the supply rail, which is why bridge driver chips contain a charge pump or bootstrap capacitor.

What is shoot-through, and why does dead time fix it?

Turn on Q1 and Q2 together and you have connected the supply to ground through two on-resistances and nothing else. Every forum warns about this, but it is worth putting a number on it because it explains why nobody ever does it on purpose and why it still happens by accident.

DRV8871 on-resistance, high side + low side: 565 mΩ typical. Shoot-through current at 12 V:

I=12 V/0.565 Ω≈21 AI = 12\ \mathrm{V}/0.565\ \Omega \approx \mathbf{21\ A}

That is limited only by the supply and wiring. The normal rated peak output is 3.6 A.

The accidental version happens at every switching edge. Transistors do not switch instantly. If the controller turns Q2 on at the same moment it turns Q1 off, there is a short window where Q1 is still partly on and Q2 is already partly on. TI's application note on decay modes puts it bluntly: "there will be a short period of time in which all four FET switches will conduct. This is extremely hazardous to the device." Suppose each overlap lasted only 100 ns at 21 A. At 20 kHz PWM, with two edges per period:

E≈12×21×100 ns=25 μJP=25 μJ×2×20 000=1.0 W\begin{aligned}E &\approx 12 \times 21 \times 100\ \mathrm{ns} = 25\ \mu\mathrm{J} \\ P &= 25\ \mu\mathrm{J} \times 2 \times 20\,000 = \mathbf{1.0\ W}\end{aligned}

That is pure waste at 20 kHz with two edges per period (our illustration, for a hypothetical 100 ns overlap).

A watt of heat with no useful output, in a chip that is supposed to dissipate half a watt in total. The fix is dead time: a short pause in which both switches of a leg are off before the other one turns on. The DRV8871 inserts 220 ns automatically. During that pause the motor current, which cannot stop instantly because of the winding inductance, flows through a body diode. The datasheet says exactly where: if current is leaving the pin, the output sits "a diode drop below ground", and if it is entering, a diode drop above the supply. That costs a little:

Dead-time conduction loss at 1 A, 20 kHz, through a 0.8 V body diode:

P=0.8×1×220 ns×2×20 000=7 mWδduty=220 ns/50 μs=0.44%\begin{aligned}P &= 0.8 \times 1 \times 220\ \mathrm{ns} \\ &\quad \times 2 \times 20\,000 = \mathbf{7\ mW} \\ \delta_{\mathrm{duty}} &= 220\ \mathrm{ns}/50\ \mu\mathrm{s} = 0.44\%\end{aligned}

The duty error is per edge, as a share of the period.

Seven milliwatts is the price of not burning a watt. If you build a bridge from discrete MOSFETs and drive the gates from a microcontroller, you have to create this dead time yourself, either in the PWM peripheral (many motor-control timers have a dead-time register) or with a gate driver chip that enforces it.

What is the difference between braking and coasting?

Here is where page-one explanations usually go wrong. They say "short the motor to brake; open the switches and no current flows, so it coasts", which is true for what the motor does over the next second, and misleading about what happens in the next microsecond. Figure 2 shows the three states the bridge actually spends its time in when it runs a motor forward.

Three simplified H-bridges side by side, each with a battery, four switches, four diodes and a motor. Drive, blue: top-left and bottom-right switches closed, current flows from the battery through the top-left switch, the motor and the bottom-right switch. Slow decay or brake, green: both bottom switches closed, the motor current circulates through the motor and the two bottom switches. Fast decay or coast, orange: all switches open, current flows from ground up through the bottom-left diode, through the motor, up through the top-right diode and back into the battery's positive terminal.
Figure 2. Where the motor current goes in each state. In fast decay the inductor pushes current backwards into the supply through two diodes, so the motor briefly sees the full supply voltage reversed.

Brake, or slow decay (both low-side switches on). The motor terminals are shorted together through two on-resistances. Any current already flowing keeps circulating around the bottom of the bridge (green loop), decaying only as fast as the winding resistance lets it. TI notes it decays with the L/R time constant, where R includes two low-side on-resistances. If the motor is spinning, its back-EMF now drives current through that short, and the current produces torque opposing the rotation. The TI note describes it as a short that "collapses the back EMF" and gives "a very quick rotor stop". How hard? For the model motor used in this post's figures (2 Ω, 0.5 mH, spinning at 9,100 rpm with 9.5 V of back-EMF):

Brake current at full speed, and running current at the same speed:

I=ERmotor+2RDS(on),LS=9.52 V(2+2×0.29) Ω=3.7 AIrun=0.96 A\begin{aligned}I &= \frac{E}{R_{\mathrm{motor}} + 2R_{DS(on),LS}} \\ &= \frac{9.52\ \mathrm{V}}{(2 + 2 \times 0.29)\ \Omega} = \mathbf{3.7\ A} \\ I_{\mathrm{run}} &= 0.96\ \mathrm{A}\end{aligned}

Braking current is almost 4× the running current, and right at the DRV8871's 3.6 A peak rating.

So braking a large motor from full speed can stress the bridge harder than driving it. The kinetic energy ends up as heat in the motor winding and the two low-side switches.

Coast, or fast decay (all switches off). With every switch open you might expect the current to just stop. It cannot: the motor winding is an inductor, and an inductor's current cannot change instantly. The voltage rises until something conducts, and the somethings are the body diodes of Q2 and Q3 (orange loop). Current flows up from ground through Q2's diode, through the motor, and through Q3's diode into the supply rail. The motor now has the whole supply voltage plus two diode drops across it, in the direction that opposes the current, which is why the current collapses quickly. TI: "a voltage of greater magnitude but opposing polarity is applied to the inductive load."

Fast decay rate at 0.79 A, back-EMF 5.57 V (model motor):

dIdt=−VS+2VD+E+IRL=−12+1.6+5.57+1.60.5 mH≈−42 A/mst≈0.79/42 A/ms≈19 μs\begin{aligned}\frac{dI}{dt} &= -\frac{V_S + 2V_D + E + IR}{L} \\ &= -\frac{12 + 1.6 + 5.57 + 1.6}{0.5\ \mathrm{mH}} \\ &\approx -42\ \mathrm{A/ms} \\ t &\approx 0.79/42\ \mathrm{A/ms} \approx \mathbf{19\ \mu s}\end{aligned}

Slow decay from the same point:

dIdt=−E+I(R+2RDS)L≈−15 A/ms\frac{dI}{dt} = -\frac{E + I(R + 2R_{DS})}{L} \approx -15\ \mathrm{A/ms}

And the current would settle at a negative (braking) value instead of zero.

Once the current reaches zero the diodes stop conducting, the motor terminals float, and the rotor really does coast, with nothing but friction slowing it. So "coast" is accurate on a human timescale, but for the first tens of microseconds it is the most violent of the three states, and the energy stored in the winding goes back into the supply. With a battery that is harmless. With a bench supply or a regulator that cannot sink current, it pumps up the supply rail, which is one reason motor drivers want a large bulk capacitor right at the bridge as well as the usual 100 nF decoupling.

The L298 makes this point the hard way: it has no body diodes, because bipolar transistors do not have them. ST's datasheet requires an external bridge of four fast-recovery diodes (trr ≤ 200 ns) whenever it drives an inductive load, the same job a flyback diode across a relay coil does. Leave them out and the coil's turn-off voltage has nowhere to go but through the transistors.

How does PWM speed control interact with decay mode?

Speed control means switching between drive and one of the decay states tens of thousands of times a second. Each half of a leg is then doing the same job as the switch and diode in a buck converter, with the motor winding as the inductor; our buck converter post uses the same volt-second reasoning. Which decay state you pick for the off-time matters a lot more than most tutorials admit.

Figure 3 simulates the current in our model motor over three PWM periods at 60% duty and 20 kHz, holding the back-EMF constant (the rotor cannot change speed in 150 µs).

Motor current over 150 microseconds, three PWM periods at 60 percent duty and 20 kilohertz. The green slow-decay current is a triangle wave between 0.50 and 0.79 amps, averaging 0.64 amps. The orange fast-decay current ramps from zero to 0.36 amps during each drive interval, falls back to zero within about 9 microseconds of the switches opening, and stays at zero until the next period, averaging 0.14 amps.
Figure 3. Same duty cycle, same motor, same speed: drive/brake PWM keeps a continuous current averaging 0.64 A, while drive/coast PWM lets the current crash to zero in every period and averages only 0.14 A. Our simulation.

With slow decay, the motor current never stops. Over a period the motor sees the supply for a fraction D of the time and a near short for the rest, so the average voltage is D VSD\,V_S. The ripple follows from the inductor equation:

Slow decay ripple (peak to peak):

ΔI≈VS D(1−D)Lf\Delta I \approx \frac{V_S\,D(1 - D)}{L f}
D=0.6: 12×0.6×0.40.5 mH×20 kHz=0.29 AD=0.5: 124×0.5 mH×20 kHz=0.30 A\begin{aligned}D = 0.6&:\ \frac{12 \times 0.6 \times 0.4}{0.5\,\mathrm{mH} \times 20\,\mathrm{kHz}} = \mathbf{0.29\ A} \\ D = 0.5&:\ \frac{12}{4 \times 0.5\,\mathrm{mH} \times 20\,\mathrm{kHz}} = 0.30\ \mathrm{A}\end{aligned}

The simulation agrees: 0.50 to 0.79 A, 0.29 A. D = 0.5 is the worst case. At f = 1 kHz the same formula gives 6 A, larger than the average current, so the current goes discontinuous.

With fast decay, the off-time applies the supply in reverse, so the current falls about as fast as it rose, hits zero and stops there (the diodes will not pass reverse current). Even if it stayed continuous, the ripple formula gains a factor of two, because the off-time voltage is −VS instead of zero. In practice the current becomes a string of separate pulses whose size depends on the back-EMF, the inductance and the PWM frequency.

That has a visible consequence: the speed you get for a given duty cycle. Figure 4 solves for the steady speed of the model motor against a simple friction-plus-viscous load at every duty cycle.

Steady motor speed in rpm against PWM duty cycle from 0 to 100 percent. The green slow-decay curve is a straight line from 0 to 9,100 rpm, and its 1 kilohertz and 20 kilohertz versions overlap. The purple fast-decay curve at 1 kilohertz is zero below 10 percent, then rises steeply to about 7,000 rpm at 60 percent and flattens. The orange fast-decay curve at 20 kilohertz stays at zero below 40 percent and then rises steeply to meet the others at 100 percent.
Figure 4. Speed against duty for the same motor. Drive/brake PWM gives speed almost proportional to duty and is the same at 1 kHz and 20 kHz. Drive/coast PWM gives a different nonlinear curve at each frequency; at 20 kHz the motor does not even start below 40% duty. Our simulation.

This is the practical upshot. If you drive an L298N board with PWM on the enable pin, the bridge turns all its transistors off in the off-time: that is drive/coast, fast decay. The speed then depends on the PWM frequency as much as on the duty cycle, and raising the frequency to get rid of motor whine can leave the motor stalled at duty cycles that used to work. PWM on an input pin with the enable held high gives drive/brake instead, which is what the DRV8871 datasheet recommends. The DRV8871 datasheet says "it typically works best to switch between driving and braking."

Source note The motor in Figures 3 and 4 is a model, not a specific product: 2 Ω winding, 0.5 mH, back-EMF constant 0.01 V·s/rad, load torque 2 mN·m plus 8 µN·m per rad/s, and 0.29 Ω per switch. These are plausible values for a small brushed motor that I chose for illustration and did not take from a datasheet. The shapes of the curves (linear for slow decay, frequency-dependent and nonlinear for fast decay) are general; the exact duty cycle at which a real motor stalls is not.

Why does an L298 lose so many volts?

Because each current path goes through two bipolar transistors in saturation, and bipolar transistors at amp-level currents do not saturate cleanly. ST's L298 datasheet (Tj = 25 °C) specifies:

VCE(sat) in volts (min, typ, max):

source, 1 A: 0.95, 1.35, 1.7source, 2 A: –, 2.0, 2.7sink, 1 A: 0.85, 1.2, 1.6sink, 2 A: –, 1.7, 2.3\begin{aligned}\text{source, 1 A}&:\ 0.95,\ 1.35,\ 1.7 \\ \text{source, 2 A}&:\ \text{–},\ 2.0,\ 2.7 \\ \text{sink, 1 A}&:\ 0.85,\ 1.2,\ 1.6 \\ \text{sink, 2 A}&:\ \text{–},\ 1.7,\ 2.3\end{aligned}

Source is the high side, sink the low side. Total drop: 1.80 V min to 3.2 V max at 1 A, and 4.9 V max at 2 A.

Adding the typical source and sink figures gives about 2.55 V at 1 A and 3.7 V at 2 A. Compare a MOSFET bridge, whose loss is a resistance:

Voltage lost across the bridge against motor current from 0 to 2 amps. L298 points: 2.55 volts typical and 3.2 volts maximum at 1 amp, 3.7 volts typical and 4.9 volts maximum at 2 amps, minimum 1.8 volts at 1 amp. DRV8871 MOSFET bridge: straight lines rising to 1.13 volts typical and 1.36 volts maximum at 2 amps. A box notes that at 1 amp from 12 volts the L298 dissipates 2.6 watts and the motor gets 9.45 volts, while the DRV8871 dissipates 0.57 watts and the motor gets 11.4 volts.
Figure 5. Voltage lost in the bridge. L298 values are datasheet saturation voltages (typical totals are our sum of the source and sink typicals); DRV8871 values are its HS + LS on-resistance times current.

12 V motor at 1 A

L298 typ: 2.55→9.45 V, 2.6 WL298 max: 3.2→8.8 V, 3.2 WDRV typ: 0.57→11.4 V, 0.57 WDRV max: 0.68 V, 0.68 W\begin{aligned}\text{L298 typ}&:\ 2.55 \to 9.45\ \mathrm{V},\ \mathbf{2.6\ W} \\ \text{L298 max}&:\ 3.2 \to 8.8\ \mathrm{V},\ 3.2\ \mathrm{W} \\ \text{DRV typ}&:\ 0.57 \to 11.4\ \mathrm{V},\ \mathbf{0.57\ W} \\ \text{DRV max}&:\ 0.68\ \mathrm{V},\ 0.68\ \mathrm{W}\end{aligned}

Each row is the bridge drop, the voltage the motor gets, and the bridge heat (DRV is the DRV8871). The DRV8871 drop is 0.565 Ω × 1 A typical, and 360 + 320 mΩ at maximum.

At 2 A, L298 worst case:

P=4.9 V×2 A=9.8 WΔT=9.8×35 ∘C/W=343 ∘C\begin{aligned}P &= 4.9\ \mathrm{V} \times 2\ \mathrm{A} = 9.8\ \mathrm{W} \\ \Delta T &= 9.8 \times 35\ ^\circ\mathrm{C/W} = 343\ ^\circ\mathrm{C}\end{aligned}

That is per bridge, with no heatsink (35 °C/W junction to ambient). It needs the heatsink.

On a 12 V supply, the L298 throws away a fifth to a quarter of your voltage before the motor sees any of it, and on a 5 V or 6 V supply it can eat half. That is the real reason robot kits with L298N boards feel sluggish on small batteries. The heat side of the calculation is the same thermal-resistance chain as in our heatsink sizing post: 2.6 W into the L298's Multiwatt power package is manageable with a heatsink, 9.8 W needs a serious one. For a battery-powered robot the lost volts are also lost run time, and a pack's current rating (see LiPo C rating explained) does not help if a quarter of the energy warms the driver.

The L298 still has honest uses: it tolerates up to 46 V, it is forgiving, and its sense pins make simple current control easy. But for anything below about 2 A on a modest supply, a MOSFET driver wins on every number in the box above. The same logic applies to stepper drivers, which are two H-bridges with current regulation; our A4988 Vref calculation post covers how they choose between the decay modes on the fly.

A checklist for using an H-bridge

Before you power it up: confirm the driver has dead time (built in, or set in your PWM timer). Give the inductive current a path: body diodes in MOSFET bridges, four external fast diodes for an L298. Put a bulk capacitor at the bridge's supply pins for regenerated current. Use drive/brake PWM if you want speed roughly proportional to duty. Check the braking current, E/(Rmotor+2RDS)E/(R_{\mathrm{motor}} + 2R_{DS}), against the driver's peak rating. Budget the bridge's voltage drop: 2 to 5 V for an L298, I × RDS(on) for a MOSFET bridge.

FAQ

How does an H-bridge reverse a motor?

An H-bridge has two half-bridges, one on each motor terminal. Turning on the top-left and bottom-right switches puts the supply across the motor one way; turning on the top-right and bottom-left puts it across the other way, so the current and the direction of rotation reverse.

What is shoot-through in an H-bridge?

Shoot-through is when the high-side and low-side switch on the same side conduct at the same time, shorting the supply to ground through two on-resistances. With a 565 mΩ bridge on 12 V that is about 21 A. Drivers prevent it with dead time, a short gap such as the DRV8871's 220 ns when both switches are off.

What is the difference between braking and coasting with an H-bridge?

Braking turns on both low-side (or both high-side) switches, shorting the motor so its back-EMF drives a current that slows it hard; in PWM this is called slow decay. Coasting turns all switches off; the motor current is forced through the body diodes back into the supply and dies within microseconds, after which the motor spins freely. In PWM this is fast decay.

Why does an L298 get so hot?

The L298 uses bipolar transistors, and each conducting path drops two saturation voltages. ST specifies a total drop of 1.8 to 3.2 V at 1 A and up to 4.9 V at 2 A. At 1 A that is roughly 2.5 W of heat, against about 0.57 W for a MOSFET driver like the DRV8871.

What PWM frequency should I use for an H-bridge?

High enough that the current ripple is small compared with the average current, which depends on the motor inductance: ripple is about VS D(1−D)/(Lf)V_S\,D(1 - D)/(L f) in slow decay. Around 20 kHz is common because it is above most people's hearing. Use drive and brake (slow decay) PWM if you want speed roughly proportional to duty cycle.

Sources

  1. Texas Instruments, DRV8871 3.6-A Brushed DC Motor Driver datasheet, SLVSCY9B (565 mΩ typical HS + LS, 307/360 mΩ and 258/320 mΩ per switch, 220 ns dead time, body diode 0.8 V at 1 A, truth table for forward, reverse, brake and coast, "switch between driving and braking"): ti.com/lit/ds/symlink/drv8871.pdf
  2. Texas Instruments, SLVA321A, "Current Recirculation and Decay Modes" (fast decay, slow decay, dead time, shoot-through hazard, L/R decay with 2 RDS(on), back-EMF collapse): ti.com/lit/an/slva321a/slva321a.pdf
  3. STMicroelectronics, L298 Dual Full-Bridge Driver datasheet (source and sink VCE(sat), total drop 1.8 to 3.2 V at 1 A and 4.9 V max at 2 A, 46 V operating, 2 A DC per channel, Rth j-amb 35 °C/W, external fast-recovery diodes trr ≤ 200 ns): sparkfun.com copy of the ST L298 datasheet
  4. Typical page-one explainer (coasting described as "no current flows" and the motor "rotates freely"; no mention of dead time or diodes): CircuitBread, "How does an H-bridge work?": circuitbread.com/ee-faq/how-does-an-h-bridge-work

Method note: Figures 3 and 4 are our own time-step simulations of a brushed DC motor (series R, L and back-EMF) on an H-bridge with resistive switches and 0.8 V diodes, solved to a periodic steady state at each duty cycle; Figure 4 then finds the speed where motor torque equals load torque. The shoot-through power and braking current are our arithmetic from the datasheet values.

Header image: NASA/JPL-Caltech/MSSS (image PIA21486), regraded for this article.

Related observations
Electronics 555 Timer Frequency Formula: Where 1.44 Comes From Projects Building Your Own Quadcopter Drone: Essential Parts and Specifications in India Electronics Button Debounce Capacitor Value: How to Size the RC
Transmit