how to count steps - Printable Version +- phyphox Forums (https://phyphox.org/forums) +-- Forum: Discussion (https://phyphox.org/forums/forumdisplay.php?fid=1) +--- Forum: General (https://phyphox.org/forums/forumdisplay.php?fid=3) +--- Thread: how to count steps (/showthread.php?tid=840) |
how to count steps - jhs - 05-15-2020 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' Step_counter.phyphox (Size: 5.34 KB / Downloads: 545) |