Maker.io main logo

M5Walker: Step counter for M5StickC

29

2021-09-15 | By M5Stack

License: General Public License Programmers Arduino

* Thanks for the source code and project information provided by @Takeshi MUTOH (むとうたけし)

 

Story

 

Background

 

Are you healthy?

Is COVID-19 making it difficult for you to go outside, and is lack of exercise making you unhealthy?

The M5StickC have an accelerometer, display, battery, and so on which is needed all creating a step meter.

You can make a full step meter with only M5StickC.

 

 Algorithm

The algorithm of the step meter is very simple.

  • Calculate the average acceleration every 100 steps.
  • If new acceleration is over 110% of the average acceleration, status variable change to true.
  • If new acceleration is under 90% of the average acceleration, status variable change to false.
  • When status change from false to true, add one to step.

More detail code is at github https://github.com/610t/StepCounter.

 

 Tips & Tricks

M5StickC has very small battery 80mAh, so you need to run it on a setting that does not consume much battery.

In this case, we used the following two methods to realize it.

  • Display: Reduce battery consumption by dimming the screen.
  • CPU: Reduce battery consumption by lowering the CPU drive frequency.

These can be achieved by using M5.Axp.ScreenBreath(8) and setCpuFrequencyMhz(10), respectively.

 

Demo movie
 

 

 
 
 
Code
 
 
 
 
Mfr Part # K016-C
M5STICKC ESP32-PICO IOT DEV KIT
M5Stack Technology Co., Ltd.
More Info
View More Details
Mfr Part # K016-D
M5STICKC WITH WATCH ACCESSORIES
M5Stack Technology Co., Ltd.
More Info
View More Details
Mfr Part # K016-P
M5STICKC PLUS ESP32-PICO IOT KIT
M5Stack Technology Co., Ltd.
$166.95
View More Details
Add all DigiKey Parts to Cart
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.