Lesson at a glance
maze.education/microbit/lessons/radio-treasure-hunt
- Grades
- Grades 6 to 9
- Time
- 45 to 60 minutesThe 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 codersFor 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 RoboticsFits: Grade 7, Term 3 · Where it fits
Learning intentions
Learners will learn to:
- Read the signal strength of a radio message, and explain why it changes with distance.
- Turn a reading into a bar on the display with simple arithmetic.
- 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.
Introduction
5 to 10 minutesRetrieval practiceWhy 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 statementIn 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.
- Play a quick round of hot and cold: one learner hides an object, and the class says warmer or colder as the seeker moves.
- 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?
Lesson development
35 to 40 minutes- 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?
- 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.
- 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.
- 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.
- 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.
- 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
Input Processing Output Button B is pressed Set beacon to true The diamond shows: this board is now the beacon Every 200 ms, on the beacon Send the number 0 by radio, at transmit power 1 A short radio message that the seekers can hear A message arrives at a seeker Read 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 seeker Has 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 is strength strength + 95 Value plotted, up to 50 Too far away -100 -5 0 (the max of -5 and 0) Far away -95 0 0 Halfway -70 25 25, half the bar Close -60 35 35 Very close -45 50 50, the full bar Consolidation
5 to 10 minutes- Ask: what made the bar drop even when you were close? (Bodies, walls, metal and water all weaken radio signals.)
- Ask: why did we set the transmit power to 1, not 7? Why does the program need the max of block?
- 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.
These are the MakeCode steps. The other routes are on the lesson's web page.
Build it in MakeCode blocks
- 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).
- In Variables, make beacon, strength and lastHeard. Add on button B pressed: set beacon to true and show icon with the diamond.
- From Radio, add on radio received receivedNumber. Inside, add if not beacon then.
- 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.
- 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.
- 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.
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.
No Purple Mash route for this lesson
We could not find a Purple Mash unit or project that matches this lesson, so it is MakeCode blocks, with Python as an extension. These lessons have a Purple Mash route:
Extension: text-based coding, beyond the CAPS
The same program in MicroPython, for the micro:bit Python Editor. It suits Grade 7 to 9 learners who are ready for text-based code. The CAPS itself follows a block-based approach (Coding and Robotics CAPS, Grades 7 to 9, page 24).
# Radio treasure hunt: B makes this board the beacon; every other board shows how strong the beacon's signal is.
from microbit import *
import radio
radio.on()
radio.config(group=5, power=1)
beacon = False
last_heard = running_time()
while True:
if button_b.was_pressed():
beacon = True
display.show(Image.DIAMOND)
if beacon:
radio.send("treasure")
else:
packet = radio.receive_full()
if packet:
strength = packet[1]
last_heard = running_time()
rows = max(0, min(5, (strength + 95) // 10))
for y in range(5):
for x in range(5):
if y >= 5 - rows:
display.set_pixel(x, y, 9)
else:
display.set_pixel(x, y, 0)
elif running_time() - last_heard > 2000:
display.show(Image.CONFUSED)
sleep(200)radio.receive_full() gives the message, its signal strength and the time it arrived; packet[1] is the strength. Every board in a group needs the same version, MakeCode or Python.
Open the Python editor, replace the code that is there with this program (or open the downloaded file), then click Send to micro:bit. MakeCode also has a Python view, which is written a little differently.
Extension or homework
Challenges for learners who finish early, or to take further in a club or as homework.
- Challenge 1
Hide two beacons in two different groups. Seekers press A to switch which group they listen to.
- Challenge 2
Change the transmit power from 1 to 7. How much bigger is the hunting area? Record the furthest distance for each power.
- 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.
- What does the signal strength tell the seeker?
- A board reads -50, another reads -85. Which one is closer to the beacon?
- Give two things that can weaken a radio signal.
- Why must the beacon and the seekers share a radio group?
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 for | Beginning | Developing | Accomplished | Exemplary |
|---|---|---|---|---|
| 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
- The seeker always shows the confused face.Check the beacon pressed B and shows the diamond, and that both boards have the same radio group.
- The bar is full everywhere.The transmit power is too high for the space. Set it to 0 or 1.
- The bar jumps up and down while standing still.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, 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.
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.


