Home · Academy · Robotics & Coding · micro:bit · Project: Wireless Scoreboard

Project: Wireless Scoreboard

Build a wireless scoreboard that works with two micro:bits and radio.

PROJECT COMPASS

What will you use this page for?

Core idea

We make two micro:bits talk over radio, so that pressing a button on one board updates the score shown on the other board wirelessly.

Evidence to produce

Complete the page task with your own input, test conditions and reasoning.

Control trap

Setting the two boards to different groups This is the most common mistake. If the sender and receiver are not on the same group, the message never arrives. Make sure the group number is identical in both programs. Forgetting to turn the radio on In MicroPython, if you do not write radio.on() , the radio stays off and…

Next connection

Project: Bike Safety Light Prototype: We turn the micro:bit into a wearable safety device and design a light system that improves visibility in the dark.

Module sources: Python Tutorial · Arduino Learn

LevelBeginner
Age10–16
Duration45–75 min
PrerequisiteProject: Step Counter
ContentProject guide · 1,667 words
Last updated

One-sentence summary

We make two micro:bits talk over radio, so that pressing a button on one board updates the score shown on the other board wirelessly.

Why it matters

In a basketball game the scoreboard usually sits at the side of the court, and the person keeping score does not hold the scoreboard in their hand. The scorekeeper and the board are often in different places. This lesson does exactly that: one micro:bit becomes the "remote that counts points," and the other becomes the "board on the wall."

Every program you have written so far ran inside a single board. This project connects two devices for the first time. A button pressed on one board changes the display on another board wirelessly. That is a small version of how phones, game controllers and smart-home devices work.

Inside every micro:bit there is a radio. The radio is a wireless way for boards to send each other short messages, just like two walkie-talkies talking on the same channel. In this lesson we will set up the radio, send a message, and show a message that arrives. These three skills are the foundation of every multi-device project that follows.

How the radio works

Group: being on the same channel

For two micro:bits to hear each other, they must be in the same radio group. A group is a number between 0 and 255 and works like a "channel." If everyone in the class uses a different group, the messages do not get mixed up.

Think of it like a walkie-talkie channel: two friends on channel 7 can hear each other; if one is on 7 and the other on 3, they cannot hear each other no matter how loud they shout.

Sender and receiver

There are always two roles on the radio:

In this project one board is always the sender and the other is always the receiver. Both must be set to the same group.

Variable: remembering the score

The score is a number, and it should go up by 1 each time the button is pressed. To store this number we use a variable. A variable is a named box that we put a value into and can change later. We will call it score and set it to 0 at the start.

Step by step: build the scoreboard

1. Sender board (the remote)

Here is the logic of the sender board in MakeCode blocks:

on start
  set radio group to 7
  score = 0
on button A pressed
  change score by 1
  radio send number: score
  show number score

The same program in MicroPython:

from microbit import *
import radio

radio.config(group=7)
radio.on()
score = 0

while True:
    if button_a.was_pressed():
        score += 1
        radio.send(str(score))
        display.show(score)

Because radio.send sends text, we turn the number into text with str(score).

2. Receiver board (the board)

The receiver board has only one job: show the message when it arrives.

on start
  set radio group to 7
on radio received (receivedNumber)
  show number receivedNumber

In MicroPython:

from microbit import *
import radio

radio.config(group=7)
radio.on()

while True:
    message = radio.receive()
    if message:
        display.scroll(message)

radio.receive() returns None when there is no new message, so if message: makes sure we only display a real message when one arrives.

3. Program both boards

You need to load two different programs onto two micro:bits: the sender program on one, the receiver program on the other. Make sure both are on group 7.

Testing: does it really work?

Project test matrix
TestConditionExpected behaviourObserved resultNext decision
NormalStandard input and complete connectionThe core task is completedFill in during testingKeep it or make a small improvement
BoundaryLowest or highest accepted valueThe system remains stableFill in during testingReview the threshold or rule
FailureMissing, incorrect or unexpected inputA safe and understandable responseFill in during testingAdd error handling
RepeatAt least three trials under the same conditionSimilar resultsFill in during testingInvestigate the source of inconsistency

