A DC motor spins one way when current flows through it in one direction, and the other way when the current reverses. A single transistor can only switch the motor on and off in one direction — to reverse it you need to flip the supply across the motor, and that takes four switches arranged in the shape of the letter H. This article builds that H-bridge, works out the current, the power and the PWM ripple, and shows the one mistake that destroys it.
Figure 1: An H-bridge (a) — Q1 and Q4 drive the motor forward, Q2 and Q3 drive it in reverse. At 20 kHz PWM the motor's own inductance smooths the current to a 30 mA ripple (b). (Schematic, not to scale.)
How it works — the formulas
The motor sits in the middle of the bridge: Q1 and Q4 on the two top corners, Q2 and Q3 on the bottom. Turn on Q1 and Q4 and current flows from +12 V, through Q1, through the motor left to right, and out through Q4 to ground. Turn on Q2 and Q3 instead and the current flows the other way. The other two combinations are brake (both low-side switches on, shorting the motor through its own resistance) and coast (everything off). The motor itself is a voltage source plus a resistance: as it spins it generates a back-EMF E, and the current is whatever the remaining voltage pushes through the winding resistance:
I = (V − E) / Rm (mechanical power Pmech = E × I, copper loss Pcu = I² × Rm)
Speed is controlled with PWM: switching the bridge on and off thousands of times a second makes the motor see the average voltage, Vavg = D × V, where D is the duty cycle. The motor's inductance smooths the current, and the ripple is:
ΔI = V_L × t_on / L
Worked example — 1.5 A into a 12 V motor
Take the motor in Figure 1: 12 V supply, winding resistance Rm = 2 Ω, inductance L = 5 mH, and at 3000 RPM it generates a back-EMF of E = 9 V. The current is I = (12 − 9) / 2 = 1.5 A. The mechanical power is 9 × 1.5 = 13.5 W, the copper loss is 1.5² × 2 = 4.5 W, and the supply delivers 12 × 1.5 = 18 W — the two add up exactly. At stall the back-EMF is zero, so the current jumps to 12 / 2 = 6 A and all 72 W becomes heat in the winding — that is why a stalled motor burns out if it is left powered.
With MOSFETs of Rds(on) = 50 mΩ each, two are in the current path at any time, so the switches add 100 mΩ: the conduction loss is 1.5² × 0.1 = 0.225 W in normal running and 6² × 0.1 = 3.6 W at stall. Now the PWM ripple: at 50% duty and 20 kHz the average voltage is 6 V, the motor settles where E + IR = 6 V (E = 3 V at 1.5 A), and during the 25 µs on-time the inductor sees 12 − 3 − 3 = 6 V, so ΔI = 6 × 25 µs / 5 mH = 30 mA peak-to-peak — just 2% of the 1.5 A average, as Figure 1(b) shows. When a switch turns off, the inductor keeps its 1.5 A flowing and its stored energy, ½ × 5 mH × 1.5² = 5.6 mJ, circulates through the MOSFETs' body diodes — that is why an H-bridge needs those diodes, built-in or added.
The catch — shoot-through, and the plug-braking surprise
Never turn on both switches in one leg at the same time. Q1 and Q2 together (or Q3 and Q4) connect the 12 V supply straight through two 50 mΩ MOSFETs: 12 / 0.1 = 120 A — the supply sags, the MOSFETs cook, and something gives up. Real drivers therefore insert dead time, about 500 ns here, a deliberate gap between turning one switch off and the other on, so the two are never on together even for an instant. The second trap is reversing a spinning motor: at 3000 RPM the back-EMF is still 9 V, and flipping the bridge puts the supply and the back-EMF in series across the winding, so the current is (12 + 9) / 2 = 10.5 A — seven times the running current, in the opposite direction. Always ramp the PWM down, let the motor slow, and only then reverse it.
Designing a 24 V, 3 A bridge
Suppose the next motor is a 24 V, 3 A unit. Choose MOSFETs with Rds(on) ≤ 20 mΩ, so the two in the path add 40 mΩ and the conduction loss is 3² × 0.04 = 0.36 W — small enough to skip a heatsink on most packages. The body diodes (or added Schottky diodes) must carry the full 3 A during dead time, the dead time should grow to about 1 µs because bigger MOSFETs switch more slowly, and the PWM frequency stays at 20 kHz — above hearing, fast enough that the ripple stays small. And size the supply for the stall current, not the running current: a 24 V motor with a 4 Ω winding still draws 6 A stalled, and the bridge has to survive it.
Key points to remember
- Forward is Q1 + Q4, reverse is Q2 + Q3, brake is both low-side switches on, coast is all off — the four switches flip the supply across the motor.
- Worked example: 12 V motor, Rm = 2 Ω, E = 9 V at 3000 RPM → I = 1.5 A, 13.5 W mechanical, 4.5 W copper loss; at stall the current is 6 A and all 72 W is heat.
- PWM speed control: 50% duty at 20 kHz gives 6 V average, and the 5 mH inductance limits the ripple to 30 mA peak-to-peak — 2% of the average current.
- Never switch both devices in one leg on together: 12 V across 100 mΩ is a 120 A shoot-through, so use ~500 ns of dead time; the body diodes must carry the 5.6 mJ of inductive energy at every switch-off.
- Design rule: for a 24 V, 3 A motor use MOSFETs with Rds(on) ≤ 20 mΩ (0.36 W conduction loss), diodes rated for 3 A, 1 µs dead time — and never reverse a spinning motor at full speed, or the back-EMF drives 10.5 A backwards through the bridge.
