Track: Robots & Electronics · Lesson 5 of 10 · Ages: 7+ · Time: 35 minutes
Robots that sense and think are great, but sooner or later a robot needs to move. How does a robot with no legs get across the floor, and how does it know how to turn a corner? The answer is motors, wheels and a clever trick with speeds.
Beep says I have two wheels and a little ball at the back that rolls along for balance. I steer by changing how fast each wheel spins. Let me show you! Beep boop!
What you need
- A paper cup (or a rolled-up paper cone) and a flat table.
- A pencil and paper.
- A clear space on the floor for the walking game.
Grown-ups No wiring today. This lesson is about how movement works, so everything is a safe, no-battery experiment. Real motors draw much more electricity than an LED, so motor projects with robot kits need the right batteries and a kit’s instructions. Please do not connect motors to coin cells.
What is a motor?
A motor is a part that turns electricity into spinning. When you give a motor power, its middle part, the shaft, turns round and round. Stick a wheel on the shaft and you have a way to move. Robots use motors to drive wheels, to lift arms and to open grippers.
Two wheels are enough
Lots of robots have two drive wheels, one on the left and one on the right, each with its own motor. A third little wheel or ball, called a caster, rolls along to keep the robot from tipping over. The robot steers by changing how fast the two sides turn.
| Left wheel | Right wheel | What the robot does |
|---|---|---|
| Fast | Same fast | Goes straight |
| Slow | Fast | Curves to the left |
| Fast | Slow | Curves to the right |
| Backwards | Forwards | Spins on the spot to the left |
| Forwards | Backwards | Spins on the spot to the right |
The slower wheel is on the side the robot turns towards. The last two rows are called a tank turn, because a tank steers this way with its tracks. The robot spins on the spot without moving forward at all.
Try it with a paper cup
Safety first Stay seated at a table for this experiment. When you play the walking game later, use a clear space, with no furniture nearby, and move slowly. Keep long hair and loose sleeves away from any spinning parts on real robots and toys.
A paper cup is a cheap way to see why speed matters. Lay it on its side on a table and give it a gentle push.
It does not roll in a straight line. It rolls round in a curve! The wide end of the cup travels farther on every turn than the narrow end, so the cup curves towards its narrow end. A robot with a fast wheel on one side and a slow wheel on the other does just the same.
The walking tank turn
Now be the robot. Stand in a clear space. Your left foot is the left wheel and your right foot is the right wheel.
- To go straight, take slow steps forward with both feet.
- To tank turn left, step your right foot slowly forward and your left foot slowly backward, in tiny steps. Make a little turn on the spot.
Go slowly, and stop if you feel dizzy.
Speeds in Python
Let us teach Python to read wheel speeds. We say forward is a positive number, backward is a negative number, and a bigger number means faster.
moves = [(5, 5), (2, 5), (5, 2), (-3, 3)]
for left_speed, right_speed in moves:
if left_speed == right_speed:
print(left_speed, right_speed, "-> straight on")
elif left_speed * right_speed < 0:
print(left_speed, right_speed, "-> spins on the spot")
elif left_speed < right_speed:
print(left_speed, right_speed, "-> curves left")
else:
print(left_speed, right_speed, "-> curves right")
5 5 -> straight on 2 5 -> curves left 5 2 -> curves right -3 3 -> spins on the spot
When you multiply a negative number by a positive one, the answer is negative. That is how the program spots that one wheel goes backward and the other goes forward.
Gears: slower but stronger
A motor often spins very fast but is not very strong. Robots use gears to fix that. A gear is a wheel with teeth around the edge. When two gears touch, their teeth lock together and one turns the other. They spin in opposite directions.
- A small gear turning a big gear makes the big gear turn slower, but with more turning force. That is great for climbing hills or lifting.
- A big gear turning a small gear makes the small one turn faster, but with less turning force.
You can work out the speed by counting teeth. If a gear with 10 teeth drives a gear with 30 teeth, the small gear must turn 3 times to make the big gear turn once.
small_gear_teeth = 10
big_gear_teeth = 30
small_gear_turns = 3
big_gear_turns = small_gear_turns * small_gear_teeth // big_gear_teeth
print("Small gear turns:", small_gear_turns)
print("Big gear turns:", big_gear_turns)
Small gear turns: 3 Big gear turns: 1
The // means “divide and keep the whole number”. Three turns of 10 teeth is 30 teeth going past, and 30 teeth is exactly one turn of the 30-tooth gear.
Pixel says Bicycles use gears too! Low gears are for hills, where you want lots of force and not much speed. Meow!
Did you know? Some robots have no wheels at all. They can walk on legs, swim, fly with propellers or slither like snakes.
Challenges
Try it In the speeds program, add the move (4, -4) to the end of the list. What does the robot do?
Show the answer
The left wheel goes forward (4) and the right wheel goes backward (-4). Their speeds multiply to a negative number, so the program says the robot spins on the spot. It is a tank turn to the right.
moves = [(5, 5), (2, 5), (5, 2), (-3, 3), (4, -4)]
for left_speed, right_speed in moves:
if left_speed == right_speed:
print(left_speed, right_speed, "-> straight on")
elif left_speed * right_speed < 0:
print(left_speed, right_speed, "-> spins on the spot")
elif left_speed < right_speed:
print(left_speed, right_speed, "-> curves left")
else:
print(left_speed, right_speed, "-> curves right")
Try it A gear with 8 teeth drives a gear with 24 teeth. If the small gear turns 6 times, how many times does the big gear turn?
Show the answer
The big gear has 3 times as many teeth as the small one, so it turns 3 times slower. 6 turns of the small gear is 6 ÷ 3 = 2 turns of the big gear.
What you learned
- A motor turns electricity into spinning, and a wheel on its shaft makes a robot move.
- A robot with two drive wheels steers by spinning them at different speeds.
- A tank turn (one wheel forwards, one backwards) spins the robot on the spot.
- Gears can trade speed for strength: a small gear driving a big gear makes it slower but stronger.
