Implementation of a Three-Dimensional Pedometer Automatic Accumulating Walking or Jogging Motions in Arbitrary Placement

This study proposes a method for using a three-axis accelerometer and a single-chip microcontrol unit to implement a threedimensional (3D) pedometer that can automatically identify walking and running motions. The proposed design can calculate the number of walking and running steps down to small numbers of steps and can be easily worn, thus remedying defects of generic mechanical and 3D pedometers. The user’s motion state is calculated using a walk/run mode switching algorithm.


Introduction
Because of the convenience of computers and widespread networks, people have become unwilling to go outdoors.Thus, most people lack sufficient exercise.The pedometer is a useful tool that, when worn, can detect the number of steps taken by a user.The amount of exercise achieved by a user is evaluated based on the number of steps, which is automatically counted.Thus, pedometers enable users to monitor their health.Pedometers that are currently available on the market can be categorized as mechanical and three-dimensional electronic.Mechanical pedometers are equipped with a lever arm attached to a spring coil, which moves vertically with each step to count the steps.However, the lever arm detects movement in only one direction, and the pedometer must be positioned perpendicular to the ground.Three-dimensional (3D) electronic pedometers use an accelerometer to detect acceleration changes in various directions.Continual motion is still used as a criterion to prevent misjudgment in current designs.For example, the number of steps is counted only after the user has walked continually for several seconds or has taken several steps.However, this criterion means that a short walk is recognized as an error and will be excluded.
The design principle of pedometers involves using vertical vibration induced by walking to activate the balancing mechanism of the pedometer.Waist motion is the most apparent source of vibration.Shih [1] reported that the numerical curve of the acceleration G value oscillates substantially during walking or running.Thus, the number of vertical motions of the body can be determined by identifying the local peak and valley points of the curve.Different dynamic thresholds can be adjusted according to the users to detect the number of steps.
An accelerometer, which is also known as a G-sensor, is used to detect the accelerated motion of an object.It can detect instrumental vibrations and effects and can be applied to the displacement component of inertial navigation systems and to the global positioning system navigation with gyroscopes.Accelerometers have been used extensively in recent years.For example, Veltink et al. [2] placed an accelerometer on a user's chest and thigh to distinguish static and dynamic actions, such as standing, sitting, lying, walking, ascending and descending stairs, and cycling.Mäntyjärvi et al. [3] placed accelerometers around a user's waist and identified body motion state by using principal component analysis, independent component analysis, and wavelet transform.The most satisfactory experimental result was 83% to 90%.Luinge and Veltink [4] attached an accelerometer to a user's back and used a Kalman filter to improve accelerometer detection on an inclined trunk.Karantonis et al. [5] used a threeaxis accelerometer to design a portable wireless device that can be worn around the waist.A single-chip microcomputer receives signals from the three-axis accelerometer, and the signals are wirelessly transmitted to the computer terminal.The user's behavior state is then identified according to changes in the three-axis acceleration value.Twelve actions, including walking, sitting, and lying down, were measured in an experiment by Karantonis et al.The accuracy rate was 83% to 96%.Khan et al. [6] placed three-axis accelerometers in a user's chest pocket, front and back trouser pockets, and coat pocket.Resting (sitting or standing), walking, ascending and descending stairs, running, and cycling motions were identified according to the acceleration changes detected by the accelerometers in different positions.The detection accuracy rate of the completed identification system was 95%.This study used a three-axis accelerometer to implement a 3D pedometer that automatically identifies walking and running motions.Thus, users can conveniently measure their exercise.Users can wear the pedometer around the waist or place it in a pocket or backpack to detect the number of steps taken, unlike existing mechanical pedometers that must be worn around the waist.The proposed design does not require the fixed-second misjudgment prevention mechanism.The motion state of the user can be displayed instantly according to the experimental walking and running threshold and the walk/run mode switching algorithm of the automatic walking-and-running-motion identification function.The number of walking or running steps is thus accumulated.This paper is organized as follows: Section 1 outlines the study theme, describes the study motive and purpose, presents a literature review, and discusses the application of a related technique; Section 2 introduces the hardware structure used in this study and describes the specifications and signal analysis method in detail; Section 3 presents the proposed step counting system at an arbitrary angle; Section 4 discusses walking and jogging motions; Section 5 provides comprehensive experimental data to determine the pedometer's performance and discusses the experimental results; finally, Section 6 summarizes and discusses the findings of this study.

