Radio treasure hunt

One micro:bit hides as a radio beacon; the others hunt it down by signal strength, like a game of hot and cold played with radio waves.

Go to the code ↓

Lesson at a glance

45 to 60 minutes · Grades 6 to 9

maze.education/microbit/lessons/radio-treasure-hunt

Grades
Grades 6 to 9
Time
45 to 60 minutes
The CAPS gives Coding and Robotics 2 hours a week (Coding and Robotics CAPS, Grades 4 to 6, page 22; Grades 7 to 9, page 22).
Level
Confident coders
For confident classes: more steps to build, with variables, radio or data.
Board
Any micro:bit
Code with
MakeCode blocks, with Python as an extension
CAPS
Natural Sciences and Technology, Technology, Natural Sciences, Coding and Robotics
Fits: Grade 7, Term 3 · Where it fits

Learning intentions

Learners will learn to:

  1. Read the signal strength of a radio message, and explain why it changes with distance.
  2. Turn a reading into a bar on the display with simple arithmetic.
  3. Use one program for two jobs, beacon and seeker, chosen with a button.

Success criteria

Each learner can say:

  • I can read the signal strength of a radio message and explain why it gets weaker as I move away.
  • I can turn a signal strength into a bar by adding 95, and work out the bar for any reading.
  • I can use button B to make the same program work as the beacon or as a seeker.
  • Grades 7 to 9: I can trace what a seeker plots for five different signal strengths.

Competencies

From the Coding and Robotics CAPS places this lesson cites.

  • R.3Outline the different components of a robot

Key words

beacon
A device that sends the same short message again and again so others can find it.
signal strength
How strong a radio message is when it arrives. On the micro:bit it is a negative number: about -45 is very close, -95 is far away.
transmit power
How strongly a board sends, from 0 to 7. A low power keeps the hunt inside a small area.
range
How far away a message can still be heard.
interference
Anything that weakens or mixes up a signal, such as walls, people, water or other radios.
trace table
A table that follows the value of each variable, step by step, as a program runs.

What you need

  • A micro:bit with a battery holder for each group of three, plus one more for each group to hide
  • A computer with Chrome or Edge for each group
  • A playground, a hall or a corridor, and somewhere safe to hide each beacon (under a chair, behind a bag)

From our shop: BBC micro:bit V2 Club Pack, BBC micro:bit V2.21 Next Gen Classroom Pack, micro:bit Battery Box (Switched)

Safety

  • Agree the boundaries of the hunt first, and hide beacons only where seekers can reach them safely, never up high or near roads.
  • Clear a safe space first: no bags on the floor, and enough room for everyone to move without bumping into each other.
  • Use the battery holder with two AAA batteries. Never mix old and new batteries, and take the batteries out before the kits are packed away.

The lesson plan

One lesson of 45 to 60 minutes in three parts: introduction, lesson development and consolidation. The CAPS gives Coding and Robotics 2 hours a week, so it fits one of the week's lessons. Times are a guide.

  1. Introduction

    5 to 10 minutes
    Retrieval practice

    Why must two micro:bits share a radio group to talk to each other? (A board only hears messages sent in its own group, a number from 0 to 255.)

    Problem statement

    In South Africa's game reserves, rangers find collared animals in thick bush by following a radio signal that grows stronger as they get closer. Build a beacon and a seeker from micro:bits, and use signal strength to find a board hidden on the school grounds.

    1. Play a quick round of hot and cold: one learner hides an object, and the class says warmer or colder as the seeker moves.
    2. Read the problem statement together. Explain that every radio message arrives with a signal strength, stronger when you are closer. Ask: what could make a signal weaker even when you are close?
  2. Lesson development

    35 to 40 minutes
    1. Unplugged first. Be radio waves: the beacon learner stands still and claps steadily. Seekers close their eyes and walk slowly towards the sound (with a partner guiding them safely). Ask: how did you know you were getting closer? What made it harder?
    2. Plan on paper first. Give each group a radio group number from 0 to 255. Groups fill in an IPO table for the two jobs, beacon and seeker. Grades 7 to 9 complete the trace table: what a seeker plots for signal strengths from -100 to -45.
    3. Predict. Ask: a seeker reads -60. What value will it plot, out of 50? What will happen to the bar if you hold the board behind your back? Groups write their answers beside the plan.
    4. Build in blocks. Each group shares one computer. The driver builds the program from the Blocks tab, with the group's own number instead of 5; the navigator checks each block against the IPO table, and the third learner checks the arithmetic against the trace table. Swap roles halfway, at on radio received, so the new driver builds the seeker's bar and the forever loop. Download it to all the group's boards.
    5. Test and debug. In the simulator, press B on one board, then drag along that board's antenna to change the signal. Then press B on one real board to make it the beacon (it shows a diamond); the others are seekers. Walk away from the beacon, then towards it, and hold the board in front of you, then behind your back. Did the bar do what you predicted? If a seeker shows the confused face, check that the beacon shows the diamond and that both boards share the group number.
    6. Outside or in the hall, one learner hides the beacon while the others look away. Seekers find it using only their bars. Change jobs and time each hunt.

    Plan on paper: a model answer

    In groups, fill in an IPO table for the beacon and the seeker. Grades 7 to 9 also trace what a seeker plots for five signal strengths.

    IPO table
    InputProcessingOutput
    Button B is pressedSet beacon to trueThe diamond shows: this board is now the beacon
    Every 200 ms, on the beaconSend the number 0 by radio, at transmit power 1A short radio message that the seekers can hear
    A message arrives at a seekerRead its signal strength, note the time in lastHeard, and work out strength + 95 (never below 0)A bar graph out of 50: taller when the beacon is closer
    Every 200 ms, on a seekerHas nothing arrived for more than 2 seconds?Yes: the confused face (no signal)
    Trace table
    Grades 7 to 9: what a seeker plots for five signal strengths. The places are rough examples, because walls and bodies change the numbers.
    Where the seeker isstrengthstrength + 95Value plotted, up to 50
    Too far away-100-50 (the max of -5 and 0)
    Far away-9500
    Halfway-702525, half the bar
    Close-603535
    Very close-455050, the full bar
  3. Consolidation

    5 to 10 minutes
    1. Ask: what made the bar drop even when you were close? (Bodies, walls, metal and water all weaken radio signals.)
    2. Ask: why did we set the transmit power to 1, not 7? Why does the program need the max of block?
    3. Back to the problem: how is our hunt like a ranger tracking a collared animal, and how is it different? Where else is the idea used? Think of tracking tags for keys or finding a lost phone. Learners check themselves against the success criteria.

