Using our website means you agree to using cookies which help us improve microbit.org.Learn more
Skip to content

Activity

Low energy step counter

Beginner | MakeCode, Python | Accelerometer, Buttons, LED display | Human body, Performance tools, Sensors, Variables

Step 1: Make it

What is it?

Make a step counter with longer-lasting batteries.

micro:bit with blank display attached to shoe

How it works

  • Like the Step counter project this program uses the accelerometer to count a step every time the micro:bit is shaken and stores the total number in a variable called steps.
  • Keeping the LED lights on the micro:bit turned on requires more power. This program saves energy by only showing the step count when you press button A.
  • This means that the batteries will last longer, saving money, creating less waste and helping the environment.

What you need

  • micro:bit (or MakeCode simulator)
  • MakeCode or Python editor
  • battery pack (optional)
  • something to attach the micro:bit to your shoe or leg – string, tape or Velcro.

Step 2: Code it

Step 3: Improve it

  • Modify the program so button B sets the counter back to 0.
  • Measure the length of your step and get micro:bit to multiply this by the number of steps to calculate the distance you’ve walked.
  • Think of ways of adapting other projects to make the batteries last longer.