System Architecture and Signal Analysis
This study used the three-axis accelerometer MMA8452Q [7] and the monolithic chip MPC82G516 [8]. Figure 1 shows the hardware connection block diagram of the experimental apparatuses.The MMA8452Q detects the acceleration values of three axes, and the interintegrated circuit (IIC) transmits the three-axis acceleration information to the MPC82G516.The Universal Asynchronous Receiver/Transmitter (UART) transmission mode was used to transfer the three-axis acceleration values from the monolithic chip MPC82G516 to the computer terminal for convenient statistical data analysis at the experimental stage.
The program in the monolithic chip of the 3D pedometer automatically identifies walking and running motions and directly calculates the number of steps.The results are then transferred to the computer program and displayed.Figure 2 illustrates the system flowchart of the 3D pedometer regarding the automatic identification of walking and running motions.
C language was used to write the IIC reading and UART programs for signal reading analysis in the monolithic chip MPC82G516.The receiving program on the computer was written using C#.The testers wore experimental apparatuses on their left lumbar areas to test the accelerometer reading.The experiment was repeated five times, and the results are shown in the signal analysis experiment line chart in Figure 3.
As shown in Figure 3, the accelerations  and  are represented by two plane axes, and stationary gravity was 0 G.The -axis acceleration was perpendicular to the ground, and stationary gravity was 1 G. Here, 1 G means 9.8 m/s 2 .Walking acceleration was recorded when the -axis was perpendicular to the ground.The number of steps was calculated according to the vertical vibration of the body during each step.-axis acceleration records positive and negative G values during each step according to the line chart in Figure 3.However, the inertial vibration induced by the stepping motion caused severe jitters, and the noise from the jitter influenced the number of steps that filtered through the threshold.Thus, several signal smoothing processing modes, including 3point average, Hanning filter [9], Hanning recursive smoothing, 5-point average [10], and 5-point triple smoothing [10] methods, were used to smooth the experimental results of the signal analysis, reduce signal jitter error production,  and determine the variations in the walking and running detection results among the different smoothing techniques.

Three-Point Average Method.
The target point value and the values of two adjacent points were averaged when using the 3-point average smoothing method by using where () is the smoothed value, () is the original signal value at time , and  = 2, 3, 4, . . .,  − 1.

Hanning
Filter.The Hanning filter [11] smoothing process emphasizes the value of the previous point by using where () denotes the signal value after smoothing and () denotes the original signal value at time .The smoothing process is implemented after  = 3.

Hanning Recursive Smoothing Technique. The recursive filter smoothing technique was designed according to the
Hanning filter smoothing formula as represented by (3), where  = 3, 4, 5, . . ., 2.4.Five-Point Weighted Average Method.The 5-point weighted average method [12] is similar to the 3-point average method.The weighted average of the target point and the two adjacent points was calculated using International Journal of Antennas and Propagation where () is the smoothed value, () is the original signal value at time , and  = 3, 4, 5, . . .,  − 2.

Five-Point Triple Smoothing.
Least squares polynomial discrete data smoothing was repeated three times when using the 5-point triple smoothing method [12] by using where () is the smoothed value, () is the original signal value at time , and  = 3, 4, 5, . . .,  − 2.
The experimental results of the signal reading analysis were obtained using the five aforementioned smoothing techniques.The smoothing result indicated that the five smoothing techniques can reduce the inertial vibration of the body as induced by stepping motions and stabilize walking and running behavior recognition values, which are advantageous to users.The Hanning recursive smoothing technique and 5-point weighted average method exhibited the most apparent smoothing effect among the five techniques.

