Arduino Learning Studiorobotics pathway

R11-U2 · usually age 11 · Robot Explorers

Follow the Path

How can a robot follow a line?

Pilot unit plan · 5 sessions · not yet classroom-validated

Build: Line-sensing robot

A line sensor measures how much light the surface under it reflects: a white mat reflects a lot, a black line very little. Learners read the three sensors on the real mat, choose a threshold between white and black, steer with it (the wheel on the side that sees the line stops), and make the rover follow a simple path, with a lost-line stop and a run time-out that end every run by itself.

  • Sense
  • Decide
  • Act

Who it is for

Age is a starting point, never a limit. A learner who can show what this unit starts from can begin here at any age.

How they learn
By arranging instruction cards or blocks, predicting what happens, and testing on a kit. Short sentences, with words and pictures together.
The adult's role
An adult oversees circuits, batteries and motors.
Session
60–75 minutes
Hardware
micro:bit with MakeCode, or a similar child-friendly board. Start in the board's own simulator. A micro:bit is 3.3 V: never connect a 5 V signal straight to it.

Starts from

Builds, and what it is the input for

In the studio today

No studio lab or activity for this unit yet.

Sessions

  1. Session 1 · 60 min

    How can a robot see a line?

    Reflected light: the sensor measures how much light the surface under it reflects. White reflects a lot (a big number), black reflects little (a small number). A threshold between them decides: below it, the line. In the simulator the sensor's number is a stand-in the learner sets: it cannot see a mat.

    The adult says first: “White reflects light. Black soaks it up. The sensor measures it.”

    Learner card

    1. Shine the torch on white.
    2. Now shine it on black.
    3. Which bounces back more?
    4. A big number means white.
    5. The simulator cannot see a line.

    Key words (show each with a picture): reflected light · sensor · line

    Timing (15 of 60 min at the screen)

    1. 10 minAway from the screen: Torch on white card, then on black tape: where does the light go?
    2. 15 minAway from the screen: Play line follower: call left or right; step towards the line.
    3. 15 minAt the screen: MakeCode: the sensor's number in “show number”; drag the simulator's pin.
    4. 10 minAway from the screen: Fill in the table: white, black and grey.
    5. 10 minAway from the screen: Say which number means white, and why the simulator cannot see a line.

    In the studio

    No studio lab or activity.

    Outside the studio: MakeCode editor and its micro:bit simulator (makecode.microbit.org)

    Hands-on

    Nothing is powered: this session uses a torch, card and the simulator only. First, away from the screen, the adult shines a battery torch at a white card and then at black tape, and the group watches how much light bounces onto a sheet held beside it. Then the group plays line follower: one learner walks along a taped line, looking down; a partner calls left when the line is under the walker's left foot, and the walker steps left. In MakeCode next, the learner adds the clip detector extension and puts “read sensor on pin …” set to the middle sensor's pin inside “show number”, inside “forever”. In the simulator, each sensor pin the blocks read shows a number from 0 to 1023 that starts at 0; drag the pin up for a bigger number. It is a stand-in you set: the simulator cannot see a mat or a line. The learner sets a big number and a small number, and says which one means white.

    Starting blocks: Built from scratch: “forever” holding “show number”, with “read sensor on pin …” set to the middle sensor's pin inside it.

    Evidence to collect

    A prediction for each surface, a short test table (Surface | My guess | Sensor number) for white, black and grey in the simulator, filled in by the learner, and the learner's spoken explanation of why white gives a big number and black a small one, and why the simulator's number is a stand-in.

    Test table columns: Surface | My guess | Sensor number

    Predict
    Before the torch, the learner guesses which surface bounces back more light; before each simulator number, white or black.
    Debug
    If the read block is missing, check that the clip detector extension was added in Extensions on this computer.
    Reflect
    Why can't the simulator tell you where the line is?

    Works towards: Reacting continuously

  2. Session 2 · 75 min

    What does each sensor read on our mat?

    The real sensors on the real mat's paper: the detector board under the front of the rover at a measured height, wired by the adult with everything switched off, P0 on the left, P1 in the middle, P2 on the right (checked, not assumed). Each sensor is read over the mat's white and over its black line, and the threshold is chosen between them, from these readings, not a guess.

    The adult says first: “Read the real sensors on the real mat. Then choose the number that decides.”

    Learner card

    1. Read the middle on white.
    2. Now read it on black.
    3. Press A for the left, when told.
    4. The adult presses B: the right.
    5. Pick a number between them.

    Key words (show each with a picture): threshold · white · black

    Timing (10 of 75 min at the screen)

    1. 10 minAway from the screen: With the board off: find the left, middle and right sensors and their wires.
    2. 10 minAt the screen: The reading blocks in the simulator, then download.
    3. 30 minAway from the screen: Turns at the stand, one pair at a time (about 6 minutes each): each sensor over the mat's white and black, guessed first; the side check.
    4. 10 minAway from the screen: Choose the threshold halfway between white and black.
    5. 15 minAway from the screen: Fill in the table; say how the readings set the threshold.

    In the studio

    No studio lab or activity.

    Outside the studio: MakeCode editor and its micro:bit simulator (makecode.microbit.org)

    Hands-on

    Before the session, with the board and the holder switched off, the adult bolts the detector board under the front of the chassis on its stand-offs, sensors facing down, at the starting height (about 10 mm, measured and written on the chassis), and wires it: 0, 1, 2, 3V and GND on the detector to P0, P1, P2, 3V and GND on the Link header: five wires, each bolted to its pad and ending in a female jumper socket, never a crocodile clip on a header pin. The adult checks the leads: the 3V lead on the Link header's 3V pin, never a servo header's V pin; all five tied down and tug-tested. The training mat is white paper with a black line 10 to 20 mm wide. In the simulator first, the learner builds “forever” holding “show number” of “read sensor on pin …” P1, “on button A pressed” showing P0 and “on button B pressed” showing P2, and checks them; then the learner downloads them (the board switched off, the micro:bit out of the board, USB in; USB out once the light on the back stops flashing, the micro:bit back in). These blocks hold no motor block, so no wheel can turn. At each pair's turn, the stop drill; with the rover on its stand the adult switches on and checks the sign (a sensor number: the reading program). The rover stays on its stand, and the adult slides in a strip cut from the mat (its white paper and its black line) laid on a book under the sensors at the height written on the chassis, slid in from the front by the adult. The learner reads the middle sensor over white and over the black line, guessing first; at the adult's word the learner presses A for the left sensor, and the adult presses B for the right. The side check: with the line under the left sensor only, does P0 drop? If P2 drops instead, the adult switches off and swaps the P0 and P2 wires at the header. Last, the learner chooses the threshold halfway between the lowest white number and the highest black number. If a sensor's white and black numbers overlap, no threshold works: the adult switches off and changes one thing at a time (the height on the stand-offs, the light on the mat, or the mat), and the pair reads again.

    Starting blocks: The learner's session 1 blocks, with A showing P0 and B showing P2 added; no motor block.

    Pins

    P0
    left line sensor
    P1
    middle line sensor
    P2
    right line sensor

    Evidence to collect

    A prediction for each reading, a short test table (Sensor | On white | On black | My guess) for the three sensors, and the learner's spoken explanation of how the readings set the threshold, and whether the three sensors agree.

    Test table columns: Sensor | On white | On black | My guess

    Predict
    Before each reading, the learner guesses whether the number will be big or small, and roughly how big.
    Debug
    If a sensor reads the same on white and black, switch off and check its wire on the detector and on the header: the right pad to the right pin.
    Reflect
    Why does the threshold come from our own readings on our own mat?

    ⚠ Adult checks before power-on: Nothing metal touches the micro:bit, its gold pins or the board, and nothing metal lies under it. Before the adult switches on: the micro:bit is firmly in the board, display facing the Link header, its own battery pack and USB unplugged; both switches were off while anything was plugged in or moved. The board's battery is the motor battery: it reaches the motors only through the holder's switch, the board's on/off switch (the power-off switch) and its Motor 1 and Motor 2 terminals. The power-off switch is the board's on/off switch: it cuts the battery to the board, the micro:bit and every motor and servo. Anyone may switch it off at any time; only the adult switches it on. The battery holder rides on the rover, tied down: only the adult opens it, fits cells or works its switch. Safe start: the motors never run just because the board was switched on. “on start” turns them off; only A starts them, after a 3-second wait, and B stops them: a B during the wait clears armed, which A checks after the wait, so the drive never starts. Lift first: the board is switched on only with the rover on its stand, wheels in the air, because a mistake in the blocks could start a wheel at once. On the stand, the board's switch faces the adult, who stands at it; learners stay outside a zone taped 30 cm round the stand. Buttons on a switched-on rover: a learner presses only A, only at the adult's word and only while every wheel is still, with one hand on the micro:bit, nowhere near a wheel, and is back outside the taped edge before the 3-second wait ends. B, the switch, and lifting, carrying or placing a switched-on rover are the adult's: on the floor only the adult presses B. Every program shows its own sign at start, and the adult checks it on the stand before the rover leaves it: the drive program (R11-U1) a Heart, the reading program a sensor number, the line program the No icon. A rover showing the wrong sign does not go on the floor. Fingers, hair, sleeves and cords stay away from the wheels while the board is on; long hair is tied back. The rover is lifted only by its chassis. Floor speed limit: the rover's speed numbers are never above 40 (of 100), a planning choice. Practise the stop before every switch-on: the adult is the stopper. On “Stop!”, the adult switches the board off (on the floor, lifting the rover by its chassis first); learners call “Stop!” from outside the taped zone and never reach for the rover. Rewire only when unpowered: the board and the holder are switched off before any wire, motor, servo or sensor is plugged in, moved or taken out. Never leave a lead loose while the board is on: switch off first; a lead taken out is capped and taped away from the board. The line sensor is a Kitronik Clippable Detector Board, rated 2 V to 5.5 V and powered only from the Link header's 3V pin, so its outputs come from 3.3 V; never from 5 V. Kitronik gives the detector's current as 54 mA at 3 V. At the header's 3.3 V it will draw a little more (about 60 mA if it rises in step with the voltage, an estimate), still under the header's 90 mA. The detector's leads, checked before every switch-on: its 3V lead goes to the Link header's 3V pin, never to a servo header's V pin. The board marks each servo header ‘GND V SIG’, and its V pin carries the battery's voltage (the datasheet: the servo outputs ‘Provide supply voltage to servos’), above the detector's 5.5 V and far above the micro:bit's 3.6 V. All five leads are tied down to the chassis and each one given a gentle tug. No music blocks in these units: MakeCode plays music through pin P0, where the left line sensor is.

    Works towards: Reacting continuously

  3. Session 3 · 75 min

    Which wheel should stop when a sensor sees the line?

    Left and right control: if the left sensor sees the line, the left wheel stops and the rover turns left, back over the line; the same on the right. Only two choices for each wheel, go or stop: the simplest steering. The adult's stop blocks go around the steering: A starts after a 3-second wait, B stops, a counter stops the rover when the middle sensor has seen no line for about 2 seconds, and a second counter stops every run after about 30 seconds.

    The adult says first: “The sensor that sees the line stops its own wheel. The rover turns back.”

    Learner card

    1. Line on the left: left wheel stops.
    2. Line on the right: right wheel stops.
    3. No line for 2 seconds: stop.
    4. Guess which wheel stops.
    5. Watch the adult press B.

    Key words (show each with a picture): left · right · steer

    Timing (20 of 75 min at the screen)

    1. 10 minAway from the screen: Role-play: two wheels and a sensor bar; which wheel stops?
    2. 15 minAt the screen: The adult's stop blocks; the steering inside; drag the pins in the simulator.
    3. 5 minAway from the screen: Guess which wheel stops for each card position.
    4. 5 minAt the screen: Download, with the board switched off and the micro:bit out of it.
    5. 25 minAway from the screen: Turns at the stand, one pair at a time (about 6 minutes each): the test card; B; the time-out.
    6. 15 minAway from the screen: Fill in the table; say which wheel stops and why.

    In the studio

    No studio lab or activity.

    Outside the studio: MakeCode editor and its micro:bit simulator (makecode.microbit.org)

    Hands-on

    First, away from the screen, the group role-plays the steering: two learners are the wheels, holding hands as the axle, and a third behind them calls which wheel stops when a strip of black paper slides under the left or right of a card sensor bar. In the simulator next, the adult builds the stop blocks: “on start” holding “turn off all outputs”, “set lost to …” 20 and “set armed to …” 0; “on button A pressed” holding “set armed to …” 1, “pause (ms)” 3000 and an “if then else” whose condition is “0 < 0” with 0 on the left and armed on the right: then “set passes to …” 0, “set lost to …” 0 and “clear screen”; “on button B pressed” holding “set armed to …” 0, “set passes to …” 300, “set lost to …” 20 and “turn off all outputs”; and “forever” holding an “if then else” whose condition is “0 < 0” with lost on the left and 20 on the right: then a second “if then else” whose condition is “0 < 0” with passes on the left and 300 on the right: then the steering, the counter (if “read sensor on pin …” P1 is below the threshold, “set lost to …” 0, else “change lost by …” 1) and “change passes by …” 1; else (the run time-out) “set lost to …” 20; and the first else holding “turn off all outputs” and “show icon” set to No; then “pause (ms)” 100. The learner puts the steering in the inner “then”: an “if then else” for each side: if “read sensor on pin …” P0 is below the threshold, “turn off Motor 1”, else “Motor 1 on direction … speed …” Forward at 30; the same for P2 and Motor 2; the slower side keeps R11-U1's trim (2 more), with the threshold from session 2. In the simulator, each sensor pin the blocks read shows a number from 0 to 1023 that starts at 0; drag the pin up for a bigger number. It is a stand-in you set: the simulator cannot see a mat or a line. The motor blocks turn no wheel in the simulator. The learner clicks A in the simulator, drags P1 above the threshold and watches the No icon appear about 2 seconds after the wait. Then the learner downloads it (the board switched off, the micro:bit out of the board, USB in; USB out once the light on the back stops flashing, the micro:bit back in). At each pair's turn, the stop drill; with the rover on its stand the adult switches on and checks the sign (the No icon: the line program). At the adult's word the learner presses A and steps back out of the zone, and the adult slides in a test card (white card with a strip of the black line across one end) laid on a book under the sensors at the height written on the chassis, pushed in from the front so hands stay away from the wheels. With the line under the left sensor, under the middle and under the right, the learner predicts and writes which wheel stops; with white only, the rover stops itself about 2 seconds later and the No icon comes back (the stand check). Then A again, and the adult presses B while the wheels turn. Last, A again with the line held still under the middle sensor: after about 30 seconds the run time-out stops the wheels by itself, as it would if a sensor failed.

    Starting blocks: Built from scratch: the adult's stop blocks, with the learner's steering inside the inner “then” and the threshold from session 2.

    Pins

    P0
    left line sensor
    P1
    middle line sensor
    P2
    right line sensor

    Evidence to collect

    A prediction for each card position, a short test table (Card position | My guess | Wheel that stopped) for the line under the left, middle and right sensors, for white only and for the time-out, and the learner's spoken explanation of which wheel stops and why that turns the rover back over the line.

    Test table columns: Card position | My guess | Wheel that stopped

    Predict
    Before each card position, the learner points to the wheel that will stop, and says which way the rover would turn.
    Debug
    If the wrong wheel stops, check which sensor each “if then else” reads and which wheel it stops: the left sensor stops the left wheel.
    Reflect
    Why does stopping one wheel turn the rover back over the line?

    ⚠ Adult checks before power-on: Nothing metal touches the micro:bit, its gold pins or the board, and nothing metal lies under it. Before the adult switches on: the micro:bit is firmly in the board, display facing the Link header, its own battery pack and USB unplugged; both switches were off while anything was plugged in or moved. The board's battery is the motor battery: it reaches the motors only through the holder's switch, the board's on/off switch (the power-off switch) and its Motor 1 and Motor 2 terminals. The power-off switch is the board's on/off switch: it cuts the battery to the board, the micro:bit and every motor and servo. Anyone may switch it off at any time; only the adult switches it on. The battery holder rides on the rover, tied down: only the adult opens it, fits cells or works its switch. Safe start: the motors never run just because the board was switched on. “on start” turns them off; only A starts them, after a 3-second wait, and B stops them: a B during the wait clears armed, which A checks after the wait, so the drive never starts. Lift first: the board is switched on only with the rover on its stand, wheels in the air, because a mistake in the blocks could start a wheel at once. On the stand, the board's switch faces the adult, who stands at it; learners stay outside a zone taped 30 cm round the stand. Buttons on a switched-on rover: a learner presses only A, only at the adult's word and only while every wheel is still, with one hand on the micro:bit, nowhere near a wheel, and is back outside the taped edge before the 3-second wait ends. B, the switch, and lifting, carrying or placing a switched-on rover are the adult's: on the floor only the adult presses B. Every program shows its own sign at start, and the adult checks it on the stand before the rover leaves it: the drive program (R11-U1) a Heart, the reading program a sensor number, the line program the No icon. A rover showing the wrong sign does not go on the floor. Fingers, hair, sleeves and cords stay away from the wheels while the board is on; long hair is tied back. The rover is lifted only by its chassis. Floor speed limit: the rover's speed numbers are never above 40 (of 100), a planning choice. Practise the stop before every switch-on: the adult is the stopper. On “Stop!”, the adult switches the board off (on the floor, lifting the rover by its chassis first); learners call “Stop!” from outside the taped zone and never reach for the rover. Rewire only when unpowered: the board and the holder are switched off before any wire, motor, servo or sensor is plugged in, moved or taken out. Never leave a lead loose while the board is on: switch off first; a lead taken out is capped and taped away from the board. The line sensor is a Kitronik Clippable Detector Board, rated 2 V to 5.5 V and powered only from the Link header's 3V pin, so its outputs come from 3.3 V; never from 5 V. Kitronik gives the detector's current as 54 mA at 3 V. At the header's 3.3 V it will draw a little more (about 60 mA if it rises in step with the voltage, an estimate), still under the header's 90 mA. The detector's leads, checked before every switch-on: its 3V lead goes to the Link header's 3V pin, never to a servo header's V pin. The board marks each servo header ‘GND V SIG’, and its V pin carries the battery's voltage (the datasheet: the servo outputs ‘Provide supply voltage to servos’), above the detector's 5.5 V and far above the micro:bit's 3.6 V. All five leads are tied down to the chassis and each one given a gentle tug. No music blocks in these units: MakeCode plays music through pin P0, where the left line sensor is.

    Works towards: Reacting continuously

  4. Session 4 · 75 min

    Can the rover follow the line on the floor?

    Reacting all the time: the loop reads the sensors and sets the wheels again and again, about ten times a second, so the rover corrects as it goes. First runs on the floor, at 30: a straight line with one gentle curve. Where the line ends, the lost-line stop must stop the rover by itself.

    The adult says first: “Now the floor. The rover checks the line again and again.”

    Learner card

    1. Stand outside the tape.
    2. Guess where it will struggle.
    3. Press A when the adult says.
    4. Time the stop after the line.
    5. Say “Stop!” if it stalls.

    Key words (show each with a picture): react · correct · floor

    Timing (10 of 75 min at the screen)

    1. 10 minAway from the screen: Walk the path: where will the rover have trouble?
    2. 10 minAt the screen: The session 3 blocks in the simulator; download.
    3. 30 minAway from the screen: Turns, one pair at a time (about 6 minutes each, three runs): the stand check, then the floor; time the stop.
    4. 15 minAway from the screen: The group's stop times: about 2 seconds after the line ended?
    5. 10 minAway from the screen: Fill in the table; say how the rover keeps correcting.

    In the studio

    No studio lab or activity.

    Outside the studio: MakeCode editor and its micro:bit simulator (makecode.microbit.org)

    Hands-on

    In the simulator first, the learner checks the session 3 blocks (speed 30 on both motors, the trim kept); then the learner downloads them (the board switched off, the micro:bit out of the board, USB in; USB out once the light on the back stops flashing, the micro:bit back in). The training mat lies in the cleared area: a start box, a straight line, one gentle curve and an end where the line stops, with no loops, junctions or crossings. At each turn, the stop drill; with the rover on its stand the adult switches on and checks the sign (the No icon: the line program). The stand check: at the adult's word the learner presses A and steps back, and the adult slides the white end of the test card under the sensors; the No icon must come back about 2 seconds after the 3-second wait, or the rover stays on the stand and the adult switches off to check the middle sensor. With the program waiting for A, the adult carries the rover by its chassis from the stand to the start box and sets it down. Each pair's turn on the floor: three runs. At the adult's word the learner presses A and steps back outside the tape; only the adult presses B. The learner records where the rover went and how long it took to stop after the line ended, timed on the adult's stopwatch; between runs the adult carries it back to the start box, the No icon showing. If it leaves the line, the learner writes where; if it stalls or heads for the edge, “Stop!”.

    Starting blocks: The learner's session 3 blocks, at speed 30 on both motors.

    Pins

    P0
    left line sensor
    P1
    middle line sensor
    P2
    right line sensor

    Evidence to collect

    A prediction for each run, a short test table (Run | My guess | What happened) for three runs, and the learner's spoken explanation of how the rover keeps correcting, and how long the lost-line stop took.

    Test table columns: Run | My guess | What happened

    Predict
    Before each run, the learner guesses whether the rover will reach the end of the line, and where it may leave it.
    Debug
    If the rover zigzags hard or leaves the curve, it may be too fast for its sensors: note it for the next unit, and keep 30 today.
    Reflect
    Why must the rover keep checking the line, not just once at the start?

    ⚠ Adult checks before power-on: Nothing metal touches the micro:bit, its gold pins or the board, and nothing metal lies under it. Before the adult switches on: the micro:bit is firmly in the board, display facing the Link header, its own battery pack and USB unplugged; both switches were off while anything was plugged in or moved. The board's battery is the motor battery: it reaches the motors only through the holder's switch, the board's on/off switch (the power-off switch) and its Motor 1 and Motor 2 terminals. The power-off switch is the board's on/off switch: it cuts the battery to the board, the micro:bit and every motor and servo. Anyone may switch it off at any time; only the adult switches it on. The battery holder rides on the rover, tied down: only the adult opens it, fits cells or works its switch. Safe start: the motors never run just because the board was switched on. “on start” turns them off; only A starts them, after a 3-second wait, and B stops them: a B during the wait clears armed, which A checks after the wait, so the drive never starts. Lift first: the board is switched on only with the rover on its stand, wheels in the air, because a mistake in the blocks could start a wheel at once. On the stand, the board's switch faces the adult, who stands at it; learners stay outside a zone taped 30 cm round the stand. Buttons on a switched-on rover: a learner presses only A, only at the adult's word and only while every wheel is still, with one hand on the micro:bit, nowhere near a wheel, and is back outside the taped edge before the 3-second wait ends. B, the switch, and lifting, carrying or placing a switched-on rover are the adult's: on the floor only the adult presses B. Every program shows its own sign at start, and the adult checks it on the stand before the rover leaves it: the drive program (R11-U1) a Heart, the reading program a sensor number, the line program the No icon. A rover showing the wrong sign does not go on the floor. Fingers, hair, sleeves and cords stay away from the wheels while the board is on; long hair is tied back. The rover is lifted only by its chassis. Floor speed limit: the rover's speed numbers are never above 40 (of 100), a planning choice. Practise the stop before every switch-on: the adult is the stopper. On “Stop!”, the adult switches the board off (on the floor, lifting the rover by its chassis first); learners call “Stop!” from outside the taped zone and never reach for the rover. Rewire only when unpowered: the board and the holder are switched off before any wire, motor, servo or sensor is plugged in, moved or taken out. Never leave a lead loose while the board is on: switch off first; a lead taken out is capped and taped away from the board. The line sensor is a Kitronik Clippable Detector Board, rated 2 V to 5.5 V and powered only from the Link header's 3V pin, so its outputs come from 3.3 V; never from 5 V. Kitronik gives the detector's current as 54 mA at 3 V. At the header's 3.3 V it will draw a little more (about 60 mA if it rises in step with the voltage, an estimate), still under the header's 90 mA. The detector's leads, checked before every switch-on: its 3V lead goes to the Link header's 3V pin, never to a servo header's V pin. The board marks each servo header ‘GND V SIG’, and its V pin carries the battery's voltage (the datasheet: the servo outputs ‘Provide supply voltage to servos’), above the detector's 5.5 V and far above the micro:bit's 3.6 V. All five leads are tied down to the chassis and each one given a gentle tug. No music blocks in these units: MakeCode plays music through pin P0, where the left line sensor is. Before every floor turn, on the stand: A, then the white end of the test card under the sensors; the No icon must come back about 2 seconds after the 3-second wait. If it does not, the rover stays on the stand and the adult switches off to check the middle sensor and its wire. The lost-line stop: if the middle sensor sees no line for 20 passes of the loop in a row (each pass waits 100 ms, so about 2 seconds), the rover stops by itself. B stops the motors too. The run time-out: a second counter, passes, that A sets to 0 and every pass of the loop adds 1 to; at 300 passes (about 30 seconds, a little more in practice) the rover stops by itself wherever it is, even if a sensor has failed and reads dark all the time. 300 is a planning choice, sized to the plans' courses, where a good run at 30 takes under 20 seconds. Every course ends: the line stops at an end, with no loops, junctions or crossings, so a rover that keeps finding a line cannot circle for ever. The adult times a good run on each new course: if it takes 20 seconds or more, the course is made shorter. A switched-on rover that is not showing the No icon is live: it may be driving or about to drive. Hands off; the adult stays beside its switch. Stall or runaway: if a wheel is blocked, the rover pushes against anything, a motor hums without turning or the rover leaves the mat, call “Stop!” at once. Floor runs happen only in a cleared area with adults present: at least 1 m clear round the mat, learners outside its taped edge, one rover at a time per adult, who walks beside it.

    Works towards: Reacting continuously

  5. Session 5 · 75 min

    Can our rover follow a simple path?

    The prototype, a line-sensing robot, follows a simple path: the training mat's start box, straight line, gentle curve and end. A run passes when the rover follows the line from the start box to the end of the line without help, and the lost-line stop then stops it by itself. Three runs, each predicted; every result counts.

    The adult says first: “Show us your rover following the path. Every run counts.”

    Learner card

    1. Read the pass rule.
    2. Guess each run.
    3. Press A when the adult says.
    4. Pass or fail? Write it.
    5. Explain the blocks.

    Key words (show each with a picture): follow · path · pass

    Timing (10 of 75 min at the screen)

    1. 10 minAway from the screen: Read the pass rule; a guess for each run.
    2. 10 minAt the screen: The final blocks in the simulator once, then download.
    3. 30 minAway from the screen: Turns, one pair at a time (about 6 minutes each, three runs): every result counts.
    4. 25 minAway from the screen: Explain the blocks: the threshold, the two sides, the counter, the time-out.

    In the studio

    No studio lab or activity.

    Outside the studio: MakeCode editor and its micro:bit simulator (makecode.microbit.org)

    Hands-on

    First, away from the screen, the learner reads the pass rule and writes a guess for each of three runs. In the simulator next, the learner checks the final blocks once, then downloads them (the board switched off, the micro:bit out of the board, USB in; USB out once the light on the back stops flashing, the micro:bit back in). At each turn, the stop drill; with the rover on its stand the adult switches on and checks the sign (the No icon: the line program). The stand check: at the adult's word the learner presses A and steps back, and the adult slides the white end of the test card under the sensors; the No icon must come back about 2 seconds after the 3-second wait, or the rover stays on the stand and the adult switches off to check the middle sensor. With the program waiting for A, the adult carries the rover by its chassis from the stand to the start box and sets it down. Each pair's turn on the floor: three runs, each from the start box. At the adult's word the learner presses A and steps back outside the tape; only the adult presses B; the learner records pass or fail, and where the rover left the line if it did. Last, the learner explains the steering and the stops to the adult, pointing to the blocks: the threshold, the two sides, the counter and the time-out.

    Starting blocks: The learner's own blocks from session 4.

    Pins

    P0
    left line sensor
    P1
    middle line sensor
    P2
    right line sensor

    Evidence to collect

    The unit's evidence: the rover follows a simple path: a prediction for each run, a short test table (Run | My guess | Pass or fail) for three runs, and the learner's spoken or written explanation of how the threshold and the left and right control keep the rover on the line, and how it stops.

    Test table columns: Run | My guess | Pass or fail

    Predict
    Before each run, the learner says pass or fail, and why.
    Debug
    If a run fails, it still counts: write where the rover left the line, and what the sensors may have seen there.
    Reflect
    What does your rover do when it is unsure where the line is, and why is that safe?

    ⚠ Adult checks before power-on: Nothing metal touches the micro:bit, its gold pins or the board, and nothing metal lies under it. Before the adult switches on: the micro:bit is firmly in the board, display facing the Link header, its own battery pack and USB unplugged; both switches were off while anything was plugged in or moved. The board's battery is the motor battery: it reaches the motors only through the holder's switch, the board's on/off switch (the power-off switch) and its Motor 1 and Motor 2 terminals. The power-off switch is the board's on/off switch: it cuts the battery to the board, the micro:bit and every motor and servo. Anyone may switch it off at any time; only the adult switches it on. The battery holder rides on the rover, tied down: only the adult opens it, fits cells or works its switch. Safe start: the motors never run just because the board was switched on. “on start” turns them off; only A starts them, after a 3-second wait, and B stops them: a B during the wait clears armed, which A checks after the wait, so the drive never starts. Lift first: the board is switched on only with the rover on its stand, wheels in the air, because a mistake in the blocks could start a wheel at once. On the stand, the board's switch faces the adult, who stands at it; learners stay outside a zone taped 30 cm round the stand. Buttons on a switched-on rover: a learner presses only A, only at the adult's word and only while every wheel is still, with one hand on the micro:bit, nowhere near a wheel, and is back outside the taped edge before the 3-second wait ends. B, the switch, and lifting, carrying or placing a switched-on rover are the adult's: on the floor only the adult presses B. Every program shows its own sign at start, and the adult checks it on the stand before the rover leaves it: the drive program (R11-U1) a Heart, the reading program a sensor number, the line program the No icon. A rover showing the wrong sign does not go on the floor. Fingers, hair, sleeves and cords stay away from the wheels while the board is on; long hair is tied back. The rover is lifted only by its chassis. Floor speed limit: the rover's speed numbers are never above 40 (of 100), a planning choice. Practise the stop before every switch-on: the adult is the stopper. On “Stop!”, the adult switches the board off (on the floor, lifting the rover by its chassis first); learners call “Stop!” from outside the taped zone and never reach for the rover. Rewire only when unpowered: the board and the holder are switched off before any wire, motor, servo or sensor is plugged in, moved or taken out. Never leave a lead loose while the board is on: switch off first; a lead taken out is capped and taped away from the board. The line sensor is a Kitronik Clippable Detector Board, rated 2 V to 5.5 V and powered only from the Link header's 3V pin, so its outputs come from 3.3 V; never from 5 V. Kitronik gives the detector's current as 54 mA at 3 V. At the header's 3.3 V it will draw a little more (about 60 mA if it rises in step with the voltage, an estimate), still under the header's 90 mA. The detector's leads, checked before every switch-on: its 3V lead goes to the Link header's 3V pin, never to a servo header's V pin. The board marks each servo header ‘GND V SIG’, and its V pin carries the battery's voltage (the datasheet: the servo outputs ‘Provide supply voltage to servos’), above the detector's 5.5 V and far above the micro:bit's 3.6 V. All five leads are tied down to the chassis and each one given a gentle tug. No music blocks in these units: MakeCode plays music through pin P0, where the left line sensor is. Before every floor turn, on the stand: A, then the white end of the test card under the sensors; the No icon must come back about 2 seconds after the 3-second wait. If it does not, the rover stays on the stand and the adult switches off to check the middle sensor and its wire. The lost-line stop: if the middle sensor sees no line for 20 passes of the loop in a row (each pass waits 100 ms, so about 2 seconds), the rover stops by itself. B stops the motors too. The run time-out: a second counter, passes, that A sets to 0 and every pass of the loop adds 1 to; at 300 passes (about 30 seconds, a little more in practice) the rover stops by itself wherever it is, even if a sensor has failed and reads dark all the time. 300 is a planning choice, sized to the plans' courses, where a good run at 30 takes under 20 seconds. Every course ends: the line stops at an end, with no loops, junctions or crossings, so a rover that keeps finding a line cannot circle for ever. The adult times a good run on each new course: if it takes 20 seconds or more, the course is made shorter. A switched-on rover that is not showing the No icon is live: it may be driving or about to drive. Hands off; the adult stays beside its switch. Stall or runaway: if a wheel is blocked, the rover pushes against anything, a motor hums without turning or the rover leaves the mat, call “Stop!” at once. Floor runs happen only in a cleared area with adults present: at least 1 m clear round the mat, learners outside its taped edge, one rover at a time per adult, who walks beside it.

    Works towards: Reacting continuously

