Lessons and the learning game

Design an H-bridge

Build a motor driver from four MOSFETs: gate drive, dead time, shoot-through, current sensing and braking, ending in a driver you characterize.

The benches

Every lesson is a circuit with no microcontroller, solved by the simulator's SPICE engine at 12 V. Logic "pins" are slide switches between 0 and 5 V.

  • One MOSFET, low side: an N-channel MOSFET switching a 12 V motor, with a meter from drain to source, to compare an IRLZ44N, an IRF540N and a 2N7000 at 5 V and 3.3 V.
  • One MOSFET, high side: a P-channel IRF9540N, first with its gate on the logic pin (it never turns off), then behind an NPN level shifter.
  • One leg and its dead time: a P-channel and an N-channel driven by two op-amp comparators from a 100 Hz triangle, with a threshold knob for each. Opening a gap between the thresholds is dead time; overlapping them is shoot-through, read as average current on a DC ammeter. The frequency is far below a real drive's 20 kHz so the effect shows on a meter.
  • A discrete H-bridge: four MOSFETs, a switch per gate, level shifters for the high sides, and an ACS712 in the motor lead. The bench supply's current limit catches every shoot-through.

Take the course Design an H-bridge on /learn.

The lessons

  1. MOSFET choice: 22 milliohms from a meter reading, logic level against the IRF540N, a 3.3 V gate, and a part too small for the stall current.
  2. Gate drive: a P-channel that will not turn off at -7 V, an NPN level shifter, and why N-channel high sides need a bootstrap.
  3. Dead time: 0.39 A with a wide gap, 0.48 A with a narrow one, 0.93 A and 1.38 A when the switches overlap.
  4. Shoot-through: forward, reverse, a shorted leg at the 3 A limit, the supply collapsing, and a 0.5 A limit that makes the mistake harmless.
  5. Current sensing: 0.15 A running, a 0.92 A start surge, a negative reading in reverse, and a 4 ohm motor that surges to 2.7 A.
  6. Braking: coast, braking on the low or the high sides at about -0.76 A, plugging at -1.67 A, and a heavier motor that brakes harder.
  7. Boss: a discrete motor driver: wire in the sensor, measure forward, reverse and braking, catch a shoot-through, then fit and characterize your own motor.

What is simplified

The simulator's MOSFET models include their gate capacitance, but the switching here is slow: no lesson measures nanosecond edges, ringing or switching loss. The level shifters (a 2N2222 and a 1 k pull-up) are fine at these speeds and far too slow for 20 kHz PWM, where a gate driver chip is used. The ACS712's reading is used directly, in amps.

Before and after

The course builds on Motors and motion (the L293D) and Power electronics (gate drivers, the DRV8871, heat).