25 min

The machine itself: how electricity becomes motion

A servo is a motor, a gearbox, an encoder and a small controller in one sealed box, and the only thing you are allowed to ask it for is an angle.

Where you are. You can describe a robot as a sense-decide-act loop and name the parts of an arm. This lesson opens the actuator, so that “act” stops being a black box.

Drive a screw two ways

Take a cordless drill and put a screw into soft pine.

Set the numbered collar low. Four, say. The screw goes in, the head seats against the wood, and then the drill starts rattling and the bit stops turning. Lean on it harder. It keeps rattling. It will not drive that screw one turn further, no matter how annoyed you get.

Now turn the collar past the numbers to the drill symbol and do it again. The screw seats, then keeps going. It sinks below the surface, the wood around the head crushes, and if you hold on, either the head strips out or the drill twists hard in your wrist.

Same motor, same battery, same hand. The only difference is a small clutch deciding how much twist to allow before it gives up.

That collar is the whole lesson. It is also why your robot arm will break an egg.

The idea in one paragraph

An electric motor turns current into twist. Raw motors are fast and weak, so nearly every robot joint bolts a gearbox behind the motor to trade speed away for strength, and that trade quietly costs you precision, efficiency and feel. An encoder measures the angle that comes out the far end. Put those three in one housing with a small controller and you have a servo: a sealed box you send an angle to. Which is where the trouble starts. A box that accepts angles applies whatever force it takes to reach the angle you asked for, because you never gave it any way to hear “but not that hard.” The drill symbol is position control. The collar on 4 is torque control. Almost everything separating a careful robot from a destructive one lives in that difference.

Electricity in, twist out

Run current through a wire sitting in a magnetic field and the wire gets pushed sideways. Wind that wire into coils around a shaft, ring the coils with magnets, and keep switching which coil is energised as the shaft turns, so the push always points the same way round. Sideways force becomes rotation. Every electric motor is that one trick at a different size.

Two relationships explain most motor behaviour.

Torque is current. Double the current and you roughly double the twist. Not the speed; the twist. When a system “commands torque”, what the electronics actually regulate is current.

Speed is voltage. A spinning motor generates a voltage of its own that opposes the supply and grows with speed. It accelerates until that opposing voltage nearly cancels the supply, and settles there. So voltage roughly sets the speed, and the load decides how much current gets drawn to hold it.

Fast and weak

Take the motor out of a hobby servo and power it on its own. It spins at thousands of revolutions per minute, and you can stop it with two fingers. That is the wrong shape for a robot joint, which wants a great deal of twist at well under one revolution per second.

A gearbox fixes the shape. At a reduction ratio of NN the output turns NN times slower and can deliver up to NN times more torque. Power is roughly conserved; you are trading one axis for the other. Hobby-class robot servos run a few hundred to one, which is what lets that same motor hold up an arm.

None of it is free. Here is the bill.

The costWhat it isWhere you feel it
BacklashGear teeth need clearance to mesh, so the output lags the input at every reversalThe first fraction of a degree after a reversal turns the motor and not the joint, so arriving at a point from the left lands somewhere slightly different from arriving from the right.
FrictionEvery tooth mesh rubs, and the losses compound through the stagesSmall commands do nothing at all, then the joint sticks and jumps. Efficiency at high ratios is often well under half.
Reflected inertiaSeen from the output side, the motor’s own rotor inertia is multiplied by N2N^2At 300:1 a tiny rotor feels like a flywheel. The joint fights sudden movement even unpowered.
Lost backdrivabilityFriction and inertia referred to the output grow too large to push back throughThe arm can push the world. The world cannot push the arm.

Knowing where it ended up

An encoder reports a shaft’s angle. Optical ones shine light through a slotted disc and count the flashes. Magnetic ones put a small magnet on the shaft and a chip beside it that measures which way the field points; cheaper, dust-tolerant, and what sits inside small robot servos.

