Project

General

Profile

3 Methodology » History » Version 4

Version 3 (André Fernandes Gonçalves, 29/12/2023 15:11) → Version 4/42 (André Fernandes Gonçalves, 29/12/2023 15:25)

h1. 3 Methodology



h2. 3.3 Step Counting

Having the values from the accelerometer which has a FREQUENCY OF ____, the acceleration from the 3 axis in condensed in the acceleration magnitude:

mag = sqrt(x^2+y^2+z^2)

Then, in order to remove the gravitational acceleration, the average acceleration is subtracted:

netmag = mag - avgmag

so the netmag represents only the acceleration regarding movement. The algorithm works as follows:
The time-netmag graph is divided in dynamic 3-sample windows. The values of these samples are tracked and if they are in crescent order, the system registers the first sample as the start of a step. When a value is detected above a pre-defined OR DYNAMIC threshold, all values above that threshold are saved in a vector, PeakVector. When the values of netmag drop below the threshold, the system uses a 2-samples window to track the slope of the magnitude. If the second value is greater than the first, it is considered the start of a new step, thus ending the previous one. Since the PeakVector contains all the values that fall above the step threshold, the maximum value should represent the real peak.