Parts

DC motor

A small brushed DC motor, the yellow gearbox kind: two terminals, and nothing driving it.

This part has a page of its own, with a note on using it and a circuit to try: the part page.

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.

Models

model picks a motor by name, or custom (the default) for the settings above. A named motor sets the rated voltage, its free speed there, and the resistance and back EMF that make it draw its maker's stall and free-running currents:

Model Rated Free speed Free current Stall current
TT 1:48 (the yellow gear motor, also sold as a BO motor) 6 V 250 rpm 160 mA 1.5 A
TT 1:90 (metal gears) 6 V 120 rpm 100 mA 1.0 A
N20 100:1 (Pololu 100:1 HP) 6 V 310 rpm 100 mA 1.6 A
N20 50:1 LP 6 V 270 rpm 40 mA 0.36 A
FA-130 3 V 12300 rpm 150 mA 2.1 A
130 6V 6 V 11500 rpm 70 mA 0.8 A

inertia stays yours. Unbranded N20 motors vary more than these Pololu ones, and a 775 motor's listings disagree too much to model one.

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.

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 lag and a friction. inertia is a single time constant in milliseconds. The friction is the free-running current ((1 - back_emf) of the rated voltage over the winding, 150 mA for the defaults), taken as a constant torque against the motion, so half the rated voltage gives rather less than half the speed (41% for the defaults), and from rest the motor does not start until the stalled current is one and a half times that: 1.35 V across the default motor. On a 5 V PWM through an H bridge, analogWrite below about 70 hums and does not turn, which is the dead band every robot sketch's minimum speed is there for. Let go of a terminal and it coasts on friction alone, most of a second from full speed; short the two together (an H bridge's brake) and the back EMF stops it in a fraction of that. The friction figure and the 1.5 are assumptions, not datasheet numbers. There is no cogging, no gear backlash, no load 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.

The Arduino DC motor guide walks through that circuit: the wiring, the PWM sketch, and the duty below which the shaft will not start.