2017 2nd International Conference on Computational Modeling, Simulation and Applied Mathematics (CMSAM 2017) ISBN: 978-1-60595-499-8
Design of Counting-Step Algorithm for
Smartphone-Based Indoor Localization
Hong-li SONG
1, Bao-shu LIU
2, Zhong-tao HUANG
2,
Fan YANG
1and Ke-yu LONG
21
School of Communication and Information Engineering, University of Electronic Science and Technology of China, Chengdu, P. R. China
2
The Second Research Institute of CAAC, Chengdu, P. R. China
Keywords: Step detection, Sensors, Adaptive windows, Indoor positioning navigation.
Abstract. In recent years, the smartphones which are integrated with many high-accuracy sensors have become very popular. Utilizing the development of sensors, developers have done many useful researchers. Indoor positioning navigation is an interesting and hot field of them. Step detecting and counting are key technologies in indoor positioning. In this paper, we propose a novel method to count steps which is an improvement of the classical steps detection method, the peak detection method of the acceleration. Our proposed scheme consists of two parts: the scoring part and adaptive window length part. Two adaptive window length algorithms which can adapt to the varying velocity are also proposed in this paper. In our experiments, a smartphone - Nubia NX513J is handled, with screen facing upwards to record the accelerometer data. The scoring algorithm of acceleration in the process of step detection is tested in two kinds of path: a straight path and a U-shaped path in which it shows better results than conventional peak detection method.
Introduction
Nowadays, people spend 90% of their time indoors, which makes indoor location one of the most challenging technologies in location-based services (LBS). And indoor positioning has gained increasing concerns in recent years. But not like outdoors where global navigation satellite systems (GNSS) such as GPS are available, indoor location can’t receive the signal of GPS due to the block of walls. And the complex environment also makes it difficult to realize positioning indoors. To resolve the problem, researchers propose lots of methods such as RFID systems, Bluetooth stations, ultra-wideband (UWB) radio systems [1]. But they all need additional equipment.
With the continual miniaturization of sensors and processing nodes, Pedestrian Dead Reckoning (PDR) systems are becoming promising options for indoor tracking. PDR systems use the combined method of the count of steps and step length to describe the distance. So step detection plays a critical role in PDR systems. And researchers have made numerous studies on some indoor positioning methods such as step detection, step counting and activities recognition.
In this paper, we propose a step counting algorithm, which can identify steps in real-time. We develop an application to detect the user’s steps in the experiment. The smartphone have four kinds of sampling modules: NORMAL, UI, GAME and FASTEST. And their sampling frequencies are 5Hz, 15Hz, 50Hz and 98Hz respectively. In the research of people’s walking law, we find that one walk at most four steps per second. That is to say the maximum walking frequency is 4Hz. According to the Nyquist sampling law, we can reconstruct the original signal as long as the sampling frequency is more than two times of the highest frequency. So considering the performance and power consumption, we choose the GAME module here. The relative distance and orientation between user and smartphone may affect the result of step detection. To extract the periodicity effectively, we request the user to hold a smartphone with the screen facing upwards.
• Compare the traditional peak detection and our proposed scheme. Our proposed scheme can accumulate the user’s steps correctly with simple operations.
• The proposed scheme can adapt to the tendencies of velocity. It can also receive acceptable
results in non-straight path.
The rest of this paper is organized as follows. Section II introduces some related works. The scoring algorithm of acceleration and the designed adaptive window are described respectively in section III. This is then followed by our experimental results and discussion. Finally, we present our conclusion and future work in Section V.
Related Works
Many techniques have been developed to accurately identify step events, as well as to allow the wearable sensors to collect data from everywhere on the body. In this section, we discuss the existing step detection methods, which are mainly divided into the following four categories:
Peak detection-The step characteristics show that although different people are different in walking position, they have similar walking discipline. The heel strike can result in the sharp changes to the vertical acceleration. Steps can be detected by the pattern of successive peak and valley acceleration values [2, 3, 4]. Reference [3] utilizes a two-axis accelerometer to identify a step. The supporting phase, swing phase and heel-touch-down phase will appear sequentially and successfully in a step, which can be used to determine steps. The complexities of peak detection are low. But multiple local peaks which are very close to others are generated because the sensors are fixed on two feet. So the accuracy of step detection will be affected.
Zero crossing-The method identifies steps by counting the number of acceleration values which passes through the zeros axis [3, 5, 6]. Researchers prefer the method because of its simplicity. However, it can’t perform well in accuracy.
Auto-correlation or template matching-The method is proposed because of the strong periodicity in the acceleration values [4, 7]. The concept of Normalized Auto-correlation based Step Counting (NASC) is proposed by the authors in [8]. The auto-correlation will extract the correct periodicity of the walker from extensive acceleration values when he walks. When the person is walking and the window length is exactly equal to the period of the acceleration pattern, the normalized auto-correlation will be close to one. A high value (close to 1) indicates that the user’s state is walking and the periodicity of walking is the corresponding value of the window length. The template matching method is to collect a sample sequence of data for a step firstly. Then calculate the cross-correlation with this ‘template’ data and the periodicity can also be detected with the same process.
Spectral analysis-This method makes some calculation in frequency domain [8, 9]. In [8], the authors detect the pedestrian’s state by extracting the characteristics in a window which has 20 samples in frequency domain. FFT amplitude is regarded as the best method to recognize the start and stop point of steps. The length of a window needs to be set seriously. To guarantee the accuracy of steps detection, the author of [9] chooses the sampling rate of 20Hz.
The peak detection has low complexity and acceptable accuracy. We use the scoring scheme to improve its accuracy in this paper. The details will be introduced in next section.
Peak Detection Method
smartphone with its screen facing upwards, the gravitational acceleration has an impact on z axis only.
The acceleration generated by user’s walking mainly consists of the vertical acceleration and forward acceleration. Fig.1 shows the change of three-axis acceleration values. And we can figure that the three-axis acceleration values all have a certain degree changes in amplitude and the values of z axis have more obvious periodicity, which is beneficial to our detection. In our experiment, we just utilize the acceleration values of z axis. In essence, our new scheme is an improvement of peak detection. Also, there are a few works have been done on peak detection.
0 50 100 150 200 250 300 350
Samples 0 1 2 3 A c c e le ra ti o n o f x a xi s ( m /s 2)
0 50 100 150 200 250 300 350
Samples 0 1 2 3 A c c e le ra ti o n o f y a xi s ( m /s 2)
0 50 100 150 200 250 300 350
Samples 5 10 15 A c c e le ra ti o n o f z a xi s ( m /s 2)
Figure 1. The changes of three-axis accelerations. Figure 2. The detail process of scoring algorithm of acceleration.
Conventional Scheme
Conventional scheme takes identifying peaks as the core idea [10, 11, 12]. And use a few constraints to eliminate multi-peaks. The details mainly include four aspects:
Movement recognition. The state of users is classified as static state and walking state. There are many differences between the acceleration waves of the two states and the walking state has a bigger fluctuation. The standard deviation of the acceleration is used to recognize users’ state [10]. The expression of the standard deviation in a sample window is described as
2 1 N k k a μ σ N
, (1)
where ak is the kth acceleration, is the mean of the acceleration in the window and N is the length
of the window. If the standard deviation is below a given threshold, the state of the user is regarded as static state. Otherwise, walking state will be determined. There is another method in which the standard deviation is used in frequency domain [11], but it needs longer windows.
Extract the local peak [12]. It’s the core idea of peak detection. Only if the value satisfies (2), we regarded it as a local peak.
1 1 i i i i a a a a
. (2)
Time interval constraint [12]. The constraint of time interval can also improve the accuracy of the step detection. People can walk 4 steps at most one second. So we set the time interval as 12 sample values.
The process of pseudo peak and pseudo trough. We may encounter the condition that in a window (the details of window will be presented in next part) there is not only one local peak exceeding the threshold. And we call them pseudo peaks. We take two options to deal with pseudo peaks. If the latter is bigger than the former, we think the latter is the real local peak; otherwise, we do nothing to the result.
Our Proposed Scheme
Now we propose the new constraint of detection. Our proposed scheme mainly includes two schemes, the scoring algorithm and adaptive window length algorithm. We need do some accumulations in a window. Not only the simple threshold and time internal, but the scoring algorithm and adaptive window length algorithm are used to decrease the possible multi-peak.
1) Scoring Algorithm
If the middle point of a window is the local peak, the left points of the middle point should have an increasing tendency and the right part have a decreasing tendency respectively in theory. The amplitude of acceleration is a good description of its characterization. We accumulate the upward change of the left part and the downward change of the right part. Finally we compare the accumulated value with the threshold to determine if a step is generated. Fig.2 describes the detailed process of detecting steps using scoring algorithm.
The detailed descriptions of our proposed scheme is as follows:
Step 1: Detect the local peak which exceeds the threshold T1. If it isn’t a local peak point, go to the
next sample.
Step 2: Calculate the window length (the details is introduced in next part) and accumulate the values in a window.
Step 3: Compare the accumulated values with the threshold T2 using the scoring algorithm. If it’s
smaller than T2, go to the next sample.
Step 4: If the time interval satisfies the time threshold T3, the count of steps add 1. Otherwise,
compare the value with the last peak, if the former is bigger, modify the window length. And go to the next point.
The constraint of the scoring algorithm in a window can also show the user’s movement state. So we don’t need recognize the state of the user specially.
2) Adaptive Windows Length Algorithm
A window is the smallest unit to process acceleration values. So it’s crucial to set a suitable window length. Generally, the window length is set to a constant [13]. Some works also choose the mean of several previous windows as the current window length.
The scheme we propose in this paper comes from the time series prediction method which is a general concept. And it consists of many methods which can generate some predictions and extensions according to the characters of the time series. Simple moving average method (SMAM) and weighted moving average method (WMAM) are all effective methods of time series prediction method.
SMAM is just finding the average of several windows and it can be described in (3),
1 N
i i
l L
N
, (3)
where li is the previous window length and N is the number of windows. And WMAM is the
1
1 , . . 1 N
i i N
i
i i
ω l
L s t ω
N
, (4)
where li and N have the same meanings with SMAM. And ωi is the corresponding of weight. We
compare the two methods of calculating window length in experiment phase and the weighted one shows better performance.
Experiments
We collect the acceleration data with smartphone in two kinds of paths: straight path and U-shaped path. And we test the two methods of calculating window length with uniform velocity and varying velocity.
We use the Nubia NX513J smartphone to collect data. The experiment requires the smartphone to be holding on the hand with the displayed screen facing upwards, which can eliminate impact of the gravitational acceleration effectively.
We set the sample module as “GAME” whose sampling frequency is 50Hz, which is enough to
record the change of acceleration. Our threshold values T1, T2 and T3 are determined by numerical
tests. According to the test results, we choose T1 1.2, T2 3 and T3 12. We collect 5 sets of data with
uniform velocity, and they are 20 steps, 40 steps, 60 steps and 80 steps, respectively. Each set has 30 records, making the result relatively reliable. We use the average error of rate to compare the methods’ performance. The expression of average error rate is as (5) shows,
1 N
i i
x X
p
N
, (5)
where xi is the estimated number of steps, X is the real counts of steps and N represents the number
of trails.
Fig.3 shows the comparison result of the conventional peak detection and our proposed detection scheme which is added the constraint of scoring algorithm in a straight path. In Fig.3, the two shaped patterns represent the set of conventional scheme result and the result estimated by our proposed scheme respectively. The result indicates that our proposed method all have a better performance in each set, compared with the conventional scheme. The maximum error rate of our proposed scheme is 2.89% while the conventional scheme is 3.78%.
[image:5.595.348.507.553.686.2]
Figure 3. The error rate of estimated results with uniform
velocity in a straight path. Figure 4. The error rate of estimated results with uniform velocity in a U-shaped path.
[image:5.595.84.249.556.688.2]non-straight line path. But significantly, the performance in the U-shaped path is worse than that in a straight path because of the error generated by the swerve.
We also take some experiments to test our new proposed algorithm of calculating the window length. Our window length is mutative as the user walks. We test two methods, SMAM and WMAM, in uniform velocity and varying velocity. The experiment is made in a straight path. We choose 20 and 40 steps to make the experiment. Each set has 20 records. TABLE I. is the result of our test with a uniform velocity and TABLE II.is the result with a varying velocity. We can conclude that the two methods have the similar performance in a uniform velocity. The WMAM performs better than another algorithm in the case of varying velocity, because the former takes the correlation of the neighboring values into consideration.
Table 1. The Error Rate Of Our Two Proposed Mrthods With Uniform Velocity in Straight Path.
#Steps Simple Weighted
20 steps 5.00% 5.00%
40 steps 4.25% 4.25%
Table 2. The Error Rate of Our Two Proposed Mrthods With Varying Velocity in Straight Path.
#Steps Simple Weighted
20 steps 3.00% 2.75%
40 steps 3.75% 3.50%
Summary
In this paper, we proposed a step detection scheme based on peak detection. The key technology of the scheme are the scoring algorithm and the adaptive window length algorithm. We use our proposed method to reduce the effect of multiple peak values, which is proved useful. The WMAM was chosen due to its continuity. We also compared it with the SMAM. In addition, to test the new scheme’s applicability, we made experiments in two different paths, a straight path and a U-shaped path. Though our new scheme performed well in experiment, there are still many aspects to be improved. We restricted the smartphone to be holding with its displayed screen upwards. Therefore, our future work will extend our scheme to different modes of smartphone.
Another defect of our scheme is that the designed scheme of calculating window length is just tested in two speed modes. And we can test it and evaluating its accuracy in running mode in future.
Acknowledgement
This work was supported in part by the National Natural Science Foundation of China (No. 61675040, No. 61501088), the Joint National Natural Science Foundation of China (No. U1633129), and the Fundamental Research Funds for the Central Universities (No. ZYGX2016J009, No. ZYGX2016J003).
References
[1] Davidson P, Piche R. A Survey of Selected Indoor Positioning Methods for Smartphones[J]. IEEE Communications Surveys & Tutorials, 2016.
Reference to a book:
[3] Fang L, Antsaklis P J, Montestruque L A, et al. Design of a wireless assisted pedestrian dead reckoning system-the NavMote experience[J]. IEEE Transactions on Instrumentation and Measurement, 2005, 54(6): 2342-2358.
[4] 4th International Workshop on Wearable and Implantable Body Sensor Networks (BSN 2007): March 26-28, 2007 RWTH Aachen University, Germany[M]. Springer Science & Business Media, 2007.
[5] Shin S H, Lee M S, Park C G, et al. Pedestrian dead reckoning system with phone location awareness algorithm[C]//Position Location and Navigation Symposium (PLANS), 2010 IEEE/ION. IEEE, 2010: 97-101.
[6] Goyal P, Ribeiro V J, Saran H, et al. Strap-down pedestrian dead-reckoning system[C]//Indoor Positioning and Indoor Navigation (IPIN), 2011 International Conference on. IEEE, 2011: 1-7.
[7] Rai A, Chintalapudi K K, Padmanabhan V N, et al. Zee: Zero-effort crowdsourcing for indoor localization[C]//Proceedings of the 18th annual international conference on Mobile computing and networking. ACM, 2012: 293-304.
[8] Hess-Nielsen N, Wickerhauser M V. Wavelets and time-frequency analysis[J]. Proceedings of the IEEE, 1996, 84(4): 523-540.
[9] Gupta S K, Box S, Wilson R E. Low cost infrastructure free form of indoor positioning[C]//Indoor Positioning and Indoor Navigation (IPIN), 2014 International Conference on. IEEE, 2014: 11-18.
[10] Brajdic A, Harle R. Walk detection and step counting on unconstrained
smartphones[C]//Proceedings of the 2013 ACM international joint conference on Pervasive and ubiquitous computing. ACM, 2013: 225-234.
[11] Sun Z, Mao X, Tian W, et al. Activity classification and dead reckoning for pedestrian navigation with wearable sensors[J]. Measurement science and technology, 2008, 20(1): 015203. Lee H, Choi S, Lee M. Step detection robust against the dynamics of smartphones[J]. Sensors, 2015, 15(10): 27230-27250.
[12] Lee H, Choi S, Lee M. Step detection robust against the dynamics of smartphones[J]. Sensors, 2015, 15(10): 27230-27250.