Skip Navigation

micro:fit Step Counter

By Jen Perry 3 hours (split into 3 parts)
Grades 4-6
English Language Arts,
Science and Technology,
Physical Education
  • Programming
  • Data
  • Technology and Society
  • Design
Tools & Languages

Key Coding Concepts

  • Algorithms
  • Events
  • Loops
  • Variables



A step-by-step set of operations to be performed to help solve a problem



When one thing causes another thing to happen



Running the same sequence multiple times i.e. repeat or forever blocks



A placeholder for a piece of information that can change

In this 3-part lesson, learners will code and design a step counter using the micro:bit.


  • The educator should have some knowledge of micro:bit
  • Learners should have had some previous experiences with coding (Scratch or Blockly)


  • micro:bit (1 per learner)
  • Computers or a device capable of pairing to micro:bit


  • Blank envelopes
  • Paper
  • Pencils and pens
  • Craft supplies for step counter: fabric, duct tape, cardboard, elastic bands, etc.

Before the lesson…

Part 1: Introduction to Variables

Complete’s Envelope Variables lesson.

Part 2: Coding the Step Counter


Play a game of ‘What Time is it Wicked Wolf?’ with the group.

  1. Select one learner to be the ‘Wicked Wolf’ and ask them to stand on one side of the room, facing the wall
  2. Have everyone else stand on the opposite side of the room, lined up along the wall
  3. The group calls out: “What time is it Wicked Wolf?!”
  4. The ‘Wolf’ responds with a time (e.g. 3 o’clock)
  5. The group will step forward that amount of steps, counting aloud as they step towards the ‘Wolf’
  6. At any point, the ‘Wolf’ can call out “LUNCH TIME!” and then try to tag someone from the group before they run back to the starting wall (which is safe)
  7. The goal is for someone from the group to pass where the ‘Wolf’ is standing
  8. If someone is tagged, they are the new ‘Wolf’

Say: “Instead of counting our steps aloud, like we did in the game, we are going to build and code a step counter to do the work for us!”

If learners are familiar with FitBit or similar technologies, you can share that you will be building your own version of this.

Ask: “How does a step counter work?”

Encourage learners to break the project down into smaller steps. (e.g. When you take a step, the number displayed on the screen increases by 1. This number resets to 0 at the start of a new day.)

Continue to ask guiding questions if you are still lacking detail. Where do we see the number? When does this number reset? What number does it reset to?

Ask: “Why do you think we need step counters?” (A: Walking is a common way people get in their daily exercise. Step counters help us make sure we are getting enough exercise to stay healthy! Depending on the age of your learners, you can watch this video about the importance of tracking steps.)

Say: “Today, we are going to use a mini-computer called micro:bit to create our step counters!”

If this is learners’ first experience with micro:bit, watch the following videos as a group:


Open the MakeCode Editor and click ‘New Project’. Point out the main features: simulator, block categories, blocks, and block area. Review how to move, connect, and delete blocks.

Ask learners to open up the MakeCode Editor on their own computers. Have learners use the ‘Step counter’ tutorial under the ‘Fashion’ category to create their own step counter. Walk through the tutorial with learners or have them complete it on their own.

Before you begin, be sure to explain and demonstrate that:

  • Tutorial steps are written out at the top of the editor
  • By clicking ‘Next’, you can see the next step to continue building the algorithm
  • The lightbulb icon gives you the solution for the code to build when you click on it. Challenge the learners to only use this if they are stuck!

Part 3: Work Session

Ask learners to design their step counter using the materials provided.

The design must:

  • Have some way of securely attaching to clothing or the user’s body (e.g. ankle or wrist)
  • Be comfortable to wear and lightweight
  • Be pleasing to the eye (people will want to wear it!)


Have learners Think-Pair-Share the following questions:

  • How did we use [coding concept] in our project?
  • What is one thing you liked about this lesson? Why?
  • What is one thing that challenged you in this lesson? Why?
  • What is one thing you learned? How will you use this knowledge in the future?

Learning Outcomes

I can create algorithms using the MakeCode editor
I can use events to control when things happen in my project
I can use variables to store information about my project
I can use loops to make things happen more than once

Assessment Ideas

Have learners complete’s Variable Assessment Worksheet.

Use the Design Rubric Assessments to evaluate learners’ projects. Ask learners to reflect on their own work by completing the self-assessment rubric.

English & Coding: Have learners write simple instructions on how to program a micro:bit. Assess their ability to recall events, sequence activities/steps, check for grammar and spelling.

Math & Data: Ask learners to use their micro:bit step counter for a week while keeping track of the data using a graph, T-chart, etc. What interpretations or conclusions about their activity levels can they make using this data?

Science: Use the micro:bit to connect to a device such as a TV or computer. This will be a good introduction into explaining connectivity and into understanding the ways that devices are connected.

Coding: Create a more sensitive Step Counter using this lesson plan.

Data (Ownership & Governance): Is there a link between Machine Learning and step counters/fitness trackers? Explore the article ‘About one-in-five Americans use a smartwatch or fitness tracker’. Who uses the fitness tracker data? Why might companies use this data?

Technology and Society (Safe Communication): Discuss how fitness monitors positively impact people by encouraging exercise & helping people meet goals.

Design: Brainstorm and add additional features (digital or physical) that might make the step counter more desirable (e.g. program some event to occur when steps reach a certain number, add a customizable strap, etc. More ideas here.

MakeCode Reference Guide

The Official BBC micro:bit User Guide (2018) by Garteth Halfacree

Introducing the BBC micro:bit - BBC Make It Digital

micro:bit Tutorial Series Part 1: Getting Started

micro:bit by BBC - Creative Classroom Tips for Educators’s Envelope Variables Lesson Plan

Code.Org Teacher video for additional support on Variables

Count Those Steps Video

micro:bit Step Counter Activity

Micro:bit Sensitive Step Counter Lesson Plan

About one-in-five Americans use a smartwatch or fitness tracker

Teach lessons that are tied to your existing curriculum!


More Lesson Plans For Grades 4-6

    View All Lesson Plans

    Explore lessons based on components

    The K-12 Computer Science Framework

    Although learning how to build digital projects is a key part of Computer Science education, students should also learn a wider set of skills and competencies that will help them to harness the power of digital technologies as both creators and consumers. A comprehensive approach to K-12 Computer Science education includes learning about the following five focus areas:

    View Framework ➝


    By the end of high school, students should be able to create a simple computer program.

    Computing and Networks

    By the end of high school, students should understand and be able to use the tools and devices commonly used to build digital projects.


    By the end of high school, students should be able to explain how we use computers to create, store, organize, and analyze data.

    Technology and Society

    By the end of high school, students should be able to explore the ways in which technology and society have mutually shaped each other.


    By the end of high school, students should be able to apply design principles to the digital projects they create.