Pedometer
1. Introduction
This demo is for pedometer based on accelerometer in NI myRIO. The demo contains two parts, one is to count how many steps you walk and the other is to measure the distance you walk. Based on the distance and the number of steps, how long you walk per step can be calculated.
2. Method
2.1 Overview
Fig. 1. Overview of the method
The basic idea of our method is to use tri-axis gravity acceleration to measure distance and to count the number of steps. Fig. 1 is overview of our method. We can get tri-axis acceleration from the accelerometer in NI myRIO.
Firstly, correct posture. The reason why we must do this is that we must calculate tri-axis acceleration to get tri-axis speed based on calculus to measure distance. However, once we rotate NI myRIO, tri-axis speed will be wrongly calculated. So we must correct acceleration into geodetic coordinate system for calculus.
Secondly, measure distance based on calculus. After correcting posture, we must use a filter to get the proper frequency for calculus. We use a band-pass filter, because low frequency is the gravity acceleration and high frequency will affect the calculus.
Thirdly, count steps. Because we have already corrected posture, we can detect ups and downs in z-coordinate to count steps. We also use a band-pass filter to get the proper frequency.
Finally, based on the distance and the number of steps, we can calculate distance per step.
2.2 Algorithm
After we get , we can update S in
based on (3).
is based on our sampling frequency, and here we set
.
Through judging whether the wave has passed baseline three times to count step. However, in order to avoid some noise, we set some constraints here.
Constraint 1: .
Constraint 2: .
Constraint 3: , where
.
is the start time of the period of wave and
is the end time of the period.
2.3 Experiment
2.3.1 Filter
(a) Left: origin wave in z-coordinate.
Middle: wave after Step Counting filter
Right: wave after Distance Measurement filter
(b) Left: origin wave in x-coordinate.
Right: wave after Distance Measurement filter
(c) Left: origin wave in y-coordinate.
Right: wave after Distance Measurement filter
Fig. 2. Filter in 3-axis acceleration.
2.3.2 Distance Measurement
Times | Real Distance | Measured Distance | Error |
1 | 12 m | 7.83 m | 34.85% |
2 | 12 m | 8.15 m | 32.08% |
3 | 12 m | 8.23 m | 31.42% |
Tab. 1. Experiment of Distance Measurement
2.3.3 Step Counting
Times | Real Step | Measured Step | Error |
1 | 30 | 29 | 3.33% |
2 | 30 | 31 | 3.33% |
3 | 30 | 33 | 10.00% |
Tab. 2. Experiment of Step Counting
2.4 Discussion
1) Error in Distance Measurement: From Tab. 1 we can see that there are about 33% errors. Because we use a band-pass filter. Some low frequency and high frequency signal will be filtered. It will affect the calculus when calculate speed and then affect distance calculation.
2) Error in Step Counting: From Tab. 2 we can see that, there is a little mistake in it. We use three constraints to avoid noise but we cannot avoid all noise. Because of noise, we cannot get the accurate result.
3. Conclusion
This demo is for step measurement based on accelerometer in NI myRIO. It contains two parts, one is distance measurement and the other is step counting. We use gravity acceleration to correct the posture. However, we cannot get Yaw component. So there must be some errors in distance measurement. Because low frequency is filtered, uniformly accelerated motion cannot be measured based on our method. For step counting, we use some constraints to avoid some noise. However, for different people, constraints are slightly different. If we have a gyroscope for posture correction, we can do a better job. We can get not only the walking distance but also the walking track.