Does my code for X steps in Y time actually work though? It's pretty basic - you're just storing how long ago each step occurred. If the second from last step occurred less than 3 seconds ago then it's good. It feels like a state machine is overkill.
Yes, the ringing is a pain. I'd originally hoped that the filter would have the effect of significantly amplifying repeated steps (which it does) but the flipside is it tends to make instantaneous peaks oscillate. It's why I though raising the threshold would be a good help, as you have to have really strong movements to get peaks anywhere near as high as you'd get when you start doing repeated movements.
If you look at the step count tester I'd posted up at https://github.com/gfwilliams/step-count then it actually produces nice graphs where you can see the behaviour in relation to the threshold.
It's entirely possible that a simple high/low pass filter (rather than bandpass) wouldn't ring though - and since we're counting step frequency probably all we care about is cutting out high frequency.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Does my code for X steps in Y time actually work though? It's pretty basic - you're just storing how long ago each step occurred. If the second from last step occurred less than 3 seconds ago then it's good. It feels like a state machine is overkill.
Yes, the ringing is a pain. I'd originally hoped that the filter would have the effect of significantly amplifying repeated steps (which it does) but the flipside is it tends to make instantaneous peaks oscillate. It's why I though raising the threshold would be a good help, as you have to have really strong movements to get peaks anywhere near as high as you'd get when you start doing repeated movements.
If you look at the step count tester I'd posted up at https://github.com/gfwilliams/step-count then it actually produces nice graphs where you can see the behaviour in relation to the threshold.
It's entirely possible that a simple high/low pass filter (rather than bandpass) wouldn't ring though - and since we're counting step frequency probably all we care about is cutting out high frequency.