Using Micro:bit to Understand Machine Learning


Posted on

Close up of micro:bit © gargantiopa - stock.adobe.com

During my work experience at Lancaster University, I contributed to a project exploring how AI and machine learning can be taught to students in a way that feels interactive and interesting instead of intimidating and confusing.

To tackle this problem, I researched how micro:bits can be used to let students explore and experiment with movement tracking, coding and machine learning. My goal throughout was to inform students not only about how AI may be used, but also about the details of how it works.

Close up of girl at laptop with micro:bit

What is a micro:bit and how does it work?

Micro:bits are small devices with built-in sensors such as an accelerometer, which can track movement when the device is tilted, shaken or moved. Using this, students can record different movement samples by physically moving the micro:bit in certain ways, for example swinging it left and right or moving it in a circular motion.

The CreateAI website then uses machine learning to look for patterns within data collected from the movement of the micro:bit. After many samples have been recorded, AI can begin to recognise which movements are being performed based on the patterns it has already been shown. In many ways, this is similar to how humans learn. The more examples AI is given, the better it becomes at recognising patterns and predicting actions correctly.

What is a micro:bit and how does it work?

Micro:bits are small devices with built-in sensors such as an accelerometer, which can track movement when the device is tilted, shaken or moved. Using this, students can record different movement samples by physically moving the micro:bit in certain ways, for example swinging it left and right or moving it in a circular motion.

The CreateAI website then uses machine learning to look for patterns within data collected from the movement of the micro:bit. After many samples have been recorded, AI can begin to recognise which movements are being performed based on the patterns it has already been shown. In many ways, this is similar to how humans learn. The more examples AI is given, the better it becomes at recognising patterns and predicting actions correctly.

What did I do?

I began by testing different movements by recording samples and demonstrations of me performing actions while holding the micro:bit. It tracks movement in three directions: left and right (the x-axis), up and down (the y-axis), and forward and backward (the z-axis). These changes in direction are displayed on a graph, with each axis represented by a different colour.

For each direction, the system records data such as the highest and lowest points or the average movement values. It displays this visually using dark blue for high or significant values and light blue for lower values.

These recorded values are what AI uses to learn about movement patterns. For example, running may create larger spikes in movement than walking, allowing AI to recognise the difference between the two activities. AI compares this data to all previous running samples in order to identify common characteristics. It can then use this information later to decide whether a new movement is similar to what running “looks like” in the data.

I began by testing different movements by recording samples and demonstrations of me performing actions while holding the micro:bit. It tracks movement in three directions: left and right (the x-axis), up and down (the y-axis), and forward and backward (the z-axis). These changes in direction are displayed on a graph, with each axis represented by a different colour.

For each direction, the system records data such as the highest and lowest points or the average movement values. It displays this visually using dark blue for high or significant values and light blue for lower values.

These recorded values are what AI uses to learn about movement patterns. For example, running may create larger spikes in movement than walking, allowing AI to recognise the difference between the two activities. AI compares this data to all previous running samples in order to identify common characteristics. It can then use this information later to decide whether a new movement is similar to what running “looks like” in the data.Screenshot of samples recorded on micro:bit

This is a screenshot from some of the samples I have recorded on the micro:bit and how the data is shown visually. It displays the difference between how running and walking may present and the patterns that machine learning looks for.

Creating an informative outreach session

When thinking about how to turn this into an informative outreach session, I created a game using the motions that can be recorded. Students record different movements and test whether the computer could accurately identify the actions being performed. This also introduced an element of simple coding, using action blocks to display words or images on the screen when a movement had been detected.

Using two micro:bits, one student could perform a sequence of actions while the other device attempted to identify them, allowing the rest of the group to guess the sequence of movements. The game also encouraged students to think about why AI can sometimes make mistakes and how important the quality of training data is within machine learning systems. When recording data, I had to think carefully about which movements would produce clear and recognisable patterns for AI to analyse.

What did I learn?

If the movement samples were too similar or only recorded from one person, the predictions became less accurate. This demonstrates how bias can appear within machine learning systems. If AI only learns from a small or limited set of data, it may begin to assume that everybody performs movements in exactly the same way. In reality, different people move at different speeds, rhythms and intensities, meaning AI needs a wide range of varied samples in order to generalise accurately.

During testing, I noticed that some movements were occasionally misclassified or not recognised at all. By analysing the graphs and comparing the recorded data, I was able to identify where the samples lacked variation or consistency and then improve the training data by recording additional examples. This demonstrated how machine learning systems rely heavily on both the quantity and quality of the data on which they are trained.

Imogen Tao is a student at Lancaster Girls’ Grammar School. She worked on this project under the supervision of Dr Henry Moss.

Related Blogs


Disclaimer

The opinions expressed by our bloggers and those providing comments are personal, and may not necessarily reflect the opinions of Lancaster University. Responsibility for the accuracy of any of the information contained within blog posts belongs to the blogger.


Back to blog listing