phyphox Forums

Full Version: how to count steps
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Just as an exercise i want to implement a step counter based on the acceleration sensor:

With every step you get a peak in the accelaration, you just need to identify these peaks and count them.

Standard method would be take the timeseries of the accelearation a(t), convert to a two valued rectangular function which is  0 for a < a0 and 1 for a >= a0 with a0 some threshold. Search and count the positive flanks of this by differentiating this function and output this as value 'steps' .

in a simple scheme:

acc.sensor:abs ---> formular sign(a-a0)  --> differentiate --> range filter(y>0.5)  --> count  = 'steps'

This is not perfect but works somehow (would be great to have somthing to smooth the sensor output like gliding average or some digital filter ...)

But i tought also of using some of the other predefined modules:
In the editor i find a module "threshold" which delivers the index of the first occurence when the input goes above threshold. I thought appending this to a new buffer and counting ellements in this buffer would give the steps. But this counter remains allways at 1. What am i  doing wrong ?


acc.sensor:abs ---> threshold, a0 --> append --> count = 'steps method 2'


[attachment=174]