Build it, step by step

Pairs build the program in blocks, following the numbered steps, with the same program as text beside them to check against or paste. Test in the simulator before sending it to a board.

The beacon shows a diamond and sends every 200 milliseconds in group 5 at power 1. Seekers show a bar: one light far away at about -95, three rows at about -70, a full display very close at about -45, and a confused face if nothing is heard for 2 seconds.
Adding 95 turns the signal strength, from about -95 far away to -45 close, into 0 to 50 for the bar graph.

These are the MakeCode steps. The other routes are on the lesson's web page.

Build it in MakeCode blocks

  1. Start a New Project called Treasure hunt. In on start, put radio set group 5 and radio set transmit power 1 (under more in Radio).
  2. In Variables, make beacon, strength and lastHeard. Add on button B pressed: set beacon to true and show icon with the diamond.
  3. From Radio, add on radio received receivedNumber. Inside, add if not beacon then.
  4. Inside the if: set strength to received packet signal strength from Radio, set lastHeard to running time (ms) (under more in Input), and plot bar graph of the max of strength + 95 and 0 (in Math), up to 50. Adding 95 turns -95 (far) into 0 and -45 (close) into 50.
  5. In forever, add if beacon then radio send number 0, else if running time minus lastHeard > 2000 then show icon with the confused face (no signal). End with pause (ms) 200.
  6. In the simulator, press B on one board, then drag along that board's antenna to make its signal weaker or stronger. Then Download to every board in the group: only real boards show how distance changes the signal.
The same blocks as text (to paste into MakeCode)
let lastHeard = 0
let strength = 0
let beacon = false
input.onButtonPressed(Button.B, function () {
    beacon = true
    basic.showIcon(IconNames.Diamond)
})
radio.onReceivedNumber(function (receivedNumber) {
    if (!(beacon)) {
        strength = radio.receivedPacket(RadioPacketProperty.SignalStrength)
        lastHeard = input.runningTime()
        led.plotBarGraph(Math.max(strength + 95, 0), 50)
    }
})
radio.setGroup(5)
radio.setTransmitPower(1)
basic.forever(function () {
    if (beacon) {
        radio.sendNumber(0)
    } else if (input.runningTime() - lastHeard > 2000) {
        basic.showIcon(IconNames.Confused)
    }
    basic.pause(200)
})

To use the text instead: open MakeCode, start a new project, click JavaScript at the top, replace what is there with this code, then click Blocks to see it as blocks.

To send it to the board, click Download. In Chrome or Edge, MakeCode can connect to the micro:bit by USB so the program goes straight onto it. Otherwise a .hex file downloads: drag it onto the MICROBIT drive.

Extension or homework

Challenges for learners who finish early, or to take further in a club or as homework.

  1. Challenge 1

    Hide two beacons in two different groups. Seekers press A to switch which group they listen to.

  2. Challenge 2

    Change the transmit power from 1 to 7. How much bigger is the hunting area? Record the furthest distance for each power.

  3. Challenge 3

    Make the beacon send its own clue, such as a letter, and collect all the letters to spell a word.

