Skip to content
RoboLearn
Not completed

Motor drivers and H-bridges

ActuatorsBeginner30 minBefore this: DC and geared motors

What you’ll learn

  • How an H-bridge reverses a motor
  • How PWM controls speed
  • How to wire and code common driver boards

The H-bridge

Four switches around a motor, in the shape of an H. Close one diagonal pair and current flows one way; close the other pair and it flows the other way. A motor driver chip contains the H-bridge plus protection, controlled by your Arduino’s low-current pins and powered by the battery.

+V ──┬────────────┬──
S1 S3
├── (motor) ─┤
S2 S4
GND ─┴────────────┴──
S1 + S4 on → forward S3 + S2 on → reverse

PWM: speed control

PWM (pulse-width modulation) switches power on and off very quickly. The fraction of time it’s on, the duty cycle, sets the average power. analogWrite(pin, value) with 0–255 does this on the UNO’s ~ pins (3, 5, 6, 9, 10, 11).

analogWrite value Duty cycle Motor
0 0% Stopped
128 50% About half speed
255 100% Full speed

Common drivers

Driver Notes
L298N Very common, sturdy, but wastes about 2 V as heat. Pins: ENA (PWM speed), IN1/IN2 (direction) per motor
TB6612FNG Small and efficient; PWMA/AIN1/AIN2 per motor plus STBY (must be HIGH)
L9110S Tiny and cheap, two PWM inputs per motor

Finished this lesson?