← Block library

H-Bridge Motor Driver

@electrace/h-bridge@1.0.0 · CC-BY-4.0
vm 2.7–11 Viout_max 1.5 A
The actual schematic inside this block — every part is explained below.

H-Bridge Motor Driver

A motor spins the way current flows through it. To reverse a motor you must reverse the current — and you can't do that with one switch. The H-bridge is the four-switch answer: the motor hangs in the middle of an "H," and turning on a diagonal pair routes current left-to-right or right-to-left through it.

  • IN1 high → one diagonal conducts → current flows OUT1 → motor → OUT2. Forward.
  • IN2 high → the other diagonal → current flows OUT2 → motor → OUT1. Reverse.
  • Both low → motor coasts. Both high → both motor terminals tied together → brake (the spinning motor generates into a short and stops fast).
  • PWM an input instead of holding it → speed control.

Inside U1, each side of the H is a totem-pole pair (a P-FET above an N-FET below, the same structure as a CMOS logic gate, just enormous), plus logic that guarantees the deadly combination — both switches of one side on at once, shorting the supply — can never happen.

  • C1 — motors take their current in violent gulps, especially reversing. The reservoir cap answers those gulps locally so the supply rail doesn't dip and reset your MCU (the most common "my robot reboots when it turns" bug).

Exposes: vm (motor supply), in1/in2 (direction/PWM from GPIOs), out1/out2 (the motor), gnd.

⚠ Size for stall current, not running current — stall is 5–10× higher and happens at every start. A motor that runs at 200 mA but stalls at 1.6 A is over this block's limit; the checks flag it when the motor block declares its stall draw.

Exposed nets

vmin · power · 2.7–11 V
gndin · gnd
in1in · signal
in2in · signal
out1out · signal
out2out · signal

Inside this block

U1
h-bridge-1ch
four switches around the motor: IN1/IN2 pick which diagonal pair conducts, so current can flow through the winding in either direction
C1
10uF
motor supply reservoir — a reversing motor yanks big current steps that the supply wiring can't deliver instantly

Inside the chip: H-bridge — four switches around the motor

What U1 actually does, drawn out in discrete parts — the same view the editor's “break into discrete” shows.

The chip, drawn out: each side of the 'H' is a P-FET stacked over an N-FET — the same totem-pole structure as a CMOS logic gate, just sized for amps. Driving IN1 high turns the left N-FET on (OUT1 low) and the left P-FET off; driving it low does the reverse — so each input picks its side's polarity, and a diagonal pair conducts through the motor. The honesty caveat: this bare version has no dead-time logic, so during input transitions both FETs of one side conduct for an instant (shoot-through). A real driver IC adds break-before-make timing, current limits, and thermal shutdown around exactly this core.

Limits & gotchas

stall.note 0A motor's STALL current is 5–10× its running current, and it stalls at every start and reversal. The 1.5 A rating must cover stall, not cruise — measure the winding resistance: I_stall = Vm / R_winding.
decay.note 0Both inputs low = coast; both high = brake (shorts the winding). Neither hurts the driver — but reversing hard from full speed doubles the effective voltage across the winding; ramp with PWM if the supply sags.
Use this block in a real design
Drop it on a canvas, wire it up, and watch the live checks — free, no card.
Start designing →
This page is generated from the block's source — the same content powers the editor's explanations and live checks.