Lab

H-bridge motor driver circuit: how it reverses a motor

An H-bridge uses four switches to run a DC motor forward, in reverse or to a stop. Flip the switches of a live H-bridge motor driver built from four MOSFETs, then see why one wrong switch is a short circuit.

Open the lab

The two circuits on this page work without an account. On a computer or tablet the full lab is limited without an account; a free account lets you try it in full first. NGSpice charts need an account; saving needs a plan. Create a free account

What is an H-bridge?

An H-bridge is four switches drawn like the letter H, with the motor as the crossbar. Reversing the voltage across a DC motor reverses its turning, and the H-bridge does that from one battery. It is also called an H bridge circuit or an H-bridge motor driver; in Spanish, a puente H (or puente en H).

Why four switches?

One switch only turns a motor on and off. A double-pole switch or a relay can reverse it, but an H-bridge does it electronically with four switches, so it can also brake and set the speed with PWM. The two on the plus side are high-side switches, the two on the minus side low-side switches; one of each is a leg, and the motor sits between the legs.

Five settings matter:

H-bridge motor driver from four MOSFETs

A 12 V battery feeds two legs, each with a P-channel MOSFET on the high side and an N-channel MOSFET on the low side, all on the lab's Power preset (44 mΩ for the N-channel and 117 mΩ for the P-channel when on). The two gates of a leg are tied together and driven by one switch that connects them to 12 V or to ground, so with the lab's ideal switches the two are never on together. A diode across each MOSFET protects them from the motor's kick. The motor draws about 5.8 A, above the 5.5 A the default 22 AWG wire can carry, so its path is 14 AWG.

Preview of H-Bridge from Four MOSFETs Driving a DC Motor
Open in the lab Embed Run the circuit right here. To edit it in the full lab, sign in; free accounts have a time limit there.
  1. It opens in forward, with the top-left and bottom-right MOSFETs on: about 9.9-10 V reaches the motor, which draws 5.8-6.1 A, spins near 1,700 rpm and makes about 6.5 V of back-EMF.
  2. Click the left switch: both motor terminals go to ground. This is the brake: the motor stops in a fraction of a second.
  3. Click the right switch: reverse. The motor runs the other way.
  4. Click the left switch for the second brake (both terminals at 12 V), then the right switch for forward again. With NGSpice on, the half-second run ends mid-acceleration: about 6.1 A.

Shoot-through, shown safely

Shoot-through is both MOSFETs of one leg on at once: the battery is shorted through them and almost nothing limits the current. In a real bridge both can conduct for an instant while a leg switches, which is why driver chips add a short dead time; the lab's switches are ideal.

The tied gates of a bridge leg prevent this. Here you can cause it safely: one leg driving a 12 V lamp, each gate on its own switch, and a 10 Ω resistor and an ammeter in the supply.

A minus sign on an ammeter only shows the direction the current flows through it; read the size of the number.

Preview of Shoot-Through, Shown Safely
Open in the lab Embed Run the circuit right here. To edit it in the full lab, sign in; free accounts have a time limit there.
  1. It opens with only the P-channel on: the lamp lights and the ammeter reads about 0.15 A.
  2. Click the top switch to turn the P-channel off and the bottom switch to turn the N-channel on: the lamp goes out and the ammeter reads 0.
  3. Click the top switch again, with the N-channel still on: both conduct, the lamp stays dark and the ammeter reads about 0.75-0.8 A, a short circuit. Without the 10 Ω resistor it would be tens of amps.

Why 0.75-0.8 A, not 12 V ÷ 10 Ω = 1.2 A? The resistor's drop lowers the P-channel's source to about 4 V, so with its gate at ground it has only about 4 V of drive, barely above its 3 V threshold: the transistor itself limits the current. The resistor heats at about 6 W.

Flyback diodes and back-EMF

A spinning motor is also a generator: its back-EMF opposes the battery and grows with speed. A motor is also a coil, which keeps pushing current when a switch opens and can make a voltage spike that destroys a MOSFET. The diode across each MOSFET, cathode towards the supply, gives that current a way round.

Speed control with PWM

A controller can also set the speed by switching one MOSFET on and off hundreds of times a second: pulse-width modulation, or PWM. The motor feels the average: on half the time gives it about half the battery voltage.

H-bridge driver chips

Real projects rarely use four loose MOSFETs: an H-bridge driver chip packs the switches, gate drive, diodes and protection into one package. Pick one by its supply voltage and rated current.

Use it in class

Predict, change one thing, measure.

H-bridge: students predict which MOSFETs conduct before each click, then switch all four from Power to Small signal: the motor gets only about 2 V and stays still.

Shoot-through: students turn on both MOSFETs (0.75-0.8 A), then try 22 Ω (about 0.37 A) and 4.7 Ω (about 1.5 A) and compare with 12 V ÷ R.

Setting up a class needs a free account. Your free classroom gets a 7-day full-class trial, counted from when the first student joins; after that the classroom stays open for a smaller class.

Try it with your class

Frequently asked questions

What is an H-bridge used for?

Running a DC motor both ways from one battery, and at different speeds with PWM.

Why does an H-bridge have four switches?

A double-pole switch or relay can also reverse a motor; four switches let the bridge do it electronically, and also brake and run PWM.

What is shoot-through?

Both switches of one leg on at once: the battery is shorted through them, limited only by their small resistance.

How do you brake a motor with an H-bridge?

Turn on both low-side switches, or both high-side ones. The terminals are joined and the motor's back-EMF drives a current that stops it.

Why does an H-bridge need flyback diodes?

A motor is a coil: when a switch opens it keeps pushing current, and the diodes give it a path instead of a destructive voltage spike.

Why does my motor not turn in the lab?

The default Small signal MOSFET has about 1.3 Ω, so four leave the motor about 2 V, below the 27 % of its rated voltage a loaded motor needs to start. Choose the Power preset.

Can I simulate an H-bridge free online?

Yes. The circuits on this page run free in your browser, no account needed.

Build your own H-bridge

Open the lab and wire your own four-MOSFET bridge.

Open the lab