You are on page 1of 1

step count detection:

To calculate the number of steps I have collected values from Accelerometer


sensor(LSM9DS1 sensor) using Arduino Nano 33 ble & i have taken initial step count
is 0. The accelerometer continuosly monitors the acceleration values while walking
and because of that there is a change in the acceleration vector.In order to find
the difference in the acceleration vector we need a reference acceleration.for that
I have calculated the average values of acceleration by taking 50 consecutive
values and taken this average as refernce value and by collecting present
acceleration values(X,Y,Z) i have found the accelerationvector by using a formula
sqrt((X-Xavg)^2+(Y-Yavg)^2+(Z-Zavg)^2)

To detect the steps continuously I have written the code in void loop to detect
steps continuously and I have repeated the same process in the loop also.I have
taken the difference between present acceleration vector and past acceleration
vector.If the difference is greater than threshold 1.07 then step will be
incremented otherwise there is no change in the step count. To find the difference
between the present acceleration vector and past acceleration vector continuosly I
have assigned the present acceleration vector value to past acceleration vector
value because of that in the next iteration it will find the differnce between
present and immediate past acceleration vector difference only.

Stride length Calculation:


To find the stride lenght of a step i have collected consecutive 50 acceleration
values and find the maximum acceleration value from the 50 values.To find the
stride length I have followed Weinberg's algorithm and used the formula
k*sqrt(sqrt(amax-amin)), amax is max acceleration value when you are moving & amin
is min acceleration value & k is the ratio of mean real and mean estimated stride
length.

Total distance Calculation:


To find the total distance we have travelled, I have added the present stride
length with previous stride length continuously. And initial distance travelled is
considered as 0.

Right & Left Detection:


To detect left or right movement, I have used gyroscope values.After doing multiple
trials, I have identified the axis related to the left & right movement. If the Z
value is between 40 to 200 it is left turn and if Z value is between -50 to -200 it
is right turn.

You might also like