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

Servos & Steppers

When you don't just want spin — you want a precise position.

A plain DC motor (Lesson 16) just spins. But to open a vent to 30°, point a sensor, or turn a valve a precise amount, you need position control. That's what servos and steppers give you — two different ways to move exactly where you mean to.

The one win You can command a servo to a specific angle, and you know when a stepper is the better choice.

Servos: tell it an angle

A hobby servo is a clever bundle: a small geared DC motor, plus control electronics and position feedback, all in one box. You don't manage the motor — you just send it a target angle and it drives itself there and holds (SparkFun: Hobby Servo Tutorial).

It has just three wires: power, ground, and signal. The signal is a PWM-style pulse (Lesson 14): a pulse repeats ~50 times a second, and its width — between about 1 and 2 milliseconds — encodes the angle. 1.5 ms is center.

You don't time pulses by hand The Servo library does it: myservo.write(90) sends the right pulse for 90°. Wire three pins, call write() with an angle, done.

Two flavors: a standard servo moves to an angle (often 0–180°); a continuous-rotation servo ignores angle and instead spins at a speed/direction you set — handy as a simple geared wheel motor.

Power gotcha Servos yank sudden current when they move and can brown out your board if powered from it. Power anything but the tiniest servo from a separate supply, and share ground with the board (common ground, Lesson 4). The signal wire is the only one that goes to a GPIO pin.

Steppers: move in exact steps

A stepper motor rotates in many tiny, precise steps (e.g. 200 per full turn). Tell it to take N steps and it lands exactly there, and holds firmly — all without any position sensor. That makes steppers great for repeatable, precise motion: blinds, camera sliders, 3D-printer axes, a dialed-in valve.

Like DC motors, steppers need a driver (e.g. A4988, or a ULN2003 board for the common little 28BYJ-48) and their own power. You send step and direction signals (a library handles the sequencing).

Which one?

Want…Use
A specific angle, simply, in a small rangeServo
Continuous spin you can start/stop/reverseDC motor + driver, or continuous servo
Precise, repeatable positioning over many turnsStepper + driver

Check yourself

Read this next (primary source) SparkFun — Hobby Servo Tutorial, and Basic Servo Control for Beginners for the code.
I'm your teacher — ask me anything. Describe the motion you want (how far, how precise, how strong) and I'll help you choose servo vs stepper vs DC motor.

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