Materials

  • Per pair: a BBC micro:bit and its USB cable (USB micro-B at the micro:bit end)
  • A computer with a web browser for MakeCode (makecode.microbit.org); no installs needed
  • Per pair: a Kitronik Compact All-In-One Robotics Board for BBC micro:bit (stock code 5693), its Link header fitted with a 2.54 mm pin header by the adult (soldering is adult-only)
  • Kept by the adult: 4 × AA alkaline cells (1.5 V each, 6 V nominal) in a holder with a screwed-shut cover and its own on/off switch, wired by the adult to the board's power terminal block; no rechargeable cells, Li-ion, LiPo, RC or coin-cell packs
  • Pencils and paper for the test tables
  • Per rover: two right-angle geared TT motors with yellow wheels (Kitronik stock code 25100), leads soldered on by the adult
  • Per rover: a flat chassis about 20 cm by 12 cm (stiff corrugated plastic or thick card), a smooth plastic ball caster with spacers to level the deck, cable ties, M3 nuts and bolts, and a stand (a box that holds the wheels in the air)
  • Per rover: a Kitronik Clippable Detector Board (stock code 5678), five wires each with a ring end for a pad bolt and a female jumper socket, M3 nuts, bolts and spacers for its stand-offs, and a ruler
  • The training mat: white paper about 1 m by 1.5 m with a black line 10 to 20 mm wide (a start box, a straight, one gentle curve and an end; no loops, junctions or crossings), taped flat, and a strip cut from the same paper and line
  • A battery torch held by the adult, white card, black tape, a book for the test card, masking tape and a stopwatch