The distinction that bites is incremental versus absolute. An incremental encoder counts change: it knows you moved 412 steps, not where you are. At power-up it knows nothing, so the robot must “home” itself against a switch or a hard stop first. An absolute encoder reports the angle itself, correct the instant it powers on. A 12-bit absolute encoder splits a turn into 4096 steps, about 0.088 degrees each.

Where the encoder sits matters more than how fine it is. On the motor shaft, ahead of a 300:1 gearbox, one motor step is a three-hundredth of a joint step: enormous apparent resolution, on a reading of the motor. Backlash, flex and wind-up under load all happen between that reading and the truth. An output-shaft encoder is coarser and honest. Expensive arms fit both and compare.

The package

Put a motor, a gearbox, an encoder and a small controller in one housing and you have a servo.

target angle, from your code Controller compares target against measured Motor current in, torque out Gearbox slower, stronger a few hundred to one The joint and whatever it carries Encoder reads the angle reached measured angle · the inner loop closes here Inside one servo
Inside one servo: a controller drives a motor through a gearbox to the joint, while an encoder feeds the angle reached back to the controller, closing the position loop inside the box

Wider than the screen; scroll it sideways.

The loop closes inside the box. You send an angle down a wire. A controller you did not write, running far faster than your code, compares that angle against the encoder and pushes current into the motor until the difference disappears. Your code lives outside the box and never sees the current.

The two things you can command

These are not two settings of one idea. They are two different contracts about what the actuator guarantees and what it leaves to the world.

Position control you command an angle where it stops commanded angle force climbs, no limit the error never closes, so the current keeps rising until something yields: the object, the arm or the servo Torque control you command a force wherever contact allows force = your command the arm pushes exactly as hard as you allowed and stops there; the angle is an outcome, not a command
Position control against an obstacle: the commanded angle sits inside the obstacle, so the force climbs without limit. Torque control against the same obstacle: the arm pushes with the commanded force and stops wherever contact allows

Wider than the screen; scroll it sideways.

In free space, position control is wonderful. It is precise, it needs nothing but an encoder, and it hides gravity, friction and payload from you completely. Send angles, get angles. The whole hobby robotics ecosystem is built on it. The moment the arm touches something, the contract turns against you.

Torque control changes the contract. You command current, which is torque, which is force at the end of the arm. Ask for a small force and a small force is what the world gets, wherever the arm ends up. Position becomes an outcome rather than a command. That is what makes wiping a surface, inserting a peg, holding an egg and being safe to stand next to all possible.

Position controlTorque control
You sendan anglea current, which is a torque
The servo guaranteesthe angle, eventuallythe force, right now
In free spaceprecise and easyneeds gravity and friction compensated for
On contactforce is unboundedforce is exactly what you asked for
What it costsan encoderlow friction and a low ratio, or a torque sensor

So why does not everything do torque control? Because the gearbox is in the way. You would like to infer output torque from motor current, but a few-hundred-to-one gearbox adds friction and reflected inertia that are large, nonlinear and temperature-dependent, and they swamp the signal. Three answers exist, all expensive.

  • Use a small ratio. Single-digit reductions keep the motor honestly connected to the joint, so current really does mean torque. This is the approach behind the MIT Cheetah legged robots, whose actuators run single-stage reductions under 8:1; the price is a large, costly motor, and torque you know to roughly 10% rather than exactly.
  • Measure torque directly. A torque sensor in every joint, usually a strain-gauge bridge on a flexure. Research arms such as the Franka and the KUKA iiwa do this, and it is much of why they cost what they cost.
  • Add a spring on purpose. A series elastic actuator, proposed at MIT in 1995, puts a known spring between gearbox and output; measure its deflection and you have measured the force. You trade bandwidth for an honest force signal.

Check yourself

1. Why does nearly every robot joint have a gearbox, and what do you pay for it?

A raw motor has the wrong shape: thousands of rpm and very little torque, where a joint wants lots of torque under one revolution per second. A reduction of NN divides speed by NN and multiplies torque by up to NN. You pay in backlash, friction, reflected inertia multiplied by N2N^2, and lost backdrivability: the arm can push the world, but the world cannot push the arm.