Support and extension

Support

For learners who need more help

  • Give groups the finished program and spend the lesson on the hunt and on explaining what changes the bar.
  • Start indoors with the beacon in plain sight, and walk towards and away from it to see the bar change.

Extension

For learners who are ready for more

  • Measure it: stand 1, 2, 4 and 8 metres from the beacon, record the signal strength with show number, and plot strength against distance.
  • Add sound: on a micro:bit V2, beep faster as the signal gets stronger, so the seeker can hunt without looking at the screen.

Informal assessment

Ask these as learners work. Informal assessment happens every day and is not recorded.

  1. What does the signal strength tell the seeker?
  2. A board reads -50, another reads -85. Which one is closer to the beacon?
  3. Give two things that can weaken a radio signal.
  4. Why must the beacon and the seekers share a radio group?
Exit question

A seeker reads -75. What value does it plot on the bar, out of 50, and why do we add 95?

Observation checklist

Watch pairs as they plan, build and test. Write each pair's initials under the level you see.

Watch forBeginningDevelopingAccomplishedExemplary
Fills in the IPO table for both jobs, beacon and seeker.
Works out strength + 95 correctly, including a reading below -95.
Predicts how the bar will change, then tests it by moving.
Takes a turn as driver, navigator and checker of the arithmetic.
Explains why distance, bodies and walls weaken the signal.
Beginning:
not yet, even with help
Developing:
with help
Accomplished:
on their own
Exemplary:
on their own, and explains it or takes it further

The four levels are the CAPS rubric levels (Coding and Robotics CAPS, Grades 4 to 6, page 176; Grades 7 to 9, page 163). The short descriptions are ours.

This lesson is not a formal task, but it is good practice for the term's practical task in Grades 4 to 6 (Coding and Robotics CAPS, Grades 4 to 6, page 170), and for the mini-PATs in Grades 7 to 9 (Coding and Robotics CAPS, Grades 7 to 9, page 157).

Common mistakes and fixes

  • Problem: The seeker always shows the confused face.Fix: Check the beacon pressed B and shows the diamond, and that both boards have the same radio group.
  • Problem: The bar is full everywhere.Fix: The transmit power is too high for the space. Set it to 0 or 1.
  • Problem: The bar jumps up and down while standing still.Fix: Radio signals bounce off walls and people. Hold the board still and in front of you, and read it over a few seconds.

Where it sits in CAPS

  • Coding and RoboticsFitsGrade 7, Term 3: radio communication between two micro:bits. Using signal strength goes further than the CAPS.Source: Coding and Robotics CAPS, Grades 7 to 9 (opens in a new tab), Grade 7, Term 3, Robotics, R.3 Outline the different components of a robot, page 79: Basic introduction to Radio Communication (2 Devices)
  • Natural SciencesFits Natural Sciences: radio waves carry energy, get weaker as they spread out, and are blocked by water, metal and bodies.
  • TechnologyFits Technology: how tracking tags, lost phone finders and animal collars find things by signal strength.

Coding and Robotics quotes come from the Department of Basic Education's final CAPS, with the page number of the 2024 printed edition (the Department's October 2025 library copies number their pages differently). Schools may teach a topic in another term: the CAPS leaves the order to each school's annual teaching plan.

Ready to teach it?

Get a micro:bit for every learner or pair, and let us train your staff to run lessons like this one.

More lessons

All lessons →
  • Grades 6 to 9

    Grades 6 to 945 to 60 minLevel: Some experience

    Reaction timer

    Wait for the dot, then press A as fast as you can: learners time their reactions in milliseconds and analyse the class's data.

    Subjects: Mathematics · Coding and Robotics

    Code with: MakeCodePython

  • Grades 6 to 9

    Grades 6 to 945 to 60 minLevel: Some experience

    Plant moisture checker

    Two crocodile clip leads and a pot plant: the micro:bit measures how damp the soil is and asks for water when it is dry.

    Subjects: Natural Sciences and Technology · Technology · Natural Sciences · Coding and Robotics

    Code with: MakeCodePurple MashPython

  • Grades 6 to 9

    Grades 6 to 945 to 60 minLevel: Confident coders

    Traffic lights

    Learners program a robot (a South African traffic light) with a pedestrian button, and plan the system as a flowchart first.

    Subjects: Natural Sciences and Technology · Technology · Coding and Robotics

    Code with: MakeCodePython

micro:bit is a trade mark of the Micro:bit Educational Foundation, and BBC is a trade mark of the British Broadcasting Corporation. Maze Education is an independent reseller of genuine BBC micro:bit products. Our teacher training and our other products and services are our own, and are not endorsed by the Foundation or the BBC.

WhatsApp