Writing a project is not enough; you must confirm it by trying different situations. Test these scenarios in order:

  1. First press: Press A once on the sender board. The receiver should show 1.
  2. Counting: Press A five times in a row. The receiver should climb 1, 2, 3, 4, 5.
  3. Distance: Move the boards a few metres apart and try again. The radio should still work.
  4. Group separation: Have a friend's board on group 3. Their presses should not change your board.

For each scenario, write down what you expect first, then watch what actually happens. If the two are different, there is a bug.

A bug and its fix

On my first try, the receiver's display never changed. The sender board showed 1, 2, 3, but the board stayed blank.

I compared the expected result with the actual result:

Goal: When the sender presses A, a number appears on the receiver
Problem: The sender counts correctly, but the receiver never reacts
Check: The sender group is 7, the receiver group is set to 1
Fix: Set the receiver group to 7 as well

The problem was that the two boards were on different radio groups. Like two walkie-talkies on different channels, the messages were being sent, but the other side was not listening on that channel. Once both groups were 7, the score appeared instantly.

This bug is very common, and it gives a useful reminder: if a wireless system does not work, first check whether both sides are on the same group.

Improve the project

Once the basic system works, you can move it closer to the rules of basketball:

Two different point values

In basketball a free throw is 1 point and a normal basket is 2 points. Let's add 2 points to button B:

on button A pressed
  change score by 1
  radio send number: score
on button B pressed
  change score by 2
  radio send number: score

Reset by shaking

For a new game you want to reset the score. Thanks to the micro:bit's accelerometer, shaking the board can be used as an event:

on shake
  score = 0
  radio send number: score

This addition shows how the accelerometer you met in earlier modules connects to this project.

Mini practice

Grab two micro:bits with a friend and complete this task:

  1. Load the sender program on one and the receiver on the other (group 7).
  2. Let one person keep score while the other watches the board across the room.
  3. After five presses, check that the board shows the correct number.
  4. Then add 2 points with button B, and reset by shaking.

Keep a record: Which group number did you use? Did it work on the first try, or did you fix something? These notes stop you from falling into the same mistake on your next project.

Common mistakes

Setting the two boards to different groups

This is the most common mistake. If the sender and receiver are not on the same group, the message never arrives. Make sure the group number is identical in both programs.

Forgetting to turn the radio on

In MicroPython, if you do not write radio.on(), the radio stays off and no message goes anywhere. In MakeCode, placing the radio-group block turns the radio on automatically.

Sending a number without turning it into text

In MicroPython radio.send expects text. Writing radio.send(score) gives an error; you must write radio.send(str(score)).

Resetting the score inside the loop

If you accidentally put score = 0 in the part that runs forever, the score resets on every pass and never goes up. The reset should happen only at the start.

Safety note

Lesson summary

Check questions

  1. Which setting must be the same for two micro:bits to hear each other?
  2. On which event does the sender board send a message, and when does the receiver change its display?
  3. Why do we write radio.send(str(score)) in MicroPython instead of radio.send(score)?
  4. If the receiver never reacts but the sender counts correctly, what is the first thing you check?
  5. Which event block do you add to give 2 points with button B?

Answers

  1. The radio group must be the same. Boards on different groups cannot hear each other, like walkie-talkies on different channels.
  2. The sender board sends a message when button A is pressed; the receiver changes its display when a number is received over radio.
  3. Because radio.send expects text. Sending the number directly gives an error; str(score) turns the number into text.
  4. I check whether the two boards are on the same radio group; this is the most common mistake.
  5. I add the on button B pressed block; inside it I increase the score by 2 and send the updated score over radio.

Source and verification note

For “Project: Wireless Scoreboard”, verification focuses on whether the relationship between How the radio works and Sender and receiver remains consistent across examples. MakeCode and MicroPython names can vary slightly by version. Test in the simulator first; when external components are connected, check the board’s pin and voltage limits separately.

Next lesson

Project: Bike Safety Light Prototype: We turn the micro:bit into a wearable safety device and design a light system that improves visibility in the dark.

Start QuizBack to micro:bit
QUESTION POOL

Reinforce this lesson with 10 questions

This lesson has a pool of 20 questions. Each attempt selects 10 and reshuffles the choices.