M5Walker: Step counter for M5StickC
2021-09-15 | By M5Stack
License: General Public License Programmers Arduino
* Thanks for the source code and project information provided by @Takeshi MUTOH (むとうたけし)
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