Basic
Follow the black line from the start box to Home. Stop fully inside Home.

Quick Learn — the model, the instructions, the program and the challenges. The theory is in Full Lesson.
EV3 Robotics›Other Lessons›Tank Bot
Other Lessons · EV3-OTH-5460 minutes · Ages 7+ · Model: Tank Bot
The Tank Bot: a low, heavy robot on two rubber tracks. A Gyro Sensor is fixed flat to its body.
It has no steering. To turn, it runs one track forward and the other back. Every machine on tracks does this. It is dragging itself round sideways. This is called skid steering. It is why this model needs the Gyro.
By the end, the Tank Bot will drive round a square, a pentagon or a hexagon. It turns to a real angle each time. Then it comes back to where it started.
A digger on a building site sits on two steel tracks. To turn round, it drives one track forward and one back. The tracks scrape sideways across the ground.

Tracks spread the weight over a big area. So the digger does not sink into mud. But it cannot steer like a car. There are no wheels to point.
Here is the part that matters today. A skid-steer turn depends on the ground. On wet mud, the tracks slide and the machine hardly turns. On dry stones, they grip. Then it spins round fast. The same track movement gives a different angle. The driver fixes it by eye every time.
Some big machines must be exact. They use a gyroscope, not an eye. A phone knows which way you have turned it. A plane keeps flying the right way inside a cloud. A mining digger digs along an exact line. They all use the same kind of chip as your robot.
Count track rotations, and your square works on your test table. But on the mat it comes out a wonky shape with four sides. Nothing in the program changed. The floor did.
Asking for a turn is not the same as getting one. Only a sensor knows the difference.
Every turn you have programmed so far has been open-loop. You tell the motors what to do. Then you hope. But wheels and tracks can slip, like the Rickshaw’s in Lesson 42. So hoping does not always work.
[2 v] reset angle :: sensors start moving [straight: 100] at (25) % speed :: movement wait until <([2 v] angle :: sensors) > (85)> stop moving :: movement
Three things do the real work in those four blocks.
The Gyro counts all the turning since its last reset. Keep turning right, and it goes 90, 180, 270, 360, 450. Say you do not reset it. Then the second turn of a square must wait for 180. The third must wait for 270. You have to do sums.
Reset it, and every turn is measured from zero. Then every turn waits for the same number. That is easier to read. It is much easier to change, too.
This is the Minesweeper’s idea from Lesson 44 again. start moving [straight: 100] does not wait. So the next block can watch the Gyro while the tracks turn. A move for block would stop the program looking for the whole turn.
A robot does not stop the moment you tell it to. The Gyro reads 85. But the tracks take a moment to stop. All that time, the Tank Bot keeps turning. A few degrees at 25% speed. A lot more at 75%. That extra is called overshoot.
| You want | Turn speed | Number to wait for |
|---|---|---|
| 90° | 25% | about 85 |
| 90° | 50% | about 78 — and less the same each time |
| 90° | 75% | don’t. The overshoot is too big to turn accurately |
Those numbers are a place to start. They are not the answer. Your robot’s weight, tracks and floor all change them. That is why section 10 asks you to measure, not copy a list.
The robot must be completely still when the angle is reset. Reset a Gyro while it moves, and it starts wrong. It stays wrong. Worse, it drifts. It gets more wrong the longer the program runs. Are your turns wrong by more and more each time? This is why.
The Gyro Sensor measures how far the robot has turned, in degrees. Wheels slip and floors vary, so counting wheel rotations is a poor way to turn accurately — the gyro measures the turn itself rather than inferring it.
| Block | What it does |
|---|---|
([2 v] angle :: sensors) | Reports how far the robot has turned since the angle was last reset. |
[2 v] reset angle :: sensors | Sets the current heading as zero. |
The angle is measured from wherever it was last zeroed — not from where this turn started. Here are two robots given the same instruction, one with a reset block and one without.
reset first
no reset
Both programs are correct about what they asked for. Only the left one asked the question from a known starting point.
Both programs did exactly what they said. Both gyros stopped at 90. But the robot on the right had 34 degrees already on the clock, so it only turned 55 — and nothing about the program looks wrong. Watch the first step too: neither robot is moving and the reading is still climbing. That is drift, and it is why the reset belongs immediately before the turn.
Reset with the robot completely still, as late as you can.
when program starts :: events hat [2 v] reset angle :: sensors start moving [straight: 0] :: movement wait until <([2 v] angle :: sensors) > (90)> stop moving :: movement
That program is the obvious one to write, and it will not give you a 90 degree turn. The next section is why.
Asking to stop at 90 does not stop the robot at 90. Between the gyro reaching 90 and the wheels actually standing still there is a delay — the sensor has to be read, the next block has to run, and the motors have to physically brake. The robot is still turning through all of it, so it ends up past where you asked.
The fix is to ask for less than you want. Aim for a 90 degree turn by waiting for 86: the robot coasts the last few degrees on its own and settles at roughly 89 to 91.
ask for exactly 90
stop 4° early
The tolerance has to match the speed. At 50°/s the number that lands this turn on 90° is 86 — let it loop, and watch that number change when the speed does.
The size of that gap is not a fixed property of the robot — it is the delay multiplied by how fast you are turning. The delay stays about the same whatever you do, so a turn at double the speed carries you about double the distance past the mark.
| Turn speed | Carried past the stop | Wait for | Ends up at |
|---|---|---|---|
| slow | about 4° | 86 | about 90° |
| fast | about 10° | 80 | about 90° |
So the tolerance and the speed have to be chosen together. Turn faster and you must give up more; if you speed a turn up and forget to lower the number, the robot starts overshooting every corner and the program that worked last week no longer does.
when program starts :: events hat [2 v] reset angle :: sensors start moving [right: 30] :: movement wait until <([2 v] angle :: sensors) > (86)> stop moving :: movement
Find your own number rather than copying this one — it depends on your robot’s weight, its wheels and the speed you turn at. Run the turn, measure where it actually stops, and move the number by however far it missed. Two or three tries is usually enough.
The other half of the answer is to slow down. A slower turn overshoots less, so it needs less guessing and repeats more reliably — which is why a turn worth getting right is rarely worth rushing.
A gyro slowly loses its zero even when nothing is moving. Leave a robot sitting still for a minute and the angle may have wandered several degrees all by itself. That is drift, and it is a property of the hardware, not a bug in your program.
Two habits deal with it: reset the angle as late as possible before a turn, and keep the robot dead still while the reset happens. Resetting while the robot is rolling bakes the error in permanently.
Aircraft, ships and phones all use gyros to know their orientation — it is how a phone knows you have turned it sideways. A robot that can turn exactly 90 degrees on any surface is far more reliable than one that guesses with wheel rotations.
A driving base has two Large Motors, one per wheel. You could drive them with two separate motor blocks — but they would never start at quite the same instant, and the robot would curve away. EV3 has a separate family of Movement blocks that treat the pair as a single driving base.
| Block | What it does |
|---|---|
set movement motors to [B v] and [C v] :: movement | Tells the Movement blocks which two ports are the driving wheels. Put it at the top of the program, before any movement. |
move [forward v] for (2) [rotations v] :: movement | Drives both wheels together, so the robot travels in a straight line. |
move for (1) [rotations v] at (75) (25) % speed :: movement | Drives the two wheels at different speeds, which makes the robot curve. |
set movement speed to (50) % :: movement | Sets how fast the driving base travels from now on. |
set movement motors to [B] and [C] is the block that decides which two motors every Movement block after it will drive. It does not look at the robot. It drives the two ports you name, whether or not there is a motor in them — so those two letters have to be the two sockets the cables are actually in.
This is the single commonest reason a driving base does nothing, and it is invisible in the program: every block is spelled correctly and the robot still will not go.
the same program on both robots
The yellow outline marks the two ports the block is driving. A robot only goes straight when both of them have a motor in them.
Both robots run the identical program. The left one has its motors in B and C, so both named ports have a motor and the robot drives straight. The right one is plugged into A and B: the block drives B, finds nothing in C, and never mentions the motor in A at all — so one wheel turns, one wheel sits there, and the robot swings round the dead one instead of driving.
If neither named port has a motor in it — cables in A and D, say, with the block still set to B and C — the robot does not move at all. The program runs happily to the end and the Brick reports nothing wrong, because as far as it is concerned it did exactly what it was told.
So before you look for a bug in the program, look at the cables: read the port letters off the Brick, then make the block say those two. B and C are only the usual choice, not a rule — if your build has the driving motors in A and D, set the block to A and D and everything works.
Everything a driving base can do comes from those two speed numbers. Try each button below and watch the trail the robot leaves.
The path is worked out from the two wheel speeds in the block, not drawn by hand — so changing the preset changes the numbers and the shape together.
Notice there is no steering block anywhere in that program, and no steering part anywhere on the robot. The turn is made entirely by driving the two wheels different amounts.
when program starts :: events hat set movement motors to [B v] and [C v] :: movement move [forward v] for (2) [rotations v] :: movement move for (1) [rotations v] at (50) (-50) % speed :: movement
“Move forward 2 rotations” says nothing about the floor — it says how many times the wheels go round. How far the robot actually travels depends on how big the wheels are, and once round a standard EV3 driving wheel is about 17.5 cm.
Before doing any sums, get a feel for it. Drag the robot along and watch both scales at once — rotations on top, centimetres underneath, the same line. Land on the half marks: there is a number between 1 and 2, and it is 1.5.
Drag the robot, or use the arrow keys — it moves in half rotations. Rotations above the line, centimetres below.
1.5 — a half rotation past 1. Half a turn of the wheels is 8.75 cm, so halves matter.
35 ÷ 17.5 = 2. That is a number you can type straight into the block.
set movement motors to [B v] and [C v] :: movement set movement speed to (30) % :: movement move [forward v] for (2) [rotations v] :: movement
Steering at right 100 or left 100 drives the two wheels in opposite directions, so the base stops travelling and pivots where it stands. The angle it sweeps is a simple doubling of the rotations:
Half a rotation is the one worth remembering: a square corner, 90°.
| Rotations | The robot turns |
|---|---|
| 0.25 | 45° — half a corner |
| 0.5 | 90° — a square corner |
| 1 | 180° — turn round and face back |
| 2 | 360° — all the way round |
The one to memorise is 0.5 rotations = 90°. Everything else follows from doubling or halving it.
set movement speed to (20) % :: movement move [right: 100] for (0.5) [rotations v] :: movement
Turn slowly. The wheels on a driving base are big and the robot carries a lot of weight, so at full speed it keeps going after the motors stop and lands past the angle you asked for. Somewhere between 15% and 30% speed is where turns become repeatable. A turn that overshoots is almost always a turn taken too fast, not a wrong number.
These figures belong to your robot. The distance depends on the wheels and the angle depends on how far apart they are, so a wider base needs a different number for 90°. Test it, measure what actually happened, and adjust — the same discipline as the Gyro Sensor tolerance.
Every wheeled vehicle steers this way — a tank, a digger, an office chair with two driven castors. Cars use a steering rack instead, but a robot that turns by driving its wheels at different speeds needs no steering mechanism at all.
Reset, turn, watch, stop early. The number you wait for comes from measuring your overshoot.
The Gyro Sensor measures how far the robot has turned, in degrees. Wheels slip and floors vary, so counting wheel rotations is a poor way to turn accurately — the gyro measures the turn itself rather than inferring it.
| Block | What it does |
|---|---|
([2 v] angle :: sensors) | Reports how far the robot has turned since the angle was last reset. |
[2 v] reset angle :: sensors | Sets the current heading as zero. |
The angle is measured from wherever it was last zeroed — not from where this turn started. Here are two robots given the same instruction, one with a reset block and one without.
reset first
no reset
Both programs are correct about what they asked for. Only the left one asked the question from a known starting point.
Both programs did exactly what they said. Both gyros stopped at 90. But the robot on the right had 34 degrees already on the clock, so it only turned 55 — and nothing about the program looks wrong. Watch the first step too: neither robot is moving and the reading is still climbing. That is drift, and it is why the reset belongs immediately before the turn.
Reset with the robot completely still, as late as you can.
when program starts :: events hat [2 v] reset angle :: sensors start moving [straight: 0] :: movement wait until <([2 v] angle :: sensors) > (90)> stop moving :: movement
That program is the obvious one to write, and it will not give you a 90 degree turn. The next section is why.
Asking to stop at 90 does not stop the robot at 90. Between the gyro reaching 90 and the wheels actually standing still there is a delay — the sensor has to be read, the next block has to run, and the motors have to physically brake. The robot is still turning through all of it, so it ends up past where you asked.
The fix is to ask for less than you want. Aim for a 90 degree turn by waiting for 86: the robot coasts the last few degrees on its own and settles at roughly 89 to 91.
ask for exactly 90
stop 4° early
The tolerance has to match the speed. At 50°/s the number that lands this turn on 90° is 86 — let it loop, and watch that number change when the speed does.
The size of that gap is not a fixed property of the robot — it is the delay multiplied by how fast you are turning. The delay stays about the same whatever you do, so a turn at double the speed carries you about double the distance past the mark.
| Turn speed | Carried past the stop | Wait for | Ends up at |
|---|---|---|---|
| slow | about 4° | 86 | about 90° |
| fast | about 10° | 80 | about 90° |
So the tolerance and the speed have to be chosen together. Turn faster and you must give up more; if you speed a turn up and forget to lower the number, the robot starts overshooting every corner and the program that worked last week no longer does.
when program starts :: events hat [2 v] reset angle :: sensors start moving [right: 30] :: movement wait until <([2 v] angle :: sensors) > (86)> stop moving :: movement
Find your own number rather than copying this one — it depends on your robot’s weight, its wheels and the speed you turn at. Run the turn, measure where it actually stops, and move the number by however far it missed. Two or three tries is usually enough.
The other half of the answer is to slow down. A slower turn overshoots less, so it needs less guessing and repeats more reliably — which is why a turn worth getting right is rarely worth rushing.
A gyro slowly loses its zero even when nothing is moving. Leave a robot sitting still for a minute and the angle may have wandered several degrees all by itself. That is drift, and it is a property of the hardware, not a bug in your program.
Two habits deal with it: reset the angle as late as possible before a turn, and keep the robot dead still while the reset happens. Resetting while the robot is rolling bakes the error in permanently.
Aircraft, ships and phones all use gyros to know their orientation — it is how a phone knows you have turned it sideways. A robot that can turn exactly 90 degrees on any surface is far more reliable than one that guesses with wheel rotations.
Say this back before you move on: “Want 90? Ask for 85, and measure why.”
Look at your Tank Bot. Where is the Gyro, and which way up is it? On this model, that really matters.
| Part | What it is doing here |
|---|---|
| EV3 Intelligent Brick | Sits low, in the middle, over the tracks. Its weight makes the tracks grip. |
| Large Motor ×2 — the tracks | Large, because tracks are hard work. They drag rubber sideways across the floor for the whole turn. |
| Gyro Sensor | Only feels one kind of turn. That is spinning round a line that sticks straight up from its flat face. Fix it flat and level. If not, it only feels part of the turn. |
| The rubber tracks (no wires) | They grip and scrape. How tight they are changes how the robot turns. A loose track gives a slow turn that is different every time. |
Sensors go in ports 1, 2, 3, 4. Motors go in ports A, B, C, D. You cannot swap them. If you do, nothing warns you. The robot just will not work.
| Part | Port | Why this one |
|---|---|---|
| Left track (Large) | B | One of the pair. Two motors, one job. |
| Right track (Large) | C | The other half. Swap them, and every turn goes the wrong way. The Gyro reads below zero, too. |
| Gyro Sensor | 2 | The Gyro’s own port. Lessons 38 and 39 used it for a second Touch Sensor. Their models had no Gyro. This one does. |
Check your own wiring now:
Two routes, and either is fine. USB is the reliable one and the one to fall back on when a room’s Bluetooth is busy; Bluetooth leaves the robot free to move, which some models need.
Do these in order. Naming the Brick after you go looking for it in the list is how groups end up driving each other’s robots.
EV3 until somebody changes it.EV3.The two failures, every class, every time. The Brick has gone to sleep while you were building — press the centre button to wake it. Or you have paired with the group at the next table, which is why the name matters.
The long version, including Port View and how to read the port tiles, is in the Brick & Bluetooth guide.
Use Bluetooth. This time you must. A cable pulls on the robot as it turns. That changes the very thing you are measuring. It adds a few degrees to every turn. Then you spend twenty minutes hunting for a mistake in your program.
Stuck? Look in the Brick & Bluetooth guide. It has a photo of every screen.
One change at a time. Mark the start with tape. Put a line on the floor to show which way the robot faces. Now you can see if it ends in the wrong place. You can see if it faces the wrong way.
> (90) and run one turn. Read line 3. Say it shows 96. Your overshoot is 6, so your target is 84. Put that in, and run the square.repeat (4) to repeat (6) and the target to 55 (60° take away the overshoot). That makes a hexagon. Then try a pentagon: 5 turns of 72°.reset angle and run the square. The first turn is right. The rest never happen, because the angle is already past 85.Steps 3 and 4 show why we use the Gyro. Do them properly. The counted turn is not worse. On the floor you set it up for, it is great. But it only works there. It guesses what the floor is like. And it does not tell you when that guess stops being true.
A counted turn tells you about the motors. A Gyro turn tells you about the robot.

