Electronics for Building Things · Lesson 16 · Motion & the Physical World

DC Motors & Motor Drivers

Make something spin — in either direction, at any speed — without frying your board.

Motors are where your projects start to move. The motor itself is simple; the important part is everything you learned earlier coming together: a pin can't drive it, it's an inductive coil, and it needs its own power. Get the pattern once and every motor project follows it.

The one win You can spin a DC motor forwards and backwards and control its speed — through a driver, the safe way.

How a DC motor behaves

A DC motor spins when you apply voltage. Two simple rules:

But a motor is a coil of wire — an inductive load. That means two warnings you already know: it draws far more current than a pin can give (Lesson 4), and it kicks back voltage spikes when switching (flyback, Lesson 11).

Never wire a motor straight to a pin It will brown out or destroy the pin. A motor needs its own power supply and a driver in between.

The motor driver and the H-bridge

A motor driver board does the heavy lifting. At its heart is an H-bridge: four switches arranged so they can connect the motor to power in either polarity — giving you both directions — plus built-in protection (SparkFun: Driving Motors with Arduino).

ESP32 dir + PWM Motor driver motor's own supply + M
The board sends low-power control signals; the driver switches the motor's own supply. Grounds are shared (common ground, Lesson 4).

Control is just digital + PWM from earlier lessons:

Rule of thumb Use a motor driver board (e.g. TB6612FNG or L298N) sized for your motor's voltage and current. Give the motor its own supply, share ground with the board, and you're set — the driver handles flyback and the heavy current.

Check yourself

Read this next (primary source) SparkFun — Driving Motors with Arduino, and the TB6612FNG Hookup Guide for a concrete driver.
I'm your teacher — ask me anything. Tell me the motor (voltage, current) and I'll help you pick a matching driver and wire the direction/speed pins.

See also: Glossary · Component field guide · Rules of thumb