01 Motion Capture Assistant | BOSON AI Starter kit for microbit:bit

In today’s fast-moving world of technology, artificial intelligence (AI) has already woven itself into almost every aspect of our lives. From smart homes to wearable devices, AI is bringing unprecedented convenience and innovation. Yet, learning and applying AI does not require expensive equipment or an advanced technical background. With the micro:bit CreateAI platform, even absolute beginners can begin exploring AI with ease.

Next, we will learn how to use the micro:bit V2 to collect motion data, train an AI model, and then deploy it to the device so it can accurately recognize the actions we perform.

Learning Objectives

1.Understand the features and purpose of the micro:bit CreateAI platform.

2.Learn to use the micro:bit V2 for data collection and AI model training.

3.Master how to deploy a trained AI model to the micro:bit and create a simple application.

Preparation

Learning Content

Machine Learning & the micro:bit

Machine learning (ML), a major branch of AI, enables computers to learn and improve automatically from data without explicit programming. At its core, ML uses algorithms to discover patterns and rules in large sets of data and then applies those rules to make predictions or decisions on new data. ML is used everywhere, from smart fitness trackers to self-driving cars and medical diagnostics.

In education, ML excels as well. It can handle both large and small datasets, making it perfect for classroom use with teaching tools like the micro:bit. For example, students can use the micro:bit’s accelerometer to collect their own motion data, then analyze it with an ML algorithm. In this way, students experience firsthand how ML works—training a model to recognize different motion patterns such as walking, running, or jumping—and gain a deeper understanding of data-driven decision-making.

This combination not only deepens students’ grasp of machine learning but also sparks their interest in computer science and data analysis. Through hands-on exploration, they see the real-world value of ML in everyday life.

Using the micro:bit Create AI Tool

To give the micro:bit ML capabilities, we use the free, web-based micro:bit Create AI tool. It lets students explore AI through motion and ML, then bring it into the real world with the BBC micro:bit. Students collect their own data to train, test, and refine an ML model that can recognize and respond to different actions. Afterwards, they can use MakeCode to build programs that run on any micro:bit.

1.In the browser address bar, type “createai.microbit.org” and press Enter.

2.Click the “Get started” button on the micro:bit Create AI site.

3.In the new page, click the “+” under “New Session” to create a new project for motion-data collection and model building.

3.Connecting the micro:bits

Step 1: Connect the 1st micro:bit for data collection

Use the USB cable to connect the micro:bit to the computer, then follow the on-screen prompts.

When the first micro:bit is successfully connected, its LED matrix shows a smiley face. Then unplug the USB cable and power the micro:bit with the battery pack.

Step 2: Connect the 2nd micro:bit for wireless link

After the first micro:bit is connected, click “Next” on the screen and repeat the same steps to connect the second micro:bit.

When both micro:bits are connected, the second one will display a diamond pattern.

Once both micro:bits are connected, try shaking the battery-powered first micro:bit and watch the real-time graph change on the micro:bit Create AI platform.

Project Practice

This project is divided into three main tasks: collecting motion-data samples, training the machine-learning model, and deploying the trained model onto the micro:bit.

Task 1: Collect Motion-Data Samples

Use the micro:bit’s built-in accelerometer to collect motion data and save the samples for later model training.

Task 2: Train & Test the Model

Use Create AI to analyze the collected data, train the ML model, and test its accuracy and performance.

Task 3: Deploy the Model & Code to the micro:bit

Download the trained model to the micro:bit, modify the code, and observe your own motion data.

Task 1: Collect Motion-Data Samples

The data samples collected here are generated by measuring motion changes along the x, y, and z axes using the micro:bit’s accelerometer, and then wirelessly transmitting the data to micro:bit CreateAI.

micro:bit CreateAI displays this data in a real-time chart and instantly responds to the micro:bit’s movements.

Next, we will begin collecting motion data. Follow the detailed steps below:

1.Choose the motion to collect

After modifying the micro:bit, wear it on your wrist to gather walking data. You may also collect clapping, waving, running, or jumping data.

2.Name the action

In Create AI, type a name in the “Action name” box and pick an icon.

3.Record the sample data

Two ways to start recording:

• Click the “Record” button in the interface.

• Press the B button on the data-collecting micro:bit.

Each action needs at least three samples, but more data usually improves the model (up to 10 consecutive samples).

4.Filter the samples

Discard low-quality or invalid samples manually; keep only valid ones.

5. Collect a second data sample

After the walking samples are ready, click “Add Action” to create a “Clap” action.

Follow the same steps to record clapping data.

Task 2: Train & Test the Model

1.Train the model

In Task 1, we collected two distinct motion-data samples—“walking” and “clapping”—and filtered them to keep only the valid data. Next, click the “Train Model” button to begin ML model training.

2.Test the model

When training finishes, you’ll automatically enter the “Test Model” tab.

Perform the “Walking” and “Clapping” actions and watch whether the trained model recognizes each one.

3.Improve the model

If the model underperforms, refine the collected data or add extra classes such as “motionless” or “Other”; record samples for these as well.

Task 3: Deploy the Model & Code to the micro:bit

1.Switch to MakeCode

Click the "Edit in MakeCode" button to open the MakeCode programming interface.

In the MakeCode toolbox you’ll find new ML blocks, and a starter program using your trained model will appear automatically.

2.Download the program

Download the starter program to your micro:bit following the on-screen instructions. When the micro:bit detects an action that matches your model, the LED matrix will display the corresponding pattern.

4. Extending the program

As with any MakeCode project, you can modify the code. Try logging how long each action lasts:

• Press button A → show walking duration (seconds)

• Press button B → show clapping duration (seconds)

• Press buttons A+B together → show motionless time Reset the timers with the reset button on the back of the micro:bit or by disconnecting and reconnecting the battery pack.

icon 1. Motion Capture Assistant.rar 1.81MB Download(0)
License
All Rights
Reserved
licensBg
0