Build the model before you read any further. Everything after this is about making it do something, and none of it will make much sense with nothing on the table in front of you.
One page at a time — use Next and Previous, or the ← → keys. Fullscreen makes it big enough to build from.
The same build on Google Drive — sometimes a video, sometimes a scan:
Fullscreen it while you build — you can pause and scrub with the player's own controls.
Check the finished build against the picture before you switch anything on. A motor mounted the wrong way round is far easier to spot now than it is to debug later, when it looks like a program fault.
A square. Drive one side, then turn a real 90°. Do that four times. It should finish where it started, facing the same way.
when program starts :: events hat set movement motors to [B v] and [C v] :: movement clear display :: display write [SQUARE] at line (1) :: display repeat (4) move [forward v] for (2) [rotations v] at (40) % speed :: movement wait (0.3) seconds [2 v] reset angle :: sensors start moving [straight: 100] at (25) % speed :: movement wait until <([2 v] angle :: sensors) > (85)> stop moving :: movement write ([2 v] angle) at line (3) :: display end play sound [Communication / Goodbye v] until done :: sound
wait (0.3) seconds before the reset. This is not wasted time. It lets the robot stop properly. Then the Gyro is reset while it is still. Delete it, and the turns get worse every lap.What success looks like: the Tank Bot drives a shape that really looks like a square. It ends a few centimetres from the start. It points about the same way as before. The screen shows numbers a little above 85 all the way.
Does it spin for ever? Then it is turning the way that makes the angle go below zero. The program waits for more than 85, but the number is going to −85. Change the steering to −100, or use
< (−85).
This model drives, so its challenges are run on a mat. Mats differ between branches — check you are looking at the one in your room.