⚠ Safety before any session

  • Batteries: only AA alkaline cells in the board's closed holder, and USB from a computer for downloads; no rechargeable cells, power banks, Li-ion, LiPo, RC packs or coin cells.
  • Cells: the adult fits four new alkaline cells of one type, the right way round, never mixes new and used cells, takes spent cells out and screws the cover shut.
  • The power-off switch is the board's on/off switch: it cuts the battery to the board, the micro:bit and every motor and servo. Anyone may switch it off at any time; only the adult switches it on.
  • The board's battery is the motor battery: it reaches the motors only through the holder's switch, the board's on/off switch (the power-off switch) and its Motor 1 and Motor 2 terminals.
  • A motor never runs from a micro:bit pin: it runs only from the board's motor terminals, powered by the board's battery.
  • Lift first: the board is switched on only with the rover on its stand, wheels in the air, because a mistake in the blocks could start a wheel at once.
  • Fingers, hair, sleeves and cords stay away from the wheels while the board is on; long hair is tied back. The rover is lifted only by its chassis.
  • Floor speed limit: the rover's speed numbers are never above 40 (of 100), a planning choice.
  • Floor runs happen only in a cleared area with adults present: at least 1 m clear round the mat, learners outside its taped edge, one rover at a time per adult, who walks beside it.
  • Stall or runaway: if a wheel is blocked, the rover pushes against anything, a motor hums without turning or the rover leaves the mat, call “Stop!” at once.
  • Rewire only when unpowered: the board and the holder are switched off before any wire, motor, servo or sensor is plugged in, moved or taken out.
  • Never leave a lead loose while the board is on: switch off first; a lead taken out is capped and taped away from the board.
  • The battery holder rides on the rover, tied down: only the adult opens it, fits cells or works its switch.
  • Learners press only A, at the adult's word, with every wheel still and one hand on the micro:bit only. B, the switch and moving a switched-on rover are the adult's.
  • Only the parts the plan names connect to the micro:bit, through the board's Link header. Never connect a 5 V signal or supply to a micro:bit's pins or battery socket: it runs at 3.6 V at most.
  • If the board, a motor, the holder or a wire gets warm: switch the board off, don't touch it, tell the adult.
  • The line sensor is a Kitronik Clippable Detector Board, rated 2 V to 5.5 V and powered only from the Link header's 3V pin, so its outputs come from 3.3 V; never from 5 V.
  • The detector's 3V lead goes only to the Link header's 3V pin, never a servo header's V pin (battery voltage); its five leads are tied down and tug-tested.
  • No music blocks in these units: MakeCode plays music through pin P0, where the left line sensor is.
  • The lost-line stop: if the middle sensor sees no line for 20 passes of the loop in a row (each pass waits 100 ms, so about 2 seconds), the rover stops by itself. B stops the motors too.
  • Every line run ends by itself: the lost-line stop after about 2 seconds without a line, and the run time-out after 300 passes (about 30 seconds), even if a sensor fails.
  • Every course ends: no loops, junctions or crossings, and a good run takes under 20 seconds.
  • A switched-on rover that is not showing the No icon is live: it may be driving or about to drive. Hands off; the adult stays beside its switch.

