Driving motors with Arduino: servo vs DC vs stepper, drivers and separate power
TUREFF• •0
Motors are where many Arduino projects go wrong, and usually for the same reason: someone wires a motor straight to a pin or the board's 5 V supply and the board resets, misbehaves or is damaged. The rule to remember is simple. The Arduino gives the orders; something else supplies the muscle.
Why a pin cannot drive a motor
An Arduino pin is designed to supply a small signal current, tens of milliamps at most and less on some newer boards. Even a small hobby motor can draw far more than that, and much more again at the moment it starts or stalls.
Motors also cause trouble electrically:
- They create electrical noise that can reset the microcontroller.
- When a motor coil switches off, it can push a voltage spike back into the circuit. Drivers include protection (flyback diodes) against this.
So every motor goes through a driver of some kind, and usually from its own power supply.
Servo motors
A hobby servo turns to a set angle, usually across about half a turn, and holds it. Inside are a small motor, gears and its own control circuit, so the Arduino only sends a control pulse on one wire. The built-in Servo library handles that.
Good for: steering, flaps, pointing a sensor, small robotic arms.
Wiring: three wires, usually power, ground and signal. The signal wire goes to an Arduino pin. A single small servo doing light work is often run from the board in tutorials, but anything larger or more than one servo should have a separate supply of the right voltage. Continuous-rotation servos exist too; they spin rather than hold an angle.
DC motors
A plain DC motor spins when powered and reverses if you swap the wires. Speed is controlled with PWM, switching the power on and off very fast, via analogWrite.
Good for: wheels, fans, pumps.
To run one you need a driver:
- a transistor or MOSFET circuit with a flyback diode, to switch one direction only
- an H-bridge motor driver module, to run forwards and backwards with speed control
Pick a driver rated comfortably above the motor's stall current, not just its running current.
Stepper motors
A stepper moves in fixed steps, so you can turn it a precise amount without any sensor. They hold position firmly when powered, and they draw current even when standing still, so they get warm.
Good for: 3D printers, camera sliders, plotters, anything needing repeatable positions.
A stepper always needs a driver board. Small ones come with a matching driver in many kits; larger ones use dedicated stepper drivers where you set a current limit. Set that limit before running the motor. The Stepper library, or more capable third-party libraries, send the steps.
Separate power, shared ground
The safe pattern for any motor project:
- Power the motor and driver from a supply matched to the motor's rated voltage and able to deliver its current.
- Power the Arduino from USB or its own input as usual.
- Connect the grounds of the two supplies together, so the control signal has a common reference.
Without a shared ground, the driver may not understand the Arduino's signals at all. Never connect the motor supply's positive line to the Arduino's 5 V pin.
Batteries need respect: lithium cells can deliver large currents into a short and get dangerously hot. Use a holder with protection or a fuse, and never leave a charging lithium pack unattended.
Quick comparison
- Servo: set an angle; easy; limited rotation.
- DC motor: continuous spin and speed; needs an H-bridge for reversing.
- Stepper: precise steps and holding; needs a stepper driver; warms up.
Common symptoms
- Board resets when the motor starts: power the motor separately and add the driver's recommended capacitors.
- Motor hums but does not turn: supply too weak, or stepper wiring order wrong.
- Driver very hot: check its rating and current limit.
What motor are you trying to drive, and from what supply? Share your setup or your questions in the comments.