Motors & motion · motor-driver

Drive a DC motor safely

Question: How do you command speed and direction without stressing the controller?

Understand the idea

A brushed DC motor draws current to create torque. At startup or stall, current can be much higher than its no-load running current. A microcontroller GPIO is designed for small logic signals, not motor current.

An H-bridge arranges switches so current can flow through the motor in either direction. A motor driver packages or controls those switches, and may add current limiting, thermal protection, or a fault output. Choose it using motor voltage and stall current, not just the board's marketing label.

PWM changes the drive's on-time to control average motor input. The motor's inductance means current does not stop instantly at each edge; the driver needs a safe recirculation path. Never command a bridge state that shorts its supply, and follow the driver's datasheet for dead time and braking behavior.

Worked example

A 12 V motor at 40% PWM receives pulses between its driver states; a simplified average-voltage estimate is 0.40 × 12 V = 4.8 V. Actual speed is not 40% of full speed because load, friction, back-EMF, and supply sag matter.

Try it at the bench

  1. Read the motor label or datasheet and find nominal voltage and stall current before connecting it.
  2. Use a motor driver rated for that supply and current; keep motor supply separate from the logic rail and join grounds as the driver requires.
  3. Start with the motor mechanically unloaded, a low duty cycle, and a current-limited supply. Stop if the driver heats, resets, or reports a fault.

Check your understanding

Why can a motor reset an Arduino even when the motor and board have separate power supplies?

Show the answer

Motor current creates voltage dips and electrical noise; shared ground impedance or poor wiring can disturb the logic reference. Supply layout, decoupling, driver choice, and grounding all matter.

Browse all course lessons