Use your BBC micro:bit to improve your game by collecting sports science data on the strength of kicks or racket strokes.
This project uses the micro:bit’s accelerometer sensor and data logging feature to log and store data on how hard you kick a ball, or hit a racket, over a short period of time. You can then study the data on a computer to improve your consistency or performance over time, in the same way sports professionals use data science to help improve their performance.
- Put the code on a micro:bit V2 and attach a battery pack. When you’re ready to collect data, tuck it inside your sock (or strap it to your wrist.)
- Press button A to start logging data. The display shows a tick (check mark).
- Try some different types of moves over a short period of time. For example, spend a couple of minutes taking three penalty kicks, then make three passes.
- If you see a cross on the display, that means the micro:bit was accidentally reset. Delete the old data by touching the logo, and at the same time hold down button A and press button B. Then press button A to start logging again.
- Unplug the battery pack when you’ve finished collecting data.
Analysing the data
Plug the micro:bit into a computer’s USB socket.
Look for the MICROBIT drive on the computer. Double click on the MY_DATA file to see your data in a web browser. Then click on ‘Visual preview’ to view your data on a graph.
The graph shows time along the X axis and the strength of acceleration in the Y axis. This is measured in milli G. The larger the number on the Y axis, the more acceleration that was measured and the stronger your kick.
Can you identify your three penalty kicks and your three passes? Was your strongest kick your most accurate? You could compare your performance and consistency over time, or with other players.
You can download the code from this page and use it straight away. Or, if you want to code the kick strength data logger yourself, watch the coding video above.
- micro:bit V2 and battery pack
- computer and micro USB cable for coding the micro:bit and viewing your data
- our data logging guide may be useful
Step 2: code it
Step 3: improve it
- Use data from the kick-strength meter to help you and a partner improve the consistency of your passes over a period of time.
- Collect data over longer periods of time by logging less often. Change the time in the ‘every’ block to a larger number.
- Add an audible or visual alert if your kick strength goes over a certain value.
This content is published under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) licence.