How Do You Drive a DC Motor with an H-Bridge?
Last updated 6 July 2026 · 10 min read
Direct Answer
An H-bridge is a four-switch circuit — two high-side and two low-side transistors arranged in an 'H' around the motor — that lets a single supply drive a brushed DC motor in either direction. Turning on one diagonal pair (high-side left + low-side right) drives the motor forward; the opposite diagonal reverses it; turning on both low-side switches together shorts the motor terminals for dynamic braking; and turning everything off lets it coast. Speed is controlled by applying PWM to the conducting pair. The two critical design rules are: never allow both switches on the same leg to conduct simultaneously (shoot-through — prevented by dead time, which integrated driver ICs handle automatically), and size the bridge for the motor's stall current, not its running current, because a brushed DC motor draws its full stall current at every start-up and direction reversal.
Detailed Explanation
A microcontroller GPIO pin can source a few milliamps at 3.3 V. Even a small brushed DC motor wants hundreds of milliamps to several amps at 6–24 V — and it is an inductive, brush-commutated, electrically noisy load. Driving a motor therefore always means putting a power stage between the logic and the winding. If the motor only ever turns one way, that stage can be a single transistor. The moment the design needs reversal — a robot drive wheel, an actuator that extends and retracts, a pump that must run backwards to purge — the standard answer is the H-bridge.
The name describes the schematic: four switches (in modern designs, MOSFETs) arranged as the two vertical strokes of a letter "H", with the motor forming the horizontal bar between them. Each side of the motor connects to the midpoint of a leg — one high-side switch up to the supply and one low-side switch down to ground.
The Four Useful Switch States
| State | High-side A | Low-side A | High-side B | Low-side B | Motor behaviour |
|---|---|---|---|---|---|
| Forward | ON | off | off | ON | Current flows A→B through the motor |
| Reverse | off | ON | ON | off | Current flows B→A through the motor |
| Brake (slow decay) | off | ON | off | ON | Motor terminals shorted — back-EMF opposes rotation |
| Coast (fast decay) | off | off | off | off | Motor disconnected — spins down freely |
Driving one diagonal pair pushes current through the motor in one direction; the opposite diagonal reverses it. The two remaining useful states — brake and coast — differ in what happens to the energy stored in the spinning rotor and the winding inductance, and the same distinction reappears below as the PWM decay-mode choice.
Shoot-Through and Dead Time
The one state an H-bridge must never enter is both switches of the same leg on simultaneously: that connects the supply directly to ground through two MOSFETs, limited only by their on-resistance. This fault — shoot-through — can destroy the bridge in microseconds and, even in milder transient form during switching edges, wastes power and stresses the devices on every PWM cycle.
Because a real MOSFET turns off more slowly than it turns on, simply driving the two gates with complementary signals is not enough. Every practical bridge inserts dead time: a short interval (typically some hundreds of nanoseconds, per the driver's datasheet) in which both switches of a leg are off before the opposite one turns on. Integrated motor driver ICs generate dead time internally and make shoot-through effectively impossible to command from the logic inputs. If you build a bridge from discrete MOSFETs and gate drivers, dead-time generation — in the gate driver IC, the MCU's motor-control timer (most MCU advanced timers have hardware dead-time insertion), or both — becomes your responsibility, along with all the other details covered in how gate driver ICs and bootstrap supplies work.
PWM Speed Control and Decay Modes
Motor speed is controlled by PWM: switching the conducting state on and off fast enough that the motor's inductance and mechanical inertia average the pulses into a smooth effective voltage, as covered in PWM frequency and duty cycle fundamentals. What distinguishes motor PWM from, say, LED dimming is the question of where the winding current goes during the off portion of each cycle — the decay mode:
- Slow decay — during the off-time the motor is placed in the brake state (both low-side switches on), so winding current recirculates through the short and decays slowly. Result: lower current ripple, better low-speed torque behaviour, and speed that responds roughly linearly to duty cycle in most designs.
- Fast decay — during the off-time the bridge switches to the opposite diagonal (or all-off, forcing current through the body diodes), so the winding current is actively driven down. Result: faster current response — useful for current-regulated drives — at the cost of higher ripple.
- Mixed decay — many driver ICs blend the two within each PWM cycle to balance ripple against response, particularly in current-chopping stepper applications.
Most integrated drivers expose this through their two logic inputs: for example, PWM-ing one input while holding the other high gives slow decay, while alternating the pair gives fast decay. Which mapping applies is a datasheet detail worth checking early — two drivers with identical pinouts can behave differently under the same input waveform.
Where the Inductive Energy Goes
A motor winding is an inductor; interrupting its current forces the voltage across it to spike in whatever direction keeps current flowing. In an H-bridge, MOSFET body diodes provide the freewheeling path during dead time and fast decay, so a separate flyback diode (of the kind a single-switch relay or solenoid driver needs — see how diodes work and where they're used) is not usually added externally. Two consequences still matter:
- Body diodes dissipate real power (roughly their forward drop times the freewheel current) whenever they conduct. Synchronous rectification — turning the opposing MOSFET on during the freewheel interval, which is exactly what slow decay does — routes that current through the MOSFET channel instead and cuts the loss.
- When the motor decelerates or reverses, it acts as a generator and pumps energy back into the supply rail. A bench supply or battery absorbs this; a poorly-decoupled rail fed by a small regulator can be pumped upwards past its rated voltage. Bulk capacitance at the bridge's supply pins — sized for the application, not just a token 100 nF — is part of the bridge design, and the driver datasheet's layout guidance typically makes it the first requirement.
Integrated Driver IC vs Discrete Bridge
For motor currents up to roughly 3–4 A continuous, single-chip brushed motor drivers are almost always the right answer: parts like the TI DRV8871 (up to ~3.6 A peak, per its datasheet) integrate all four MOSFETs, dead-time generation, current limiting, and overtemperature/undervoltage protection in one package, driven directly by two logic pins. The classic L298 bipolar-transistor bridge still appears in hobby tutorials but is genuinely obsolete for new designs — its Darlington output stages drop 2–4 V total, wasting power the MOSFET drivers don't.
Above the integrated-driver range (typically beyond ~5–10 A continuous, in most designs), the structure splits: a gate driver IC (half-bridge or full-bridge driver with bootstrap high-side supplies and programmable dead time) drives four discrete MOSFETs sized for the current. This buys unlimited scaling and device-level optimisation at the cost of taking on shoot-through protection, gate drive design, and layout of a high-current switching loop yourself.
Current Sensing and Stall
A brushed DC motor's current is at its maximum — the stall current — whenever the rotor is stationary with voltage applied: at every start, every reversal, and any mechanical jam. Stall current is set by the winding resistance alone and is commonly 5–10× the rated running current. Two design responses:
- Size for stall, or limit for stall. Either the bridge, supply, and thermal design handle full stall current for the worst-case duration, or the drive actively limits current below that. Integrated drivers typically provide current regulation via an external sense resistor or a fixed internal limit (the DRV8871 sets its limit with a single resistor); discrete designs use a shunt resistor in the bridge's ground leg with a comparator or the MCU's ADC.
- Use the current signal. The same sense path that protects the bridge is a free torque signal — useful for detecting end-stops (current rises at a mechanical limit), jams, and load monitoring, often eliminating a limit switch.
Design Considerations
- Rate the bridge for stall current, not nameplate running current. Motor driver current ratings themselves need careful reading — TI's application note SLVA504 explains why a "3.6 A" driver is not a "3.6 A continuous under all conditions" driver; the real limit is junction temperature, which depends on PCB copper, ambient temperature, and duty cycle. Apply the same junction-temperature arithmetic as any other power component — see thermal design and heatsink selection.
- Choose the PWM frequency deliberately. Above ~20 kHz avoids audible whine; higher frequencies increase switching loss roughly proportionally. Check the driver datasheet's maximum PWM frequency and minimum on-time — current regulation loops in integrated drivers have blanking times that constrain very narrow pulses.
- Lay out the power loop tightly. The supply → high-side → motor → low-side → ground loop carries fast-switched high current; keep it small, place bulk and ceramic decoupling at the driver's supply pins, and keep the current-sense shunt's Kelvin connections separate from the power path.
- Decide the transistor technology by voltage and current. At the low-voltage, moderate-current end, integrated MOSFET drivers dominate; discrete designs choose devices on the same criteria as any switching stage — see BJT vs MOSFET selection.
- Plan the fault states. What should the motor do on MCU reset, brownout, or firmware crash? Most driver ICs coast when their inputs float low — verify the pull-up/pull-down defaults on the driver inputs produce a safe state with the MCU unprogrammed, in reset, and mid-firmware-update.
- Add a shaft encoder for closed-loop speed or position control. Open-loop PWM sets duty cycle, not actual speed — load changes shift the RPM at a fixed duty cycle. Any design that needs to hold a specific speed or reach a specific position needs shaft feedback; see how do you interface a rotary encoder to a microcontroller? for quadrature decoding, and pair it with the MCU's hardware timer encoder mode where available so the control loop's position read never costs CPU time.
Zeus Design's electronics team designs and validates motor drive stages — from integrated-driver boards to discrete high-current bridges with closed-loop current control — as part of complete product electronics development.
Common Mistakes
- Commanding both switches of one leg on together. In firmware-controlled discrete bridges this is the classic fatal bug — a single GPIO glitch or wrong initialisation order causes shoot-through. Use the MCU timer's hardware complementary outputs with dead-time insertion, or an integrated driver whose input logic makes the state impossible.
- Sizing everything for running current and discovering stall the hard way. The first jam, the first reversal under load, or simply the first cold start pulls stall current — and a bridge sized for running current fails precisely then. Measure winding resistance and compute stall current before selecting the driver.
- Ignoring supply pumping during deceleration. Regenerated energy has to go somewhere; an undersized bulk capacitor on a diode-isolated or regulator-fed rail lets the rail voltage rise until something reaches its absolute maximum rating. Verify rail behaviour on a scope during aggressive stop and reverse commands, not just steady running.
- PWM-ing at a frequency the driver's current regulation can't follow. Very high PWM frequencies collide with the driver's internal blanking and minimum on-times, producing erratic current limiting. Stay within the datasheet's recommended PWM range rather than assuming faster is better.
- Testing without the real mechanical load. A motor spinning free on the bench draws a small fraction of its loaded current and hides thermal, stall, and regeneration problems entirely. Validate with the actual mechanism — or a representative dynamometer load — before signing off the drive design.
Frequently Asked Questions
- What is the difference between coast and brake in an H-bridge?
- Coast (all four switches off) disconnects the motor and lets it spin down freely on its own friction — the winding current decays through the body diodes and the motor takes a comparatively long time to stop. Brake (both low-side switches on, sometimes called dynamic braking) shorts the motor's terminals together, so the spinning motor acts as a generator into a short circuit and its own back-EMF opposes the rotation — stopping it much faster. Neither mode holds position against an external load once stopped; that requires a stepper, a brake, or closed-loop servo control.
- Can I drive a motor in one direction without an H-bridge?
- Yes — if the motor only ever needs to run one way, a single low-side switch (one N-channel MOSFET between the motor's negative terminal and ground, with a freewheeling diode across the motor) is simpler and cheaper than a full bridge. The H-bridge earns its four switches only when reversal or dynamic braking is required. For on/off control of a unidirectional motor, the single-switch circuit is the standard choice.
- Does an H-bridge work for stepper or brushless (BLDC) motors?
- The H-bridge is the building block, but not the whole answer. A bipolar stepper motor needs two full H-bridges (one per winding) driven with a specific step sequence — which is why dedicated stepper driver ICs (A4988, DRV8825, Trinamic TMC2209) integrate two bridges plus indexer and microstepping current control; see [how do you drive a stepper motor with a driver IC?](/questions/stepper-motor-driver-ic-microstepping) for the STEP/DIR interface, microstepping, and current-limit sizing. A three-phase BLDC motor needs three half-bridges (six switches) and commutation logic driven by rotor position (Hall sensors or sensorless back-EMF detection) — see [how do you drive a BLDC motor with a three-phase driver?](/questions/bldc-motor-three-phase-driver-commutation) for sensored vs sensorless commutation and trapezoidal vs FOC control. Both are best served by their dedicated driver IC classes rather than hand-rolled H-bridge control.
- Why does my motor whine audibly under PWM control?
- The motor windings physically vibrate at the PWM switching frequency, so any PWM frequency inside the audible range (roughly 20 Hz to 20 kHz) produces an audible tone at that frequency. The common fix is raising the PWM frequency just above the audible band — typically 20–25 kHz — which silences the whine at the cost of somewhat higher switching losses in the bridge. Going far higher than needed wastes efficiency: switching losses scale roughly linearly with frequency, and most brushed DC motors gain nothing from PWM above a few tens of kilohertz.
References
Related Questions
PWM Explained: Frequency, Duty Cycle, Dead-Time, and Hardware Timers
Learn how PWM works: duty cycle, frequency, resolution, dead-time for H-bridge drives, and when to use hardware timers versus software PWM on microcontrollers.
How Do MOSFET Gate Driver ICs and Bootstrap Circuits Work?
How MOSFET/IGBT gate driver ICs work, how to size a bootstrap capacitor and diode for high-side drive, and when a GPIO alone isn't enough.
BJT vs MOSFET: Which Transistor Should You Use?
BJTs are current-controlled and suit precision analog circuits. MOSFETs are voltage-controlled, switch faster, and dominate power switching. When to use each.
What Is a Diode and How Does It Work?
Covers P-N junction, forward voltage drop, silicon vs Schottky, Zener regulation, TVS suppression, and LED — with guidance on each type.
How Do You Calculate Thermal Design and Select a Heatsink for a Power Component?
Calculate junction temperature from power dissipation and thermal resistance, then select PCB copper area or a heatsink to keep a power component within limits.
How Do You Interface a Rotary Encoder to a Microcontroller?
Interface an incremental rotary encoder to a microcontroller: quadrature A/B decoding, hardware timer/PCNT counting vs software ISR decoding, and debounce.