Challenge 1
Put the Colour Sensor over the whitest part of the mat and read the reflected light. Then the blackest. Write both numbers down.
EV3 Robotics›Level 4 · WRO Prep›Lesson 4
Level 4 · Lesson 4 · EV3-L04-0460 minutes · Block 1 of 6 · Mat: WRO 2021 — POWERBOTS, Energy at Home
Teach the robot what white and black mean in this room, on this mat, under these lights.
The Colour Sensor in reflected-light mode shines a red LED at the mat and measures how much bounces back. That number depends on the mat, the sensor height, the battery, and the room lights. It is not a property of the colour — it is a property of the situation.
The competition story this prevents. A team tunes a line follower at the branch, where white reads 68. At the venue, under brighter hall lighting, white reads 89. Every threshold in their program is now wrong and the robot drives straight off the line on its first run. This lesson is the fix.
Calibrate on the mat you will compete on, at the place you will drive. On the 2021 mat the useful spots are:
Avoid calibrating on a printed picture. The artwork in the middle of the house is neither white nor black and will give you a range that is too narrow to be useful.
Raw reflected light might run from 12 (black) to 71 (white) on your mat. Calibration stretches that range onto 0 to 100, so the sensor reports a percentage of the way from your black to your white.
After calibration, one number becomes meaningful everywhere: 50 is the edge of the line. Half the sensor over black, half over white. Every follower in Level 4 aims at 50.
| Block | What it does |
|---|---|
[3 v] calibrate reflected light intensity [minimum v] to (0) | Hold the sensor over the darkest black, then run this. That reading becomes 0. |
[3 v] calibrate reflected light intensity [maximum v] to (100) | Hold the sensor over the brightest white, then run this. That reading becomes 100. |
([3 v] reflected light intensity) | Reports 0–100 after calibration instead of the raw range. |
Calibration is stored on the Brick, not in the program. It survives being switched off, which is convenient — and dangerous, because it also survives being moved to a different venue. Recalibrate whenever the room, the mat or the sensor height changes.
The Colour Sensor looks down at a surface and can answer three quite different questions: what colour is this?, how bright is this? and how light is the room? Choosing the wrong one is the usual reason a line-following robot refuses to work.
| Block | What it does |
|---|---|
([3 v] color :: sensors) | Reports which colour it sees, from a short list — red, blue, green, black, white and a few more. |
([3 v] reflected light intensity :: sensors) | Reports how bright the surface is, as a number from 0 (black) to 100 (white). |
<[3 v] is color [red v]? :: sensors> | Reports true or false for one particular colour. |
([3 v] ambient light intensity :: sensors) | Reports how much light is falling on the sensor, 0 to 100, with its own lamp switched off. |
The sensor does not describe a colour — it picks one from a list of eight, and that list is the whole of what it can ever say:
| Reports | Means |
|---|---|
| 0 | no colour — too far away, or too dark to call |
| 1 · 2 · 3 | black, blue, green |
| 4 · 5 · 6 | yellow, red, white |
| 7 | brown |
Anything you put under it is forced into one of those eight. There is no orange and no purple: an orange brick comes back as red or as yellow, and often as red one moment and yellow the next as the robot creeps along. Light blue and grey are the other classic pair to avoid — grey is neither black nor white, so it flips between them.
This is why colour mode is a good fit for a task you control and a bad fit for one you do not. Sorting the LEGO bricks that come in the set works, because they are made in exactly these colours. Reading a printed sheet, a coloured tile from another set, or anything pastel is asking the sensor to answer a question it does not have a word for.
Two practical points follow from how it decides. It shines its own lamp and looks at how much red, green and blue comes back, so it must be close — about half a centimetre, and no more than a centimetre. Lift it and the answer decays to 0. And because it takes those three readings before it can answer, colour mode is the slowest thing this sensor does; a robot driving quickly can pass right over a small patch without ever reporting it.
When a colour must be recognised reliably, test it. Drive the robot slowly over the real surface with color shown on the screen and watch what it actually says — including what it says at the edges between two colours, which is where the wrong answers live.
Both questions are asked of the same surface at the same moment. Watch the two answers travel across a strip of colours and then over the edge of a black line.
Watch the two read-outs over the last third of the strip. One of them changes once. The other changes the whole way across.
Over the patches, both read-outs are useful. Over the edge of the line they part company: the colour name has only two answers to give and jumps between them, while the number slides smoothly from 88 down to 8. Every value in that slide tells you how far onto the line the sensor is — which is information the name simply does not carry.
A line follower built on colour names only knows “black” or “not black”, so it can only lurch. Built on reflected light it can tell how far onto the line it has drifted, which is what makes smooth following possible.
The first two modes both switch the sensor’s own lamp on and measure what bounces back off the surface. Ambient light intensity does the opposite: the lamp goes off, and the sensor simply reports how much light is arriving from wherever — 0 in the dark, up to 100 in bright light.
| Mode | Own lamp | Measures | Points |
|---|---|---|---|
| colour | on | which of eight colours the surface is | at the surface, very close |
| reflected light | on | how much of its own light comes back | at the surface, very close |
| ambient light | off | how bright the surroundings are | wherever you want to measure |
That makes it the only one of the three that is not really about the floor. A number between 0 and 100 means very little on its own, so watch the same sensor sit through five different rooms — nothing underneath it changes at any point.
the sensor’s own lamp is off — it is measuring the room
Nothing under the sensor changed at any point in this run. Ambient light is the one mode that is not asking about the surface at all.
Those are the shape of the scale rather than exact figures, but the shape is the useful part: a lit room is nowhere near 100, and the top of the range is reserved for a light pointed straight at the sensor. Cover it with your hand and the number drops to near zero — which is the easiest way to check the sensor is doing what you think.
Point it at the ceiling and it tells you whether the room lights are on; point it forwards and a torch will spike the reading, which is a way of signalling to a robot without touching it.
Do not reach for it as a substitute for reflected light. Room light falling on a black line and on white paper is almost the same, so ambient mode can barely tell them apart — the reason reflected light works is precisely that the sensor brings its own light and measures how much of it survives.
It is also the mode most at the mercy of the room. A reading taken by a window in the morning will not match the same spot in the afternoon, so anything built on ambient light needs measuring on the day, in the place, with the lights as they will be.
Even the two lamp-on modes are affected by room lighting — a reading taken by a sunny window differs from one taken in a corner. The sensor must also sit close to the surface and at a constant height, because lifting it changes the reading even though the surface has not changed.
Calibration cannot rescue a badly mounted sensor. Fix the height before you calibrate, and then do not change it again — every millimetre invalidates the calibration.
Do not calibrate by hand each time. Write it once, keep it, and run it at the start of every session.
when program starts :: events hat clear display :: display write [PUT SENSOR ON BLACK] at line (1) :: display wait until [center v] button is [pressed v] :: sensors [3 v] calibrate reflected light intensity [minimum v] to (0) :: sensors play beep (60) for (0.2) seconds :: sound wait (1) seconds clear display :: display write [PUT SENSOR ON WHITE] at line (1) :: display wait until [center v] button is [pressed v] :: sensors [3 v] calibrate reflected light intensity [maximum v] to (100) :: sensors play beep (72) for (0.2) seconds :: sound clear display :: display write [DONE - CHECK BOTH] at line (1) :: display
Then check it, with a second tiny program:
when program starts :: events hat forever write ([3 v] reflected light intensity) at line (1) :: display end
Run this experiment as a team and write down all six numbers. It is the evidence that turns calibration from a chore into a habit.
| Condition | Black reads | White reads |
|---|---|---|
| Before calibration, normal room light | ___ | ___ |
| After calibration, normal room light | ___ | ___ |
| After calibration, mat moved near a window (or a torch shone nearby) | ___ | ___ |
Row 2 should read very close to 0 and 100. Row 3 is the interesting one: the calibration was done under the old light, so the readings drift. How far they drift is how wrong your robot would be at a venue.
The rule this produces. Calibrate in the room you will run in, after the lights are set, with the battery at roughly the charge you will compete on. Then leave the sensor alone.
Park the robot so the Colour Sensor sits exactly on the edge of the line — half on black, half on white — and read the number.
A well-calibrated, well-mounted sensor reads somewhere between 40 and 60. If it reads 20 or 80, the sensor is probably too high, tilted, or looking at a line thinner than its own spot. Fix it now: lesson 5 depends on 50 meaning the edge.
This lesson adapts Calibrating Color Sensors from the EV3Lessons Intermediate series by Sanjay and Arvind Seshan (ev3lessons.com). Their deck is in docs/EV3 Lesson Planning/EV3lessons - reference (other creators)/Level 2/. The calibration routine here is rewritten for our two-button workflow, but the idea and the min/max technique are theirs.
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 2021 RoboMission Elementary — POWERBOTS — Energy at Home · official WRO game mat, 2362 × 1143 mm
The challenges name these places rather than distances, so the same challenge works on any mat:
Work through the challenges in order — each is harder than the last. The mission comes after all three, and it is meant to make you plan before you build.
Put the Colour Sensor over the whitest part of the mat and read the reflected light. Then the blackest. Write both numbers down.
Run the calibration blocks so white reads 100 and black reads 0. Re-check both readings and confirm.
Now hold the mat under a different light — near a window, then under the room lights. Read white again. Record how much it moved.
Prove why calibration matters. Record uncalibrated readings for white and black, calibrate, then record them again. Present the four numbers and explain in two sentences what would have gone wrong at a competition venue with brighter lighting.