Notes for the adult

  • Read each step aloud first: your words come before the learner's card. The card uses short sentences; show each key word with a picture.
  • These plans assume one adult for up to four pairs. Learners plug the USB cable into their own computer, gripping the plug, while the adult watches; only the adult handles cells and battery packs. With more pairs, add an adult or bring fewer pairs to the real board at once.
  • Each session's timing keeps screen time to short bursts (15 minutes at most), with building, acting or testing away from the screen between them.
  • Before the first session on the real board, set up each computer and test a download: either pair each micro:bit once with WebUSB (then MakeCode's Download button sends the program straight to it), or download the .hex file and drag it onto the MICROBIT drive. The light on the back flashes while the program copies: unplug only after it stops.
  • To download, the board is switched off and the adult takes the micro:bit out of it (or the learner does, with the adult watching), holding it by its edges and pulling it straight out; the learner plugs in USB, downloads and unplugs USB once the light on the back stops flashing; the micro:bit goes back in the same way, straight and firmly, display facing the Link header, before the adult switches on. Every swap wears the edge connector a little: swap only to download or at a pair's turn, and never rock the micro:bit out.
  • Powered work rotates: one rover at a time per adult, each pair (or team) taking its turn while the others work away from the screen. Planning figures: a turn takes about 3 minutes to set up (the stand, the sign, the stop drill, the stand check) and about a minute a run, so each session's timing gives every turn its minutes.
  • The pack is 6 V nominal (4 × 1.5 V), at the edge of all three ranges: the bottom of Kitronik's recommended 6.0–10.8 V for the board, and the top of the TT motor's 3–6 V and the servo's 4.8–6 V. Expect it to vary: new cells can read above 1.5 V each with nothing running (Energizer's handbook works an example with an open circuit voltage of 1.6 V), and the pack sags under load, because each fresh cell has 150 to 300 milliohms of internal resistance (Energizer E91). Kitronik's board page lists under Requires a Power Supply that links to its 3 × AA holder; these plans use 4 × AA instead, because 3 × AA is 4.5 V nominal, below the board's recommended 6.0 V and the servo's 4.8 V.
  • Kitronik labels the board Age 11+ and tags it Designed for_Engineers. These plans are adult-led for that reason: the adult builds, wires, powers and switches every rig and keeps the battery holder; the learner changes numbers in blocks, presses the micro:bit's buttons when the adult says, and watches from outside the safe zone or the gate's path.
  • Before the first session, add the extensions on each computer: in MakeCode's Extensions, search for Kitronik and pick the Kitronik robotics Board; for the line sensor, search for Kitronik clip detector.
  • The MakeCode simulator prepares the work. Only the real board, seen working by the adult, counts as evidence: a simulator run is never physical success.
  • Hand out each session's test table with its columns ready: the learner fills it in, and the adult writes only for a learner who needs it. Making their own tables is taught in R09-U3.
  • The studio's Arduino labs are written for ages 12 and up and are not used in this unit, not even its motor or steering labs: they wire a 5 V Uno, never a micro:bit.
  • Carried over from age 10: the same board, battery and power-off switch; the same motor blocks with a speed from 0 to 100; the power path from R10-U1 (battery, board, motor, back), now through two motor drivers; and the safe stop rule from R10-U3 (when unsure, the safe choice), now: stop when the line is lost. The servo socket stays empty at age 11.
  • Motor 1 drives the left wheel and Motor 2 the right; the left line sensor is on P0, the middle one on P1 and the right one on P2.
  • An engineering note, not a maker's quote: the board's driver chip keeps the last speeds it was sent. If the program halts (it crashes, or the micro:bit is pulled out), a wheel that was turning can keep turning; after a reset, “on start” turns the motors off only once the program runs again. Only the switch is sure to stop the motors.
  • If both wheels stall, the pack's voltage can sag far enough to reset the micro:bit. The safe start then keeps the motors off until A, so the rover sits still showing its sign: treat it as live and switch off.
  • Planning choices, not sourced figures: the speeds 30 and 25, the floor limit of 40 of 100, the 3000 ms drive limit, the 3-second wait after A, the lost-line stop's 20 passes of 100 ms, the run time-out of 300 passes, the detector's starting height of 10 mm, the 1 m clearance and the 30 cm zone.
  • Kitronik gives the detector's current as 54 mA at 3 V. At the header's 3.3 V it will draw a little more (about 60 mA if it rises in step with the voltage, an estimate), still under the header's 90 mA.
  • The detector hangs under the front on stand-offs (bolts with nuts and spacers) that set one height above the floor: start at about 10 mm (a planning choice: Kitronik gives no height), measured with a ruler and written on the chassis. Keep it fixed: every reading and threshold holds only at that height.
  • Which side P0 is on depends on how the detector is bolted on, so check it: with the line under the left sensor only, does P0 drop? If P2 drops instead, the adult switches off and swaps the P0 and P2 wires at the header.
  • If a sensor's white and black numbers overlap (its lowest white is not above its highest black), no threshold works: switch off and change one thing at a time, the detector's height on its stand-offs, the light on the mat (no sunlight or lamp on it) or the mat itself (matt white paper, a darker line), then read again.
  • A substitute line sensor must have, on its own datasheet: a supply rating that includes 3.3 V (as the Kitronik board's 2–5.5 V does), analogue outputs, and a total current under 90 mA at 3.3 V (the Link header's limit). The adult checks all three before buying.
  • This unit does not start from R11-U1's safety work: the adult builds and checks the rover, practises its stops with the group, and builds the stop blocks; the learner builds the steering inside them.
  • The stop blocks use three variables the adult makes in the Variables category: lost counts the passes of the loop with no line under the middle sensor (20 means stopped); passes counts every pass since A (300 is the run time-out); armed is 1 from A until B, so a B during the wait cancels the start. The learner never changes the stop blocks.
  • Kitronik's own example steers the same way (each sensor stops the motor on its side) with the extension's ready-made light-or-dark block. These plans read the number and choose their own threshold, because the threshold is what the learner is learning to set.
  • Before session 2, the adult fits ring ends to five wires, bolts them to the detector's pads and fixes the board under the chassis on its stand-offs (switched off throughout), then measures the height and writes it on the chassis.
  • Readiness decides, not age: a learner who already chooses a threshold from readings and makes a rover follow a simple path with both stops can move on to R11-U3.

Planned studio features

Not built yet. The unit runs without them.

  • A line-following simulator in the studio: a drawn mat and rover, the three sensor numbers labelled as simulated inputs, the threshold and speeds labelled as code settings.
  • Printable picture cards for each session's key words, and printable learner cards.
  • A printable training mat and test card.

Sources

The facts this plan relies on, in each source's own words.