Find a course

Module 3: Motors and MovementLesson 5 of 1012 min

Motors and Gears

Compare DC motors, servo motors and stepper motors, and learn how gear ratios trade speed for torque so a small motor can move a heavy robot.

Step 1 of 12Learn

Too fast to be useful

Sam builds his first robot car with a small DC motor straight from a kit and wires it directly to the wheels. He switches it on and the wheels scream around at thousands of revolutions per minute, but when he sets the car on the carpet, it barely moves and the motor stalls. Sam's motor isn't broken. It's just fast and weak, like trying to ride a bike up a steep hill in the highest gear.

Motors are a robot's muscles. They turn electrical energy into motion, and they come in three main types for small robots.

DC motors spin continuously when you apply voltage; reverse the voltage and they spin the other way. They're cheap and simple, and their speed rises with voltage. On their own they spin very fast with little twisting force, so they're almost always paired with a gearbox. They don't know their own position unless you add an encoder.

Servo motors contain a DC motor, a gearbox, a position sensor and a control circuit in one box. You send a signal that says "go to 90 degrees," and the servo moves there and holds. Standard hobby servos turn through about 180 degrees, perfect for steering, grippers and robot arm joints.

Stepper motors move in precise, fixed steps. A common type takes 200 steps per revolution, 1.8 degrees each. Send 50 steps and it turns exactly a quarter turn. 3D printers use steppers to position the print head accurately without needing a sensor.

Step 2 of 12Practice · Match the pairs

Match each robot job to the best motor type.

Tap an answer, then tap the place where it belongs (or drag it there).

  1. Spinning the drive wheels of a fast robot car
  2. Opening and closing a gripper to a set angle
  3. Moving a 3D printer head in exact small increments
  4. Spinning a fan or pump continuously at varying speeds

Step 3 of 12Compare

Three motor types

AspectDC motorServo motorStepper motor
What it does bestSpins fast and continuouslyMoves to and holds an angleMoves in exact small steps
ControlSpeed set by PWMAngle set by a pulse signalDriver sends step pulses
Built-in feedbackNone (add an encoder)Yes, insideNone, but steps are precise
Typical useDrive wheels, fansGrippers, steering3D printers, camera sliders

Step 4 of 12Learn

Speed vs. torque

Two numbers describe what a motor can do:

  • Speed, usually in revolutions per minute (RPM).
  • Torque, the twisting force it can apply, measured in newton-meters (N·m) or, for small motors, in kilogram-centimeters (kg·cm). A torque of 2 kg·cm means the motor can hold up a 2 kg weight hanging from a 1 cm arm, or 1 kg from a 2 cm arm.

A motor's power is related to speed × torque, and a given motor can only deliver so much power. So you can't have unlimited speed and unlimited torque at once. Gears let you trade one for the other.

When a small gear (the driver, attached to the motor) turns a larger gear (the driven gear, attached to the wheel), the larger gear turns more slowly but with more torque. The gear ratio is:

gear ratio = teeth on driven gear ÷ teeth on driver gear

With a 10-tooth gear driving a 50-tooth gear, the ratio is 50 ÷ 10 = 5:1. The output turns 5 times slower and, ignoring friction losses, with 5 times more torque. Sam's motor spinning at 6,000 RPM through a 50:1 gearbox gives 120 RPM at the wheel, with 50 times the torque (a bit less in reality, since gears lose some energy to friction). Now the car can climb onto the carpet.

Gear the other way (large driving small) and you get more speed and less torque, as on a bicycle's high gear.

Step 5 of 12Try the calculator

Gear ratio calculator

Enter the teeth on each gear and the motor's speed and torque. Real gearboxes lose some torque to friction, so treat the output torque as an upper limit.

Gear ratio
5
Output speed
1,200 RPM
Output torque (ideal)
0.5 kg·cm

Step 6 of 12Practice · Work it out

A 12-tooth gear on a motor drives a 36-tooth gear on a wheel. The motor spins at 300 RPM. How fast does the wheel turn, in RPM?

Step 7 of 12Explore

Gearing trades speed for torque

Slide the gear ratio. The curve shows wheel speed for every ratio; the readouts show speed and torque at the ratio you chose.

2,0004,0006,000 20406080100
Wheel speed
125 RPM
Wheel torque (ideal)
14.4 kg·cm

Step 8 of 12Learn

Controlling motors

A microcontroller controls a DC motor through a motor driver, often a circuit called an H-bridge. It has four electronic switches arranged like the letter H around the motor. Closing one diagonal pair sends current one way, and the motor spins forward; closing the other pair reverses it. Opening all switches lets the motor coast.

To control speed, controllers use pulse-width modulation (PWM): switching the power on and off very rapidly, thousands of times a second. The fraction of time it's on is the duty cycle. At 100% duty cycle the motor gets full power; at 50% it gets roughly half the average voltage and runs slower; at 0% it stops. The motor's inertia smooths out the pulses so it turns steadily.

Servos use a different signal. Every 20 milliseconds, the controller sends a pulse, typically about 1 to 2 milliseconds long. A 1.5 ms pulse usually means the middle position, about 90 degrees; shorter pulses move toward 0 degrees and longer ones toward 180. Exact values vary by servo, so builders test the real range of each one.

Steppers need a special driver that energizes their coils in sequence. Each pulse from the controller advances the motor one step, so the number of pulses sets the angle and the pulse rate sets the speed.

Step 9 of 12Note

Step 10 of 12Practice · Choose one

A motor driver sends power to a DC motor in rapid pulses that are on 25% of the time. What happens compared with full power?

Step 11 of 12Chart

PWM: duty cycle sets the average voltage

With a 6 V battery, switching the power on for a bigger share of each pulse raises the average voltage the motor feels.

PWM: duty cycle sets the average voltageBar chart with 5 categories: 0%: 0 V; 25%: 1.5 V; 50%: 3 V; 75%: 4.5 V; 100%: 6 V.0 V2 V4 V6 V0%25%50%75%100%Duty cycle0 V1.5 V3 V4.5 V6 V
Ideal values; real motors also lose a little to friction and the driver.
PWM: duty cycle sets the average voltage
Duty cycleAverage voltage
0%0 V
25%1.5 V
50%3 V
75%4.5 V
100%6 V

Step 12 of 12Practice · True or false

A stepper motor with 200 steps per revolution turns 1.8 degrees per step.