Skip to content


Movement data logger

중급 | MakeCode | LED, 가속도 센서, 데이터 로깅, 버튼 | 과학적으로 일하기, 데이터 처리, 불 논리, 센서, 정보 다루기, 측정, 통계 & 그래프

1단계: 만들어 보세요.

프로젝트 소개

Use data logging with your BBC micro:bit V2 to gather accelerometer readings to help design a personalised fitness tracker.


프로그래밍 가이드


  • a micro:bit V2
  • a computer and micro USB cable for coding the micro:bit and viewing your data
  • micro:bit battery pack
  • our data logging guide may be useful

Gather data

  • Transfer the code below to your micro:bit, then disconnect it from your computer.
  • Connect a battery pack and attach the micro:bit to your shoe or leg.
  • Previous data is deleted when you transfer new code to your micro:bit, but you can also delete old data by pressing buttons A and B together.
  • Press button A to start logging data. A tick appears on the display. It is now recording accelerometer data ten times every second.
  • Start walking and count how many steps you take - try ten to start with.
  • In the very unlikely event the micro:bit log becomes full, all the lights on the LED display will light up.
  • Press button B to stop logging. You should see an X appear to show it’s stopped.

Analyse your data

  • Disconnect the battery pack and plug the micro:bit into a computer.
  • The micro:bit appears like a USB drive called MICROBIT. Look in there and open the MY_DATA file to see a table of your data and a visual preview in your web browser:
The MICROBIT drive as it appears in Windows
The MY_DATA file as it appears when you open it in a web browser
  • 가속도 센서로부터 받은 데이터가 3D로 저장되었습니다.
diagram showing the x, y and z axes of the micro:bit accelerometer
  • Click on visual preview to see the data as a graph. Examine it and see if you can spot where the user took ten steps:
A graph showing accelerometer data in 3 dimensions with 10 peaks

Use your data

Studying this data you can see that almost every time a step was taken, the reading in the Z axis went above 500.

So with this data set, we might use the number 500 as the threshold to use in the Sensitive step counter project, modifying the 'acceleration (mg) strength' block to read 'acceleration (mg) z > 500'.

This means that you've collected data that's unique to the way you walk, and used it to make a personalised digital product that works better for you.

2단계: 프로그래밍 해보세요.

3단계: 더 좋게 만들어 보세요.

  • You could use the movement data logger to compare different parachutes and how they affect the acceleration of a micro:bit as it falls.
  • Copy and paste the data into a spreadsheet to analyse it in different ways, for example using statistical tools.
  • Use a spreadsheet to visualise the data in other ways and make a presentation about your project.