Step Counting System at an Arbitrary Angle
The gravity component 0.5 G equals sin(30 ∘ ) according to the relationship between the gravity component and the rotation angle (e.g., the -axis shown in Figure 4); thus, the inclination angle is equivalent to the gravity component arcsin, as expressed in  where  is the inclination angle,   is the gravity component detected by the -axis, and   is the value measured by the sensor when the gravitational acceleration is 1 G.The gravity component of the axis can be obtained according to Figure 4 and ( 6) when the inclination is 0 ∘ to 90 ∘ .Here, 1 G means 9.8 (m/s 2 ).The sensor was placed at a fixed angle and the rotation angles of various axes were obtained using (6) to determine the present placement state of the device.Figure 5 shows the inclination calculation process.The actual angle was subsequently validated.The test results shown in Table 1 indicate that the errors were less than 5 ∘ .
Shih [1] reported that when people walk, their waist and trunk displacements change perpendicular to the ground  with each step.This direction is parallel to gravity direction.
The -axis is inclined at  ∘ to the horizontal plane, and ( 7) is deduced, as shown in Figure 6, to obtain the acceleration change in this direction.Consider where   is the gravity-direction acceleration,   is the acceleration sensed in the -direction, and  is the angle included between the -axis and horizontal plane (i.e., inclination).As shown in Figure 6,   equals the product of   and sin .When the axis is inclined  ∘ , sin  equals the gravity component on the axis.The inclination calculation step can be omitted if sin  is substituted into (7).The gravity-direction acceleration change is directly calculated based on the gravity component by using where   (  ) is the gravity-direction acceleration at time   when the -axis is used as an example,   (  ) is the acceleration in -direction,   ( 1 ) is the gravity component sensed at resting time  1 , and   is complete gravitational acceleration 1 G.The sensor can detect acceleration changes in three axes in the triaxial 3D space according to (8).The and -axes are added to obtain where   (  ) is the gravity-direction acceleration at time   ;   (  ),   (  ), and   (  ) represent the accelerations sensed by three axes at time   ;   ( 1 ),   ( 1 ), and   ( 1 ) represent the gravity components sensed by three axes at resting time  1 ; and   is complete gravitational acceleration 1 G.In this study, the gravity component sensed by the three-axis accelerometer at rest was used to calculate the gravity-direction acceleration sensed by the three axes.The acceleration perpendicular to the ground (i.e., complete gravity-direction acceleration change) was thus obtained.The gravity direction accelerations   for walking and running motions were analyzed.The walking acceleration amplitude was 0.5 G to 1 G, and the running amplitude was approximately 1 G.The line chart of acceleration values shows the positive peak and negative valley points for each step.These points were considered in addition to threshold to identify the number of steps.In addition, the amplitude was low during walking, and the inertial vibration caused by the stepping motion caused substantial noise, whereas the situation was more stable during running.
To design a convenient step counting system, a threeaxis accelerometer and a gravity component were used to obtain the acceleration value perpendicular to the ground.The actual number of steps was thus detected.The variation curve of acceleration values exhibited a peak and valley for each step, which are the positive peak point and negative valley point, respectively.Thus, based on this characteristic, the threshold was used to filter the other low-amplitude noises to count the number of steps correctly.The stepdetection algorithm is described as follows.
International Journal of Antennas and Propagation (1) The number of steps is zero when step counting begins.The gravity component is calculated, and the present angle is obtained.(2) The three-axis acceleration value is read, and the gravity-direction acceleration in   is calculated.(3) If the absolute value of acceleration   is lower than that of the threshold, the algorithm reverts to Step 2. If the value is higher than that of the threshold, the next step is executed.(4) The three-axis acceleration value is continually read and the   is calculated.If the   counter to Step 3 is generated within 0.5 seconds and the absolute value is higher than the threshold, the next step can be executed.Otherwise, the pedometer is regarded as being in a stationary state, and the system reverts to Step 2. (5) A positive and a negative acceleration   must be obtained.The absolute values must be higher than that of the threshold, which is the number of steps plus one.Otherwise, the system reverts to Step 2 to continue the detection.
The acceleration   in one direction was higher than the threshold acceleration in Step 4. The acceleration change cycles of each step were calculated within 0.5 seconds according to the walking and running   changes.Thus, the system is regarded as being in a stationary state and reverts to Step 2 if the counter-acceleration   is within 0.5 seconds of the threshold.
This pedometer design was convenient for users; however, the placement can generate external force, thus changing the originally detected angle.Thus, a relocation function was required to achieve automatic system detection.The calculated angle can thus be corrected to the changed state.Figure 7 shows the step-detection algorithm with the relocation function.
The aforementioned step-detection algorithm, gravity component, and gravity-direction acceleration concepts were used to implement the arbitrary placement of the system.The threshold was used to filter the gravity-direction acceleration   to obtain the number of steps taken by the user.Different results were obtained when the values were processed using various smoothing techniques.Thus, appropriate walking thresholds were determined for the different smoothing techniques.The qualities of various thresholds were compared based on the accuracy rates.Table 2 lists the selected thresholds.

