Learn & build · Electronics · Chapter 14
Motors
Chapter 3's coil made a magnetic field from a current. Put that coil next to a magnet and the field pushes: that's a motor. The push on a wire is \(F = B I \ell\): the magnet's field strength \(B\) times the current \(I\) times the length \(\ell\) of wire inside the field. This chapter covers the three kinds you'll actually use: a plain DC motor (fast, cheap, needs an H-bridge to reverse), a hobby servo (goes to an angle you name with a pulse), and a stepper (moves exactly one notch per pulse), along with the electronics that drive each.
1. A DC motor, and the voltage it makes back
Torque, the turning force on the shaft, is proportional to current: \(\tau = k\,I\) (this \(\tau\) is torque, not chapter 2's time constant; \(k\) is the motor's constant, and below, \(\omega\) is how fast it spins, in radians per second). But a spinning motor is also a generator (chapter 3: a moving magnet in a coil induces a voltage), and that back-EMF \(k\,\omega\) opposes the supply. So the current is set by what's left over: \(I = (V - k\omega)/R\). A free-running motor speeds up until back-EMF almost cancels the supply and only a small current flows. Load it, it slows, back-EMF drops, more current flows, more torque: it balances itself. Hold the shaft still (stall) and nothing opposes the supply: the current is just \(V/R\), the largest it can be.
\[ I = \frac{V - k\,\omega}{R}, \qquad \tau = k\,I, \qquad I_\text{stall} = \frac{V}{R} \]
🎯 Challenge: stall the motor (drag the load until it stops) and read the stall current.
A 6 V motor has a winding resistance of 2 Ω. What's its stall current, in amps?
A motor's current is whatever its back-EMF leaves over, \((V - k\omega)/R\): small while it spins freely, largest when it's stalled.
Why does an unloaded motor's speed follow the voltage?
- Unloaded, the motor only has to beat a little friction, so it needs almost no torque.
- Torque is \(k I\), so almost no current flows: \(I \approx 0\).
- Then \(V - k\omega \approx 0\): the back-EMF has risen until it nearly matches the supply.
- So \(\omega \approx V / k\). For this page's motor, \(k = 0.01\) V·s/rad: at 6 V, 600 rad/s, which is \(600 \times 60 / 2\pi \approx 5{,}700\) rpm.
- Halve the voltage and the speed halves. That's why PWM (section 3), which sets an average voltage, sets the speed.
2. The H-bridge
To run a motor both ways you need to swap which terminal is positive. Four switches (MOSFETs, chapter 4) in an "H" do it: close the top-left and bottom-right and current flows left to right through the motor; close the other diagonal and it flows right to left. Close both bottoms and the motor's terminals are shorted together: its own back-EMF drives a current that brakes it hard. Close two switches on the same side and you've connected the supply straight to ground: shoot-through, which in real life means smoke. Driver chips (L298, DRV8833, TB6612) contain the four switches plus the logic that makes shoot-through impossible.
🎯 Challenge: run the motor forward, then reverse it, then brake it.
When a running motor's H-bridge switches off, the motor's coil still carries current and wants to keep it flowing (chapter 3). Where does it go?
3. Speed control with PWM
Chapter 13's PWM drives one switch of the bridge: at 50% duty the motor sees, on average, half the supply. The coil's inductance smooths the current between pulses (it can't change quickly), so the motor spins steadily rather than jerking. Pick the PWM frequency above 20 kHz and you can't hear it whine. Below, the duty sets the average voltage that section 1's motor runs on.
4. Hobby servos: an angle from a pulse width
A servo is a small DC motor, a gearbox, a potentiometer on the output shaft (a resistor with a sliding contact: a voltage divider, chapter 1, whose middle moves as the shaft turns) and a control circuit in one box. You send it a pulse every 20 ms (50 Hz), and the pulse's width is the angle you want: 1 ms means one end, 2 ms the other, 1.5 ms the middle. The circuit compares the pot's reading with the pulse and drives the motor until they match: a closed loop, like chapter 7's op-amp chasing its two inputs to equal.
A servo maps 1.0 ms → 0° and 2.0 ms → 180°, linearly. What angle does a 1.75 ms pulse give, in degrees?
5. Steppers: one notch per pulse
A stepper has two coils and a magnetized rotor with many teeth. Energize coil A one way, and the rotor snaps to the nearest position that lines up with A. Then B, then A reversed, then B reversed: each step moves the rotor one notch, 1.8° for the common kind, 200 steps per turn. No sensor needed: count the steps and you know where it is (as long as it never skips). That's why 3D printers and plotters use them. Energize both coils at once between full steps and the rotor sits halfway: half-stepping, twice the resolution.
How many full steps turn a 1.8° stepper by exactly 90°?
A robot arm's base must hold any angle precisely, all day, with no position sensor. A wheel just has to go fast. A camera pan needs an angle, cheaply. Which motor goes where?
- DC on the arm, stepper on the wheel, servo on the camera
- Servo on the arm, stepper on the wheel, DC on the camera
- Stepper on the arm, DC on the wheel, servo on the camera
In the circuit lab, "MOSFET motor driver with flyback" is section 2's bottom half of the bridge. Next: hands-on, building these for real on a breadboard and a PCB.
Previous: Microcontrollers and buses · All chapters: Learn & build.
Last updated