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.
AlgorithmThe algorithm of 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 & TricksM5StickC 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
Comments