micro:bit Step Counter

In this activity, students turn the micro:bit into a wearable step counter (pedometer) that tracks physical movement using the built-in accelerometer. The program detects motion (specifically a “shake” gesture) each time a step is taken and increases a stored variable to keep count of total steps.

Grade Levels: 3 - 12
Subject Matter: Algorithms, Physical Computing, Programming, Cross-Curricular Integration: Math
Concepts: Programs and Algorithms, Computing Devices and Systems, Data and Information
Standards: 6-8.PA.2, 6-8.CD.2, K-2.PA.1, K-2.PA.2, K-2.PA.3, K-2.PA.4, 3-5.PA.2, 3-5.PA.3, 6-8.PA.1, 6-8.CD.3, 6-8.PA.3, 3-5.DI.1, 3-5.DI.3, 3-5.DI.4, 6-8.DI.1, 6-8.DI.2, 3-5.CD.2, 3-5.CD.1, K-2.CD.2, 6-8.CD.1
  • Average Rating: 0.0 (0 ratings)

Activity Instructions

  1. Introduce the Activity, Discuss:
    • Have you ever used a smartwatch or fitness tracker?
    • How does it know how many steps you take?
    • Today, you’re going to build your own step counter using the BBC micro:bit
  2. Introduce the Concept
    • The micro:bit has a motion sensor called an accelerometer.
    • It can detect movement—like when your foot steps. We’ll use that movement to count steps.
    • Optional: Watch the accelerometer video from BBC micro:bit
  3. Build the Code
    • Walk students through creating the code or use the provided link to share the completed code with students.
    • Model in MakeCode
  4. Download and Test the Step Counter
    • Students should:
      • Download their code to their micro:bit
      • The micro:bit can be worn or held while walking to detect steps
      • If attaching the micro:bit to their body use a shoe, ankle, sock, etc.
      • Walk around
    • TIP: have students mentally count their steps to use to verify their micro:bit data steps
  5. Analyze Accuracy, discuss:
    • Does it count steps accurately?
    • Did it count every step?
    • Did it overcount or undercount?

Assessment Opportunities

Reflection:

  • What was the input in your program?
  • What did the variable do?
  • How accurate was your device?

Extension Opportunities

  • Show steps only when a button is pressed
  • Multiply steps by 2 if undercounting
  • Calculate distance traveled

Elements of this resource were created by BBC micro:bit, then curated by the team at Nextech.

Learn More