Step Counter - Micro:Bit

by Aidan-Corrales in Circuits > Electronics

3669 Views, 12 Favorites, 0 Comments

Step Counter - Micro:Bit

IMG_1115.png

This project will be a step counter. We will use the accelerometer sensor that is built in to the Micro:Bit to measure our steps. Each time the Micro:Bit shakes we will add 2 to the count and display it on the screen.

Supplies

- Yourself

- Micro:Bit

- Battery Pack

- Mirco USB

- Computer

Start New Project

Open.png

Click the following link to start a new project. You can delete any blocks that are already there.

Add Shake Block

Shake.png

Add the shake block. Whatever goes inside this block will execute whenever you shake the Micro:Bit.

Create Variable

Make.png
Name.png

Go to variables and click "create a variable". Name it whatever you want, just keep track of the name. I named mine "Counter", because that is what it will be doing!

A variable is like a storage box in memory. You can name your variables. That way whenever you use the name in your program, it shows what is in the box.

Increment Variable

Count.png

Add a block to change the value inside your variable after shaking. I have mine set to increment (add) by 2 every time you shake the Micro:bit.

This way it will count 2 steps each time my foot that it is on touches the ground.

Forever Loop

Loop.png

Next we add a forever loop. This is where we will put the block that displays the contents of our variable.

Show Number

Show.png

Add a show number block to the forever loop. This is where we will put our variable.

Show Variable

Test.png

Add your variable inside the show number block. Now the Micro:Bit will always show the number stored in your variable.

Plug In

IMG_1117.jpg

Plug your Micro:Bit into your computer using the micro USB cable.

Download

Download.png
flash.png
100.png

Download the program to your computer and transfer it to your Micro:Bit.

If you are unclear on how to do this, I suggest following my Hack Your Headphones tutorial.

Add Battery

IMG_1121.png

Unplug your Micro:Bit from the computer and plug in your battery Pack. It should be displaying 0 after downloading the program.

Add to Leg

IMG_1120.png

Add the Micor:Bit to your leg. You may need duck tape or rubber bands to connect it.

Count your steps for the rest of the day! The American Heart Health Association recommends about 10,000 steps per day to stay healthy.

How far were you from 10,000 steps?

Did anything go wrong with this project?

How could it be improved if you did it over again?

Here Are Video Instructions If You Prefer That! :)

Microbit - Step Counter