RSS Ranging Algorithm Based on Kalman Filtering Combined BP Neural Network

Accurate distance estimation is an important prerequisite for positioning using wireless sensor networks (WSN). However, the path loss model (PLM) cannot accurately express the relationship between distance and received signal strength (RSS), because of the complexity of the indoor environment. Therefore, this paper proposes an improved Kalman filter as the RSS preprocessing method to make up for the defects of PLM. The improved algorithm uses BP neural network to correct the Kalman filter error, improve the filtering performance, and use the compensated RSS for PLM-based ranging. The experiment shows that the proposed method has better ranging accuracy than the method based on Kalman filtering. And the average is 0.29m, which has dropped by 0.61m.


Introduction
In recent years, with the development of mobile Internet technology, indoor positioning services based on wireless technology have received extensive attention. Compared with positioning algorithms such as TOA, AOA, and TDOA, RSS-based algorithms are widely used, with advantages such as low cost, simple implementation, and no need for additional hardware equipment [1]. Ranging (acquisition range) is a prerequisite for providing indoor positioning services [2]. In the indoor environment, the propagation process of wireless signals is affected by environmental factors such as wall reflections and obstacles. While the PLM relies on parameters and specific environment, it is an approximate statistic of the relationship between RSS and distance, and its application scenarios are limited.
Many existing works have modified PLM to improve the accuracy of ranging. In [3], author proved that the ranging algorithm based on BP neural network can reduce the error and adapt the environment. In [4], author compared the accuracy of the two algorithms of Polynomial Approximation and Neural Network in distance estimation and points out that the accuracy of the two improved algorithms is higher than that of the traditional PLM. In [5], author proposed a new Bayesian formula to replace the commonly used PLM. In [6], author believed that the path loss of signal propagation is too complicated and there is no accepted mathematical expression. It proposed the application of RBF neural network as a positioning algorithm without the premise of ranging. However, these methods are only from the perspective of using neural networks to construct PLM, without considering the stability of RSS, which is susceptible to environmental factors. In [7], the Kalman filtering has been used to denoise RSSI to optimize the accuracy of target positioning. In [8], comparing the ranging errors of different filters, the author believed that Kalman filtering can reduce errors more effectively than Gaussian filtering. In [9], the author uses Gaussian filtering and Kalman filtering to collect and process RSS to reduce the impact of environmental noise. The above method improves the ranging accuracy based on the path loss model by preprocessing the RSS. However, these methods only ignore the PLM based on the mathematical model from the perspective of ensuring the accuracy of the path loss model parameters, and it is difficult to accurately describe the relationship between RSSI and distance.
In this paper, the RSS accuracy was improved to improve the ranging accuracy by combining the neural network and the Kalman filter. The RSS was smoothed using the Kalman filter, and then the nonlinear error of the Kalman filter was compensated by using the BP neural network. Finally, we used the compensated RSS to calculate the distance according to the traditional PLM. This method can increase the application range of Kalman filtering and reduce the ranging error

Log-distance Propagation Model
The PLM is used to calculate the distance between the transmitter and the receiver using the RSS [10]. We select the simple and general log-distance propagation model, it can be expressed as: (1) Where is the distance from transmitter to receiver; is the reference distance; n is the path loss factor, and it takes a value of 2-4 and be changes of the environment in general; is the RSS at of the distance transmitter; is the RSS at the known distance; And represents Gaussian random noise with a mean of 0 and a standard deviation of σ, usually can be ignored.

The Kalman filtering
The Kalman filtering is an effective algorithm to reduce environmental noise in RSS, which can output RSS smoothly. Suppose a set of RSS measured at a certain location is ( , , ... ), and input it to the Kalman filtering, where the prediction stage is as follows: The measurement stage is as follows: Where and represent the previous and current best estimate state, represents the previous state to predict the current state, A and H are the system parameter, represents Kalman gain, and represent the covariance of and ,and Q is the noise of the system. After completing an iteration, and covariance will be iterated into the prediction stage.

The BP-Kalman filtering
The preprocessing of data using Kalman filtering is based on the premise that the measurement noise of RSS is known and their mean value is zero. Based on the formula (7), It can be seen that the systematic error is that the average value has a high probability of being non-zero.

Where
represents the true error, which is the difference between the theoretical true value and the measured value, err represents the systematic error of the PLM.
In order to improve the ability of Kalman filtering to correct RSS, we consider using neural networks to further correct the optimal filtering estimates. BP neural network is a multi-layer prefeedback neural network trained according to the error back propagation algorithm. It has a strong mapping capability for nonlinear systems and is widely used.
Transform formula (5) into formula (8): Where is the difference between the measured value and the predicted value. From the formula (8), the performance of Kalman filtering is constrained by , , and . The network structure is as follows:  After designing the neural network, the sum of the output Z and the optimal estimation value of the Kalman filter is used as the final filtering result, which indirectly solves the system error of the PLM and enables the improved the Kalman filtering to achieve the optimal estimation.

Test Results and Discussions
A residential apartment was selected in the study area, in order to ensure the authenticity of the experiment. The experimental equipment includes a model is the WS82 WiFi router as the transmitter, and a smart phone with model VTR-AL00 as the receiver. And Measuring the RSS data at a distance of 1 ~ 9m from the transmitting node. There are 9 sets of data, each with 150 data.  Fig.3 Raw RSS at Different Distances Figure 3 shows the situation of some data sources. The RSS measured at the same location is unstable, fluctuates within a certain interval, and has abrupt values. Using the raw data directly for measurement, the result error will be larger.
Matlab as the experimental platform. Using collected data and based on the formula (1), the parameters =1m, = -24.06 dbm and n = 2.39 of the log-distance propagation model. In the entire experiment, setting the structure of the BP neural network to 3-7-1, The first 50 RSS were used as the training samples of the neural network, and the remaining data were used as the verification samples. The verification samples are processed using Kalman filtering and BP-Kalman filtering.  Table 1 shows the real RSS corresponding to different distances, as well as the raw data and the RSS processed by the two filtering algorithms. First, the raw data is different from the truth value, although the truth data is calculated based on the raw data. And the truth value is not within the distribution of the raw data.
Compared with the Kalman filter algorithm, the data is distinguished and distributed in the range containing the true value by using the BP-Kalman filter algorithm proposed in this paper. Although the Kalman filtering can effectively enhance the stability of RSS, it cannot reduce the errors caused by the log-distance propagation model.  Figure 4 shows the distance value calculated based on the two algorithms. we can see that the improved algorithm proposed in this paper can be closer to the true distance value. And table 2 shows the ranging errors of the two calculations.  According to Figure 5 and Table 2, we can see that the maximum ranging error of the Kalman filter was 1.83m, the minimum ranging error was 0.03m, and the average ranging error was 0.9 m. Using the method proposed in this paper, the maximum ranging error 0.83m, the minimum ranging error was 0.02m, and the average ranging error was 0.29m. Compared with the method using Kalman filtering, the average ranging error of the improved algorithm is improved by 66.7%, and the accuracy is within 1 meter. This is clearly superior to the Kalman filtering method.

Conclusion
In this paper, it proposes a Kalman filter algorithm that incorporates a BP neural network. Specifically, the best estimation RSS value of Kalman filter is corrected by BP neural network, which reduces the error of log-distance propagation model caused by complex indoor environmental problems. And the results show that the improved algorithm proposed in this paper can effectively reduce the fluctuation of RSS and significantly improve the ranging accuracy, the accuracy is kept within 1 meter, and the average ranging error is increased by 66.7%. This method is only from the perspective of RSS correction, and it needs further research on its application in indoor positioning.