*Article* **Smartphone-Based Unconstrained Step Detection Fusing a Variable Sliding Window and an Adaptive Threshold**

**Ying Xu 1,\*, Guofeng Li 1, Zeyu Li 1, Hao Yu 1, Jianhui Cui 1, Jin Wang <sup>1</sup> and Yu Chen <sup>2</sup>**


**Abstract:** Step detection for smartphones plays an important role in the pedestrian dead reckoning (PDR) for indoor positioning. Aiming at the problem of low step detection accuracy of smartphones in complex unconstrained states in PDR, smartphone-based unconstrained step detection method fusing a variable sliding window and an adaptive threshold is proposed. In this method, the dynamic updating algorithm of a peak threshold is developed, and the minimum peak value filtered after a sliding window filter is used as the adaptive peak threshold, which solves the problem that the peak threshold of different motion states is difficult to update adaptively. Then, a variable sliding window collaborative time threshold method is proposed, which solves the problem that the adjacent windows cannot be contacted, and the initial peak and the end peak are difficult to accurately identify. To evaluate the performance of the proposed unconstrained step detection algorithm, 50 experiments in constrained and unconstrained states are conducted by 25 volunteers holding 21 different types of smartphones. Experimental results show: The average step counting accuracy of the proposed unconstrained step detection algorithm is over 98%. Compared with the open source program Stepcount, the average step counting accuracy of the proposed algorithm is improved by 10.0%. The smartphone-based unconstrained step detection fusing a variable sliding window and an adaptive threshold has a strong ability to adapt to complex unconstrained states, and the average step counting accuracy rate is only 0.6% lower than that of constrained states. This algorithm has a wide audience and is friendly for different genders and smartphones with different prices.

**Keywords:** step detection; indoor positioning; unconstrained state; peak detectors; adaptive threshold; variable sliding window
