This is an old revision of the document!


                           Moad Asehraoui 1220 AF
                     

Count Your Steps

Introduction

Brief presentation of your project:

  • It will take the power of The Microbit
  • To make a more accurate step counter,
  • If the acceleration is greater than (>) 1000, the steps variable is increased to be shown after in the led
  • Nowadays, automation is needed everywhere, so this project will help to improve your sport activity by counting the duration and the calories burned as well

General Description

The idea is quite simple, the idea is to Turn the micro:bit into a step counter (pedometer) to help you track how active you are.

It counts how many times the micro:bit has been shaken and if the acceleration is greater than (>) 1000, It stores this number in a variable called ‘steps’, every time the micro:bit accelerometer input senses a shake, the program increases the variable by 1, and shows the new number on the LED display output.

Once the steps reache 10 steps, the varibale called 'Calories' will be increqsed by 40.4 and the distance as well with 0.0006.

To restart the game, you press at A, and to stop the program and display the results, you press at B, it starts and stops after hearing a music from the speaker of the microbit.

The conceptual scheme of the project is as follows:

Hardware Design

Here's all about hardware design and components :

  • Microbit
  • Buttons
  • USB for Microbit
  • Python Microbit editor
  • Led
  • Accelerometer

Software Design

Description of the application code (firmware):

  • Press Button B to restart and to set the counter to 0 while hearing a music(power up)
  • Once the acceleration is greater than (>) 1000, the variables are increased
  • Measure the calories burned, the durataon and the speed as well

 While true :
  if accelerometer.get_y() > 1000:
      steps += 1
      counter2 += 1
      display.scroll(steps)
  if counter2 == 10:
      calories = calories + 40.4
      distance += 0.0006
      speed = accelerometer.get_y()
      counter2 = 0

The functions for Button A and B :

      if button_a.is_pressed():
      music.play(music.POWER_UP)
      display.scroll("restart")
      sleep(300)
      calories = 0
      distance = 0
      steps = 0
      counter = 0
      counter2 = 0
      time1 = running_time()
  if button_b.is_pressed():
      time2 = running_time()
      time = (time2 - time1)/1000
      music.play(music.POWER_DOWN)
      display.scroll("Duration:")
      display.scroll(time)
      sleep(300)
      ......
      

Results Obtained

Here is some pictures of the results and the link for the video as well:

Link of the Video :

Drive : https://drive.google.com/file/d/13ngXFNZwSfSHbOHqf-ctTG2ivulbxQru/view?usp=sharing

Youtube : https://youtu.be/Hnfv7vRd2BI

Conclusions

Download

Bibliography / Resources

pm/prj2022/avaduva/control_your_lighting_with_your_phone.1653683818.txt.gz · Last modified: 2022/05/27 23:36 by moad.asehraoui
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0