02 Wireless Interactive Motion Tracking | BOSON AI Starter kit for microbit:bit
Imagine you're participating in a field research expedition and need to monitor your teammates’ movements in real time:
When a teammate is walking normally, you want a red light above their head to flash, indicating they are safe.
If a teammate claps their hands while standing still, it signals "specimen discovered," and you want the servo motor on their backpack to activate and unfold a sampling arm.
If a teammate remains still for a long time, a flashing green light should be triggered to avoid false alarms.
However, there's no mobile signal. What should you do?
In this lesson, we’ll learn how to use two micro:bits to achieve "motion capture + wireless transmission + special effect execution." This forms the foundation of our Wireless Motion Tracking System.

Learning Objectives
1.Understand the collaborative workflow between the micro:bit CreateAI platform and wireless communication (Radio).
2.Learn the principles of micro:bit wireless communication.
3.Master how to use micro:bit's wireless communication functions.
Preparation

Learning Content
1.Principles of micro:bit Wireless Communication
The micro:bit is equipped with a built-in 2.4GHz radio communication module (Radio), which enables simple wireless communication between multiple micro:bits without the need for Wi-Fi or Bluetooth. The working principles are as follows:
The micro:bit uses a broadcasting method to send messages. Devices on the same channel and group number can receive each other’s messages.
The radio module follows a broadcast-receive model, supporting basic point-to-point, group, or multicast communication.
The signals travel through the air, with a communication range of approximately 10 to 70 meters, depending on the environment and battery condition.
2.How to Use micro:bit Wireless Communication
To enable wireless communication between micro:bits, we follow a simple rule of thumb: Set the channel, Send the message, Receive the message.
Set the Channel The micro:bit supports 256 communication channels (numbered 0 to 255). Only when two boards are set to the same channel number can they "understand each other's code" and successfully communicate.

Sending Wireless Data
When sending wireless data, you can transmit it in three different formats: strings, numbers, or name-value pairs.
Here, we use sending a string as an example.

Receiving Wireless Data
Once wireless data is received, it can be displayed on the micro:bit’s LED matrix screen.

The complete program is as follows:

Next, prepare two micro:bit boards and upload the corresponding programs to each controller.
The demonstration works as follows:

Project Practice
To enable two micro:bits to complete the full loop of “teammate motion capture → wireless transmission → on-site special effects” in an outdoor environment without mobile signal, we break the project into three progressive tasks. Each task has clear objectives and outputs, making phased debugging easier and facilitating team collaboration.
Task 1: Motion Data Collection and Model Training
Teach the micro:bit to recognize three typical actions: walking, clapping, and motionless.
Task 2: Sending Wireless Data
Broadcast the recognized actions to teammates in real time.
Task 3: Receiving Wireless Data
Make the receiver respond immediately with visible or tactile feedback based on the received strings.
Task 1: Motion Data Collection and Model Training
Here, we also need to collect data for the three types of motion: walking, clapping, and standing still, and use them to train a model.
The trained model is shown below:
Note: For detailed instructions on how to collect motion data and run the model, please refer to Lesson 1.

After completing the model training, click“Edit in MakeCode”to enter the MakeCode editor page.

Task 2: Sending Wireless Data
Hardware connection

Program Design
Function instruction
Set the wireless communication channel to 1.
When a walking motion is detected, wirelessly send the data "walking";
When a clapping motion is detected, send "clapping";
When a motionless state is detected, send "motionless".
Flowchart Analysis

Sample program

Operating Effect
When the motion detected by the micro:bit matches the action in the trained model, the corresponding pattern will be displayed on the LED matrix screen.

Task 3: Receiving Wireless Data
Hardware connection
Program Design
Function instruction
Set the wireless communication channel to 1.
When the received wireless data is "walking", the RGB light flashes red.
When the data is "clapping", the servo motor rotates (from 0 to 100 degrees).
When the data is "motionless", the RGB light flashes green.
Flowchart Analysis
Load extension library
Create a new project and give it a name. Then click“Create”to complete the project setup.

Click“Extensions”, type“boson”in the search box, find“DFRobot_bosonKit”, and click to add it.

Sample program

Operating Effect
When the wireless data received is "clapping", the servo motor rotates from 0 to 100 degrees;
when the data is "motionless", the green light flashes;
when the data is "walking", the red light flashes.

Shape Construction
Two-way confirmation: After the receiver completes the action, it sends back an “ACK,” and the sender’s LED matrix displays a checkmark (√).
Multiple action extensions: Add actions like “jumping” and “falling,” which trigger a buzzer alarm and a red warning light respectively.
Low-power mode: After being motionless for 10 seconds, the sender enters deep sleep; shaking it wakes it up, extending battery life in the field.
If you're interested in other courses, feel free to click the corresponding links to learn more.
02 Wireless Interactive Motion Tracking
06 Color Refection Exploration
07 Traffic Safety Needs Mutual Humility
09 Face Recognition Access Control
11 Vending Machine for Stray Cats & Dogs