WRO 2019 RoboMission Elementary — Smart Passenger Transport · official WRO game mat, 2362 × 1143 mm
The challenges name these places rather than distances, so the same challenge works on any mat:
Written for the WRO 2019 RoboMission Elementary mat. Each one is a single program run that starts in the ✕ box.
Follow the black line from the start box to Home. Stop fully inside Home.

In one program run, follow the black line to Home, then on to School.

In one run, go to Home, then School, then the Zoo. Stay on the black line all the way.

In one run, go to Home, School and the Zoo, then the Shopping Center. Stay on the black line all the way.

In one run, charge at the Battery Area first. Then go to the Shopping Center, the Cinema, and finish at Home. Stay on the black line all the way.

Work through them in order — each is harder than the last. The extra challenge comes after all three, and it is meant to make you plan before you build.
Drive a square. It must end within a hand's width of where it started. Show the measured angle on the screen after each turn.
Run the same square on a different surface. Do not change a number. Then do it with turns that count rotations. See which one does best.
Let the Brick buttons choose a triangle, a square, a pentagon or a hexagon. Each shape must close up properly. That means it ends where it began.
Your teacher names a station. Drive from it to a second station and back. Turn only with the Gyro. End up facing the way you started. First, write the whole route as a list of drives and headings. A heading is the way the robot faces. Get it right in two runs or less.