Student Projects

cancel
Showing results for 
Search instead for 
Did you mean: 

myRIO Pedometer

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

1.png

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

    • Posture Correction: To correct posture, key issue is to get rotation matrix. In our first demo, we have already got the rotation angle and rotation vector.  So we use “Angle Vector to Rotation Matrix.vi” in LabView to get rotation matrix. And use (1) to correct posture. Finally, 1.pngis the corrected acceleration in geodetic coordinate system.

2.png

    • Distance Measurement: After posture correction, we must use a filter to get the acceleration in proper frequency. We use a band-pass filter, and the band-pass frequency is in [0.1, 50] Hz.  Then based on the proper frequency, we can calculate the distance. First, we must update 3.pngin 4.png continuously based on (2).

5.png

              After we get 3.png, we can update S in 4.png based on (3). 4.pngis based on our sampling frequency, and here we set

  6.png.7.png

    • Step Counting: For step counting, we also use a band-pass filter to get proper frequency. In this demo, we set the band-pass frequency to [0.2, 1.8] Hz. We judge whether a period of wave is a step is to see whether it has an up and down.Here we define Baseline of a period of wave as (4).

1.png

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: 2.png.

Constraint 2: 3.png.

Constraint 3: 1.png, where 2.png. 3.png is the start time of the period of wave and 4.png is the end time of the period.

     2.3 Experiment

          2.3.1 Filter

1.png

(a) Left: origin wave in z-coordinate.

Middle: wave after Step Counting filter

Right: wave after Distance Measurement filter

2.png

(b) Left: origin wave in x-coordinate.

Right: wave after Distance Measurement filter

3.png

(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.

Contributors