2. A servo holds an arm out horizontally. It draws current and does not move. Where is the power going?

Into heat. Mechanical power is torque times speed, and the speed is zero, so none of the electrical power leaves as mechanical work; it all dissipates in the windings. This is stall, it is the normal way to kill a hobby servo, and it is why supporting a held pose mechanically beats holding it electrically.

3. An encoder on the motor shaft, ahead of a 300:1 gearbox, has 300 times the effective resolution at the joint. Why is that not the whole story?

It measures the motor, not the joint. Backlash, gearbox flex and wind-up under load all sit between the reading and the real joint angle, and none of them show up in it. You get fine resolution on a quantity that is systematically wrong, and differently wrong depending on direction and load. Output-side encoders are coarser and honest.

4. You command a position-controlled servo to 90 degrees. A block stops the arm at 60. Trace what happens inside the box.

The controller sees 30 degrees of error and raises current. Torque rises, contact force rises, and the error does not shrink because the block is not moving, so current rises further. It continues until something gives: the block breaks, the gear teeth strip, or the servo’s current or temperature limit trips. There is no force budget in the interface, so there is no stable resting state here.

5. Why can you not get real torque control on a highly geared servo just by measuring motor current?

The gearbox sits between the current you can measure and the torque you care about. Its friction is large, nonlinear and varies with temperature, load and direction, and its reflected inertia scales with N2N^2, so at a few hundred to one those effects dominate the output torque rather than modulate it. The fixes are a low ratio, a joint torque sensor, or a spring whose deflection you measure.

6. Which drill collar setting is position control, which is torque control, and which one is your arm?

The drill symbol, with the clutch disengaged, is position control: apply whatever twist it takes, up to destruction. A low number is torque control: apply twist up to this limit, then stop. Your SO-101 is the drill symbol. Its torque-limit register is the nearest thing to the collar, and it is a cap rather than a commanded force.

Do this

Three things, about twenty minutes.

1. Feel it. If you own a cordless drill, drive a screw into scrap wood with the collar low, then again on the drill symbol. Stop before you strip anything. That sensation is the position-versus-torque distinction, and it is worth having in your hands.

2. Find backlash. Grab the output of any geared thing: a hand mixer’s beater, a manual can opener, the steering wheel of an older car. Rock it gently without driving it through. The dead arc before resistance appears is backlash. Now picture a controller trying to hold a position in the middle of that arc.

3. Do the arithmetic. Plausible numbers for a small servo motor, not any specific part:

motor_rpm    = 9000    # no-load speed of a small brushed motor
motor_torque = 0.020   # N-m it can produce near stall
ratio        = 300
efficiency   = 0.6     # a few hundred to one is a lossy place to live

out_rpm    = motor_rpm / ratio
out_torque = motor_torque * ratio * efficiency

print(f"joint: {out_rpm:.0f} rpm, {out_torque:.2f} N-m")
print(f"quarter turn takes {0.25 / (out_rpm / 60):.2f} s")
print(f"rotor feels {ratio ** 2:,}x heavier from the joint side")

Run it, then set ratio = 150 and run it again. Write one sentence each on what happened to torque, to speed, to reflected inertia, and to how easily you could push the joint by hand. Those four sentences are the gearbox trade, and you will read it off a real parts list in Module 4, where the follower’s six joints and the leader’s three different reductions are that trade made for you.

What you can now do

You can open a servo in your head and name every part: the motor turning current into torque, the gearbox trading speed for strength while charging you backlash and friction, the encoder reporting the angle reached, and the controller closing a loop you never wrote. You can explain why a stalled servo runs hot, why an encoder ahead of a gearbox tells a fine-grained lie, and why commanding an angle is safe in free space and dangerous on contact.

What you can now do

You can open up a servo, name what each part does and what it costs, and explain why position control makes contact dangerous while torque control makes it gentle.