Control the Finch with a Magic Wand
The information in this section is provided by Micro:bit’s Create AI User Guide. For more information, visit micro:bit CreateAI | micro:bit
What is machine learning?
Machine learning (ML) is a type of AI where computers can learn from and make decisions based on data. It’s widely used to power many kinds of technology, including smart fitness trackers and tagging photos with the names of your friends.
ML also works well in education because it can be simplified to work with small sets of data. This makes it ideal for classroom use with the micro:bit, allowing students to experience how ML works for themselves using personal movement data they gather from the micro:bit’s accelerometer sensor.
What is Micro:bit CreateAI?
Micro:bit CreateAI is a free, web-based tool that makes it easy for students to explore AI through movement and machine learning (ML). Micro:bit CreateAI allows you to explore the vital role data plays in AI systems, and develop AI literacy. It also helps to consolidate computer science learning and skills of data literacy used in mathematics and science.
You can use micro:bit CreateAI to train an ML model and then run it on your BBC micro:bit V2.
- Collect movement data from the micro:bit accelerometer
- Train an ML model to recognize patterns in the data
- Code the micro:bit to run ML models and take your creation anywhere
In this activity, you will create a gesture recognition model to recognize motion patterns on a micro:bit attached to a “magic wand”. We will then create a program that makes the Finch Robot react to the different motions using radio communication between the two micro:bits.

Credit: micro:bit Foundation
This activity utilizes the MakeCode programming language. If you are not familiar with MakeCode, we recommend you complete our Finch with MakeCode tutorials prior to starting this activity.
Materials Needed:
- A Finch Robot 2.0 with V2 micro:bit
- A computer (desktop, laptop or Chromebook) with Chrome or Edge browser with bluetooth enabled
- A second V2 micro:bit with battery pack
- USB data cable
- Two AAA batteries (for micro:bit battery pack)
- A magic wand (see example below)
Your magic wand can be designed any way you want! Get creative and make something magical! Be sure your micro:bit and battery pack are securely attached to your wand in some way. Here is an example build.

1. Visit https://createai.microbit.org/new
3. Connect your V2 micro:bit attached to your wand to your computer using the USB cable. Select the blue Connect button at the bottom of your screen and then follow the on-screen instructions to turn your model into a datalogger micro:bit.
Instructions provided by the micro:bit Foundation. For further reference, CreateAI User Guide
5. Your micro:bit should match the pattern shown on the screen. If it does not, select the cells to match the icon you see on your micro:bit’s 5×5 LED Display. Follow the on-screen instructions to connect via bluetooth.
Instructions provided by the micro:bit Foundation. For further reference, CreateAI User Guide
7. You will now begin recording data samples. Determine how you would like to hold your wand for all of your actions BEFORE you begin recording. For best results, choose a comfortable hand position to start and stop the actions. We recommend holding the wand straight out in front of you (like you’re pointing straight ahead)
The THREE gestures we will use for this model are “up and down, “side to side”, and “circle.”
Note: If using gestures other than the three provided, you will want to choose wand actions that are distinct and easily recognizable. If your gestures look too similar, it could result in false positives or negatives.
9. Start moving your wand in an up and down motion. What do you notice about the live data graph at the bottom of the screen while you are moving your wand?
While you are continuously moving your wand up and down, select the red “Record” button to record your data sample.
Do this at least 5 times, so you have at least 5 data samples.
12. Click the blue Add Action button again. Name your third action “Circle.” Repeat steps 9 and 10 using a circle motion this time.
Note: For best results, change the position you are holding your wand. Instead of holding it straight in front of you, lift your wand up next to your face and spin it like you’re doing a lasso spin with a rope!
14. Once you have collected enough data and checked that you have no data outliers, you are ready to train your model!
3. Recognition Point: You can adjust the recognition point to remove false positives. We recommend setting the recognition point to 90% or above for all gestures except “at rest”.
This means your model will not identify any of the three wand gestures unless it is 90% certain or higher that it is recognizing that motion.
1. Start by downloading the default program that opens in MakeCode on to your micro:bit. Plug your USB cable into the micro:bit on your magic wand and select Download.
MakeCode will ask you if you want to use the same or a different micro:bit. Select Same micro:bit.
Follow the on-screen instructions.
2. Now when you do your wand gestures, you should notice the icons on the micro:bit changing to match the code.
5. The certainty block allows you to set a different threshold from the one you chose in the training phase (refer to Step 3 in “Training and Testing your Model”)
The code on the right shows examples of different ways you can program this model. On the left, you have the on ML start event buttons. On the right, you have if-else statements that can program your model to be more precise, if needed.
2. You will be coding a “sender” program for the micro:bit that is attached to your magic wand.
Drag out an on start block from the blue BASIC category. Then drag a radio set group block from the pink RADIO category and place that in the on start block. Click the number in the radio set group block to set the radio group number. You can use any number between 1 and 255. Remember this number!
Note: If you are in a classroom with multiple students, each student needs to choose a DIFFERENT radio group number. That way YOUR magic wand can talk to YOUR Finch.
3. Drag a radio send number block from the pink RADIO category and place one block into each of the on ML start event blocks. Next, drag a show number block from the blue BASIC category beneath each radio send number block.
Send a different number for each gesture. For our model, we will send a 1 for “up and down”, a 2 for “side to side”, a 3 for “circle” and a 4 for “at rest”
The reason we added the show number block is so that when you make your gestures, you can see the number that is being sent to the micro:bit. This can help with debugging!
4. SAVE your radio sender project to your computer. For instructions on how to save your project, visit https://microbit.org/get-started/user-guide/microbit-createai/#saving-and-loading
DOWNLOAD this code to the micro:bit in your magic wand.
TRY IT OUT! Do your different gestures and look at the numbers on your wand. Does your project work as expected? Do you need to do any debugging?
5. Use the link below to open a new MakeCode editor with a Finch Starter code.
You should now have two MakeCode windows open.
12. Now that your radio sender and receiver codes are built, let’s add some commands for the Finch! The code on the right will make the Finch do the following tasks based on the magic wand gestures:
- IF you move your magic wand up and down, THEN the Finch will move forwards 10 cm, then backwards 10 cm, then stop.
- IF you move your magic wand from side to side, THEN the Finch beak and tail lights will flash different colors rapidly 4 times in a row and then turn off.
- IF you move your magic wand in circles, THEN the Finch will turn around in a circle and then stop.
- IF your magic wand is at rest, THEN the Finch will not react.
13. SAVE your Finch project to your computer. For instructions on how to save your project, visit https://microbit.org/get-started/user-guide/microbit-createai/#saving-and-loading
DOWNLOAD this code to the micro:bit in your Finch Robot.
TRY IT OUT! Turn your Finch on and do your different gestures and look at the way the Finch reacts. Does your project work as expected? Do you need to do any debugging?
14. Going Further: Now that you know how to program your Finch to react to gestures you make with a magic wand, you can make this project your own!
Here are some suggestions!
- Modify the code to make the Finch react differently to each of the gestures.
- Create a new model using different gestures that you choose.
- Make the Finch’s reactions more complex! Modify the code so that each gesture controls both the Finch wheels AND lights. Maybe even add sounds too!




















