DC motor
A small brushed DC motor, the yellow gearbox kind: two terminals, and nothing driving it.
Put a voltage across the terminals and it turns; reverse the voltage and it turns the other way. There is deliberately no driver built into the part. A motor is not something a board pin can run on its own, so the circuit that makes it turn (a transistor or an H-bridge) is the actual lesson. Wire it straight to a pin here and it will barely move, for the same reason it barely moves on a real bench.
Pins
| Pin | What it does |
|---|---|
1 |
One terminal. |
2 |
The other terminal. |
Properties
voltage: rated voltage, 6 by default. rpm: rated speed at that voltage, 200.
resistance: winding resistance, 6 ohms, what a small gearbox motor measures
across its terminals when still. inertia: the mechanical lag, in milliseconds,
120 for a gearbox motor with a wheel on it. back_emf: the fraction of rated
voltage the motor generates at full speed, 0.85.
What the model gets right
The standard brushed-motor model: the winding resistance in series with a back EMF
proportional to speed, so a motor already up to speed draws far less current than a
stalled one, and the speed chases the applied voltage with a first-order lag set by
inertia. The part presents itself to the circuit exactly as it loads a driver
(stalled it is 6 ohms pulling most of an amp off a 6 V supply, spinning it pulls a
tenth of that), so a transistor stage sees the real difference between starting and
running current.
What it does not model
No mechanical load on the shaft, no inductive kick when current stops (which is what a flyback diode across a real motor is for, and which this part will happily let you leave out with no consequence), no brush noise, no stiction.
The winding has no inductance, which is why there is no kick to clamp: the motor is a resistance in series with a back EMF and nothing else. A real gearbox motor's winding is a few millihenries, and that is the whole reason a flyback diode exists, so a circuit that would destroy a transistor on the bench runs cleanly here.
The mechanics are one first-order lag and no more. inertia is a single time
constant in milliseconds; there is no friction torque, no dead band (a very small
voltage turns the shaft very slowly rather than not at all, where a real motor sits
still until it has enough to break free), no cogging, no gear backlash and no stall
current limit other than the winding's own resistance. The five properties are round
numbers for "a small yellow gearbox motor", not a measurement of any one part.
Common mistakes
Wiring it straight to a GPIO pin expecting it to spin properly. A board pin cannot supply a motor's current, and the part's own resistance model makes that immediately visible: it barely turns, exactly as a real one would.
See it in action
Motor on a transistor is the whole lesson: one transistor, one resistor, one diode, one motor. Open it at /templates.