3D Pedometer That Automatically Identifies Walking and Running Motions
The running threshold must be higher than the walking acceleration change and lower than the running acceleration change to determine the motion state and the number of walking and running steps, respectively.Thus, the motion state, number of walking steps, and number of running steps must be separated.Various thresholds were used to detect 100 walking and running steps.Different smoothing techniques have various walking thresholds, and the running threshold is used to identify the walking or running motions of the user.The threshold was set at 0.2 G to 0.54 G, and the increments were set at 0.02 G, based on experimental adjustment.Different running thresholds exhibited varied walking and running accuracy rates.Thus, the two experimental results were averaged to obtain the average accuracy rate.
The walk/run mode switching system was designed to achieve a high detection accuracy rate because users typically walk or run continually.The accuracy rate of the Hanning recursive smoothing technique during walking and running identification was thus improved.This system detects resting, walking, and running modes, and the modes switch under different conditions.The detection of two consecutive steps is considered as the switching mode standard.The walking or running mode can be maintained provided that the acceleration exceeds the walking threshold, even if the switching mode standard is not attained.Figure 8 presents the system block diagram.
The mode switching algorithm of the walking experiment reduces the detection misjudgment rate.Misjudgment is likely to occur during the first two steps of the running experiment, and this problem is yet to be addressed.The misjudgment rate of the mode switching algorithm, which is lower than that of the simple threshold filtering method, can be observed in other data in addition to the running start problem.Thus, the mode switching algorithm was used to calculate the number of walking and running steps in this study.The misjudgment rates of the 3-point average, Hanning filter, 5-point weighted average, and 5-point triple smoothing methods were reduced to less than 2% after filtration using the mode switching algorithm.The misjudgment rates of the Hanning recursive smoothing technique and the raw

Run mode
Run mode (1) The run mode is entered if there are two consecutive steps exceeding the run threshold.
(2) The walk mode is entered if there are two consecutive steps exceeding the run threshold.
(1) The run mode is entered if there are two consecutive steps exceeding the run threshold.(2) Failed to meet condition 1, but there are two consecutive steps exceeding the walk threshold then maintaining walk mode.(3) One of the consecutive steps not exceeding the walk threshold then back to stationary mode.
(1) The walk mode is entered if there are two consecutive steps exceeding the walk threshold but not exceeding run threshold.
(2) Failed to meet condition 1, but there are two consecutive steps exceeding the run threshold then maintaining run mode.(3) One of the consecutive steps not exceeding the run threshold then back to stationary mode.data not processed using a smoothing technique remained as high as 12% and 24%, respectively.The misjudgment rates of both methods, compared with the remaining samples, were relatively high.Thus, the two signal processing modes were excluded in this study.An experiment regarding the accuracy rates of walking and running alternation was conducted.Ten walking steps and 10 running steps were taken alternately until the number of steps of each motion reached 100 for a total of 200 steps.The 3-point average, Hanning filter, 5-point weighted average, and 5-point triple smoothing methods and the mode switching algorithm were used to count the steps during signal processing.The running accuracy rates of the four smoothing modes were higher than 92% on average.Regarding walking, which is likely to be misjudged, the 5point weighted average method exhibited the highest average accuracy rate of 89%.Thus, the 5-point weighted average method was used for signal smoothing.

