How a Motor Works
Easydifficulty
PID, feedforward, and motion profiling all answer the same question in the end: what voltage should the motor get right now? It's worth knowing what the motor does with that voltage first, so this lesson starts with the hardware.
The mechanism that's fast empty and useless under load
A team gears a lift for a lot of speed. With nothing on it, it races to the top. Hang a game element on it and it slows almost to a stop, gets too hot to touch, and two matches later causes a brownout (a voltage drop that resets the robot) halfway up. Nothing is broken. The motor is doing what motors do.
The team assumed voltage sets speed. It doesn't, quite. A motor trades speed for torque, draws more current the harder you load it, and turns the difference into heat. Picking a gear ratio, choosing a controller, and reading a current spike all depend on understanding why.
Bicycle gears on a hill. In your highest gear you fly along on flat ground but slow to a stop the moment the road tilts up — and your legs burn doing it. Drop to a low gear and you climb easily, just slowly. The pedals (the motor) didn't change; the load did. There is no gear that is fast and strong at once.
Build it from the parts up
What's inside
Take a brushed DC motor apart and you find six parts that together turn electric current into a
twisting force on a shaft.
- Magnets (the stator). Permanent magnets line the inside of the housing and never move. They set up a fixed magnetic field across the middle of the motor. The stator is the part that stays still.
- Armature (the rotor). An iron core wrapped in copper coils, mounted on the shaft. When current flows through the coils inside the magnets' field, each wire gets pushed sideways, and because the coils are arranged around the shaft, those pushes add up to rotation. The rotor is the part that spins.
- Commutator. A copper ring split into segments, riding on the shaft. As the rotor spins it swaps which coil the current flows through, so the push is always in the direction that keeps it turning. A motor without this would just twitch to one position and stop.
- Brushes. Two spring-loaded carbon blocks pressed against the commutator. They feed current into the spinning rotor by rubbing against it, which is where the name comes from, and why they wear out.
- Housing, bearings, shaft. The steel can holds the magnets and closes the magnetic loop; the bearings let the shaft spin freely; the shaft carries the torque out to your gearbox.
Here are the same parts in a permanent-magnet DC motor that has been cut in half lengthwise, with the
cut faces painted red: A DC motor cut in half. Left to right: the output shaft and its
bearing, then the armature — copper windings threaded through a laminated iron core — then the
segmented copper commutator with the brushes pressed against it, all inside the steel housing whose
dark inner arcs are the permanent magnets. The nameplate reads
Perm.-Magn.-Mot., so the field here comes from magnets rather than a wound coil, exactly like
the motors on your robot. (The extra assembly on the far right is a tachometer, not part of the motor.)
Photo by Oliver
Wallscheid, CC BY 4.0.
Following the current: it comes in the leads, through a brush, across the commutator, and into a rotor
coil, where the magnets' field turns it into a force. As the shaft turns, the commutator switches to
the next coil so the force keeps pushing the same way. Jared Owen animates the same teardown in 3D. The commutator is much easier to understand when you can
watch it switch coils.
Brushed vs. brushless
Brushes and a commutator work, but carbon rubbing on copper wears out, sparks, and adds friction.
Brushless motors make torque the same way, but they turn the motor inside out and switch the current
electronically.
| Brushed | Brushless | |
|---|---|---|
| What spins | the windings (rotor) | the magnets (rotor) |
| What's fixed | the magnets | the windings (stator) |
| Switching ("commutation") | mechanical — brushes + commutator | electronic — a controller (ESC) energizes coils in turn |
| Trade-offs | cheap, simple to drive; brushes wear & spark | efficient, long-lived, more torque/size; needs a smart controller |
The goBILDA Yellow Jacket, REV HD Hex, and friends are all brushed DC motors — the Control Hub just sets a voltage across two leads, no fancy controller required. So the rest of this module assumes the brushed model. (Brushless is common in FRC and on hobby drones, where the controller lives in the speed controller.)
The two effects that make it a motor
Almost everything the motor does comes from two effects.
Torque comes from current. Current , in amps, is how much charge flows through the coils each second. A wire carrying current through a magnetic field gets pushed sideways, and added up around the rotor, those pushes become a twisting force, the torque , in newton-metres. Double the current and you double the torque:
, the torque constant, is how many newton-metres you get per amp. It depends on the magnets and the number of turns of wire. Since torque is proportional to current, controlling current means controlling torque, which is what current control below relies on.
Speed creates a voltage that pushes back. A spinning motor is also a generator. As the coils sweep through the magnets' field they produce their own voltage, and it points against the supply. This is the back-EMF. It grows with the shaft speed , measured in radians per second (one turn is rad, so ):
torque τ = kt·I · back-EMF V_emf = ke·ω
, the back-EMF constant, is volts per rad/s. It comes from the same magnets and windings as , and in SI units the two are the same number. The faster the motor spins, the more of the supply its back-EMF cancels, and the less is left to push current. That's why a motor stops speeding up.
Putting them together. Go around the circuit. The voltage you apply has two jobs: push current through the resistance of the windings, and overcome the back-EMF:
That equation is the whole electrical model of the motor, and the torque–speed curve comes straight out of it.
The torque–speed line
Solve the voltage equation for current, then turn current into torque with :
It's a straight line: the most torque at zero speed and no torque at top speed. In the demo, set the voltage and the load, and the green dot shows where the motor settles, which is where its line meets the load. Watch the current, efficiency, and heat as you push toward stall. (The demo only covers positive voltage and forward rotation. Braking and running backwards aren't modeled.)
The two ends of the line are usually the only points a datasheet lists:
| Operating point | Speed | Torque | Current | What's happening |
|---|---|---|---|---|
| Stall () | 0 | max, 0.19 N·m | max, 11 A | no back-EMF, so current — and heat — peak |
| Free run (external load ) | max, 5900 RPM | load torque ≈ 0 | ≈ 0.3 A | back-EMF nearly cancels the supply; the small current covers internal friction |
Two things follow from the algebra. First, changing the voltage slides the line without tilting it.
Stall torque and free speed both scale with , but the slope doesn't contain . Setting
power to 0.5 applies about half the voltage and moves the motor onto a lower, parallel line. (The
faint line in the demo is full 12 V.)
Second, the motor puts out the most power at half its free speed. Output power is zero at both ends of the line, so it peaks in the middle. For this motor that's 29 W at about 2950 RPM, half of 5900.
out P = τ·ω · in P = V·I · heat P = I²·R
The demo is the real goBILDA 5000-0002-0117 (MATRIX) motor at 12 V: free speed 5900 RPM, stall torque 0.19 N·m, stall current 11 A, free current ≈ 0.3 A, peak 29 W. From those three published numbers you get the constants: , N·m/A, and V·s/rad. These are endpoint estimates: free current and internal friction mean and will not match perfectly even though, in ideal SI motor units, they describe the same electromechanical coupling. (Data: gm0's motor guide.)
Working out one operating point
Say this motor runs at 12 V against a steady 0.05 N·m load at its shaft. Where does it settle?
The current it pulls, and the power bookkeeping:
If you add it up, it doesn't quite balance: , about short of the going in. That isn't an arithmetic mistake. An ideal motor has exactly, but these constants were estimated from the two ends of the datasheet, and friction lowers the measured free speed enough that they come out 11% apart. The missing 3 W is roughly that friction, so the 66% efficiency includes a loss the simple model doesn't have a term for.
Notice that heat is . It grows with the square of the current, which is why a stalled motor heats up so fast.
This is a healthy operating point: fast, efficient, and a modest current. Now raise the load to stall, 0.19 N·m. Speed drops to zero, current climbs to 11 A, output power falls to zero, and all 130 W going in becomes heat. That's the lift that works fine empty. Set the demo's load slider to 0.05 and then 0.19 to see these numbers.
Feedback and current control
You never command torque or current directly. You command voltage. The Control Hub does it with PWM,
switching 12 V on and off very quickly, so setPower(0.5) gives about 6 V on average. There are three
levels of control built on the model above:
- Open loop —
setPower. You pick a voltage and live with wherever the load puts you on the line. Simple, but speed sags with load and the battery. - Velocity feedback,
RUN_USING_ENCODER. A loop measures speed and adjusts the voltage to hold a target as the load changes. It still can't go faster than free speed or push harder than stall. - Torque or current control. Since , commanding a current is the same as commanding a torque. Rearranging the voltage equation, the voltage that drives a chosen current at the present speed is:
Read from the encoder, predict the back-EMF, add enough voltage to push the current you want through , and send it. Strictly speaking this is open-loop current control, a current feedforward. It trusts and and never checks the actual current, so any model error, like the higher resistance of a warm motor, shows up directly as current error.
Closed-loop current control measures the current every loop (getCurrent()) and runs feedback on
the error. Dedicated motor controllers do this internally. The FTC hub doesn't offer a fast current
loop, so the model-based version is what you can do, optionally backed up by the measured-current
limiter further down.
Limiting current this way is how good drivetrains avoid wheel slip, keep motors from overheating, and survive defense. In a pushing match the wheels are stalled (), so full power draws about , tens of amps, and can trip the breaker. A current limit lowers the voltage to whatever gives a safe current.
comes back in several later lessons. Feedforward solves it for the voltage a target speed needs, and its , , terms come from it. System identification measures those lumped gains on your mechanism. (Measuring , , and separately takes electrical and dynamometer tests.) Current control solves it for the voltage that gives a target torque.
Gearing, current limits, and code
A gearbox moves the useful part of the curve to where your mechanism needs it. A reduction divides output speed by and multiplies output torque by , minus losses:
output speed = ω_free / G · output torque = τ_stall · G · η
// The three numbers every brushed DC motor publishes at 12 V.
double freeSpeedRpm; // RPM with nothing attached
double stallTorqueNm; // torque at zero speed
double stallCurrentA; // current at zero speed: this is your heat budget
// A reduction G, with efficiency eta.
double gearedFreeSpeed = freeSpeedRpm / G; // speed divides DOWN
double gearedStallTorque = stallTorqueNm * G * eta; // torque multiplies UP
Speed divides by The output turns times slower with times the torque, so the product, power, stays the same in
an ideal gearbox. Real gears lose some to friction, and G and torque multiplies by it. Speed times torque is power, and gears can't create
power, so why does this work? And what is eta doing in the second line?Show solution
eta accounts for that. It's typically 0.8 to
0.95 per stage and it multiplies, so a three-stage gearbox can end up under 0.7. The lost power becomes
heat in the gearbox.
One of the three datasheet numbers doesn't change with Stall current. Gears change speed and torque at the output, but the motor still draws what it draws.
Stall current depends on the winding resistance and the battery voltage, not on what's bolted to the
shaft. That's how a heavily geared mechanism can overheat a motor while barely moving: the output is
slow and strong, and the current is just as high as an ungeared stall.G. Which one, and why does that matter for a
heavily geared mechanism?Show solution
At runtime, a motor sitting near stall is the fastest way to overheat something and brown out the robot. The hub can read current, so you can guard against it, or command current directly with the model:
// OPEN loop. Never reads actual current.
void setCurrent(DcMotorEx motor, double targetAmps) {
double omega = motor.getVelocity(AngleUnit.RADIANS);
double vCmd = KE * omega + targetAmps * R; // back-EMF, plus I*R
motor.setPower(vCmd / batteryVoltage());
}
The middle line is solved for , so it's only as accurate as your KE and R. It
sends the voltage that should produce targetAmps and never checks. To actually close the loop, run a
controller on measured current, or at least cap it:
// CLOSED loop. This one reads the sensor.
void driveSafely(DcMotorEx motor, double command, double maxAmps) {
double current = motor.getCurrent(CurrentUnit.AMPS);
if (current > maxAmps) {
command *= maxAmps / current; // scale back proportionally
}
motor.setPower(command);
}
A spinning motor makes a back-EMF proportional to its speed, and the applied voltage has to overcome
that and also push current through the winding resistance. Write that as an equation and solve for . The back-EMF opposes the applied voltage, and what's left drives current through the
resistance: , so . At stall and the whole battery
voltage goes into , which is why stall current is and why stalling mostly makes heat.Show solution
Why is the correction a ratio instead of a fixed step down? At 1.5 times the budget, how much of the
command is left? And what does the limiter do when the current is well under budget? At 1.5 times the budget, It only lands exactly on the budget at stall, which is the case it's mostly for: a pushing match, where
, there's no back-EMF, and current really is proportional to voltage. At speed it
undershoots, because has an offset. Scaling by gives On this lesson's motor at , a command scaled by 0.67 lands near
against a cap, about half the budget. Being low is the safe way to be
wrong, but the limiter will hunt: next loop the current reads under the cap, the full command comes
back, and it cuts again. A better version runs feedback on the measured current instead.Show solution
maxAmps / current is 0.67, so two-thirds of the command is left. A fixed step
would take more loops for a big overshoot than a small one. The ratio scales with how far over you are.
Under budget it does nothing, because it has a ceiling but no target. That makes it a safety net, not a
controller.
A motor held near stall draws stall current the whole time, and almost all of it becomes heat. That can damage the windings and pull the battery down until the hub browns out. Don't gear a mechanism so its normal load sits near stall, and don't hold a pushing match at full power. Limit the current instead.
In practice: take your motor's three datasheet numbers, pick so the mechanism's normal load sits in the fast, efficient part of the line rather than near stall, and limit current so a jam can't overheat anything. The next lesson, Voltage Compensation, deals with the fact that the battery voltage feeding all of this isn't constant.
Real motors have friction (so free current isn't zero and free speed is a little lower), winding inductance, and gearbox losses, so the straight line is slightly curved. It's still close enough to design with. Measuring the real constants for your motor is covered in system identification.
- Motor data: goBILDA 5000-0002-0117 (MATRIX) 12 V curve and the FTC motor table, from gm0 · Motor Power.
- Torque / current control: Vikramaditya Nishant, Introducing Torque-Current Control for FTC (Medium), for the current-command and the current-limiting-during-defense argument.
- Cutaway photograph: Oliver Wallscheid, DC motor with permanent magnet excitation (Wikimedia Commons), CC BY 4.0. Resized and flattened onto white; not otherwise altered.