Experimental Results and Analysis
Four experiments were conducted to assess a pedometer positioned at arbitrary angles.The pedometer was worn in three different places for the first three experiments, namely, around the waist, in a trouser pocket, and horizontally in a backpack.The user walked 100 continual steps along a corridor.The pedometer was attached to the waist for the fourth experiment.The user walked and stopped walking at will for 100 steps to validate the proposed pedometer.The pedometer was able to accurately detect the number of steps even though the user walked and stopped walking occasionally, unlike the 7-second misjudgment prevention system of current 3D pedometers.The experimental environment is described as follows.
(1) Experimental site: a corridor approximately 5 m long and approximately 1 m wide.
(2) Pedometers: the three pedometers used were (a) a 3D pedometer that automatically identifies walking and running motions, which was designed and implemented in this study, (b) a conventional mechanical MPG-002 pedometer developed by Nintendo, and (c) a 3D PS-10A pedometer available on the market and produced by Pursun.
(3) Experimental subjects: three females and two males for a total of five subjects.
Table 4 lists the experimental results.The average accuracy rates of the three pedometers fixed to the waist were higher than 90%.The accuracy rate of the proposed pedometer decreased to 85% when the pedometer was placed in the pocket because the pockets of Male 1 and Male 2 were large, increasing inertial vibration and the number of detected steps.Only one direction was detected when the pedometer was placed horizontally in the bag, because the mechanical pedometer used a mechanical spring mechanism in detection; thus, the number of steps could not be detected normally.The average accuracy rates of the 3D pedometer and the 3D pedometer that automatically identifies walking and running motions were higher than 90%.Finally, the walking and stopping experiment for a small number of steps was conducted.The misjudgment prevention mechanism fails in most generic 3D pedometers when users take only a small number of steps when walking and stopping because a short time threshold is used as a misjudgment prevention mechanism.This experiment proved that the 3D pedometer that automatically identifies walking and running motions, which was developed in this study, can resolve the defect.
The experimental results suggested that the average accuracy rate of the 3D PS-10A pedometer was only 15% in the walk and stop experiment, whereas the accuracy rate of the 3D pedometer that automatically identifies walking and running motions was 88.8%.Finally, the step counting system for walking and running recognition was tested.The five subjects wore the 3D pedometer that automatically identifies walking and running motions.The walk/run mode switching algorithm was used to prove that this pedometer can recognize the number of walking and running steps taken by a user.The experimental method is described in detail as follows.The walk and run alternating mode was defined as walking 10 steps before running 10 steps.This process was alternated until 100 steps of each motion were taken for a total of 200 steps.
(1) Experiment 1: the user wears the pedometer around the waist and alternately walks and runs along the corridor.One hundred steps are taken for each motion.
(2) Experiment 2: the user places the pedometer in a pocket and alternately walks and runs along the corridor.One hundred steps are taken for each motion.
(3) Experiment 3: the user places the pedometer horizontally in the backpack and alternately walks and runs along the corridor.One hundred steps are taken for each motion.
Table 5 lists the experimental results.The average detection accuracy rate for the simple running experiment was the highest of the three walking-mode detection accuracy rates at 95% to 98.8%.The detection accuracy rate of the simple walking experiment was 88.4% to 92.6%, and that of the alternate walk and run experiment was the poorest at 71.6% to 96%.The pedometer worn around the waist achieved the highest average detection accuracy rate, followed by that in the pocket.The pedometer placed horizontally in the backpack exhibited the worst accuracy rate among the three pedometer-wearing modes.
The average walking mode misjudgment rates of the 3D pedometer that automatically identifies walking and running motions in different wearing modes were observed to be lower than 5% according to the experimental aforementioned results.The misjudgment rate was calculated using (12).The average accuracy rates were higher than 70%, except for the instances in which the pedometer was placed horizontally in the backpack and during the alternate walk and run experiment.The average accuracy rates were higher than 87% in these cases, proving that this pedometer accurately identified walking and running motions.Consider misjudgment rate = misjudged steps actual steps × 100%.
Table 6 lists the functions of the mechanical MPG-002 pedometer, 3D PS-10A pedometer, and 3D pedometer that automatically identifies walking and running motions.The International Journal of Antennas and Propagation 11 variable  represents the successful demonstration of a function, and  represents the lack of a function or failure to demonstrate the function.
Table 6 shows that the 3D pedometer that automatically identifies walking and running motions possesses the arbitrary placement function that the mechanical pedometer does not possess.The proposed pedometer can detect small numbers of walking steps and stopping, which generic 3D pedometers are unable to detect.This pedometer can also identify walking and running motions and immediately display the user's motion state.The pedometer remains to be optimized regarding accuracy rate because it failed to obtain the 90% accuracy rate for certain functions.This problem can be improved in the future.

Conclusion
A 3D pedometer that automatically identifies walking and running motions was implemented in this study by using a three-axis accelerometer.The angles between the three axes and the horizontal plane were obtained according to a gravity component.The acceleration change in the motion direction perpendicular to the ground was obtained.Different signal smoothing processing modes and thresholds were used to filter the number of steps to implement the step counting function of this device at arbitrary angles.Running threshold filtering was proposed to calculate the number of steps separately, and a walk/run mode switching algorithm was used.Five users were tested using three wearing modes to prove that this system can be placed wherever the user prefers.The walk and run detection accuracy rate of the proposed pedometer was 71.6% to 98.8%, and its misjudgment rate was lower than 5%.Thus, the number of walking steps and the number of running steps were successfully calculated separately.The 3D pedometer that automatically identifies walking and running motions remedies the defects in generic pedometers currently available on the market.

Figure 2 :
Figure 2: System flowchart of the 3D pedometer with respect to the automatic identification of walking and running motions.

Figure 3 :
Figure 3: Line chart of the signal analysis experiment.

Figure 4 :
Figure 4: Relationship between gravity component and rotation angle.

Figure 6 :
Figure 6: Relationship between  ∘ inclination of the -axis and gravity direction.

Figure 8 :
Figure 8: System block diagram of the walking and running mode switching system.

Table 1 :
Inclination calculated based on sensed gravity component.

Table 3 :
Walking and running thresholds for different smoothing techniques and their accuracy rates.

Table 4 :
Results of experiments on the pedometer positioned at arbitrary angles.