Lora RTT Ranging Characterization and Indoor Positioning System

In recent years, indoor positioning systems (IPS) are increasingly very important for a smart factory, and the Lora positioning system based on round-trip time (RTT) has been developed. This paper introduces the ranging characterization, RTT measurement, and position estimation method. In particular, a particle ﬁ lter localization method-aided Lora pseudorange ﬁ tting correction is designed to solve the problem of indoor positioning; the cumulative distribution function (CDF) criteria are used to measure the quality of the estimated location in comparison to the ground truth location; when the positioning error on the x -axis threshold is 0.2m and 0.6m, the CDF with pseudorange correction is 61% and 99%, which are higher than the 32% and 85% without pseudorange correction. When the positioning error on the y -axis threshold is 0.2m and 0.6m, the CDF with pseudorange correction is 71% and 99.9%, which are higher than the 52% and 94.8% without pseudorange correction.


Introduction
Indoor positioning systems are increasingly very important for a smart factory, such as finding the location of workers, goods, or vehicles [1][2][3][4]. However, the Global Positioning System (GPS) is unable to provide the indoor positioning service, which is commonly used for outdoor positioning. The research on indoor positioning technologies has been conducted for more than three decades, such as Radio Frequency Identification (RFID) [5,6], WiFi [7,8], Ultra Wide Band (UWB) [9][10][11], Pseudolite [12][13][14], Bluetooth [15], and Inertial Navigation System (INS), but they may not be suitable for Internet of Things (IoT) applications in terms of cost, application mode, and terminal power consumption.
With the continuous progress of sensor and Internet of Things [16,17] technologies, increasing attention has been paid to IPS using Lora WAN. Semtech has developed a Lora positioning system based on round-trip time [18], which is called the SX1280 transceiver. The SX1280 transceiver family provides ultra-long-range communication in the 2.4 GHz band with a time-of-flight functionality; its radio is fully compliant with all worldwide 2.4 GHz radio regulations including EN 300440, FCC CFR 47 Part 15 [19], and the Japanese ARIB STD-T66 [20]. Very small wearable products to track and localize assets in logistic chains and people for safety can easily be designed thanks to the high level of integration and the ultralow current consumption which allows the use of miniaturized batteries.
But the most difficult challenge for Lora indoor positioning is the ranging error caused by multipath in the indoor environment. Liang et al. carry out the study focused on the indoor propagation of the Lora signal, and the main contribution of this work is to measure the round-trip time and packet delivery ratio by changing send power, payload length, and air rate in a multilevel building from the 1st floor to the 12th floor [21]. Huynh and Brennan verify the UWB transmission characteristics of an indoor RTT signal by generating synthetic received signals using ray tracing plus Rayleigh distributed random multipath clusters as well as random amplitude and delay factors [22]. Staniec and Kowal describe outcomes of measurement campaigns during which the Lora performance was tested against a heavy multipath propagation and a controlled [23], Lora configurational space is divided into three distinct sensitivity regions: in the white region, it is immune to both interference and multipath propagation; in the light-grey region, it is only immune to the multipath phenomenon but sensitive to interference; and in the dark grey region, Lora is vulnerable to both phenomena.
On the other hand, location based on a filtering algorithm is the only effective solution currently known, and the Bayesian filtering algorithm occupies an important role. In the early days, the Kalman filter positioning algorithm is mainly used to solve the problem achieving efficient state estimation for linear Gaussian systems [24]. Moreover, to deal with unwanted errors and nonlinear distortions, particle filter (PF) is applied as a nonparametric filter to location, which is recursive implementations of Monte Carlo-based statistical processing [25][26][27] and performs well in localization efficiency, stability, and accuracy.
In the following sections, a Lora indoor positioning system is introduced, which overcomes the problem of long distance, low power consumption, and low cost. The main contributions and research content of this paper are as follows: Firstly, a Lora-aided particle filter localization method is designed to solve the problem of indoor positioning. Secondly, numerous experiments were carried out with real Lora RTT measurement data to evaluate the performance of the proposed approach; we used the CDF criteria to measure the quality of the estimated location in comparison to the ground truth location. The results show that the indoor positioning accuracy is improved obviously with the help of the piecewise fitting correction method. At the same time, the Lora indoor positioning system can achieve a positioning accuracy of 1 m under the condition of LOS.

Background and Related Work
2.1. Lora RTT Measurement. In this paper, we focus on one of the latest techniques called the RTT scheme-based ranging and localization [28][29][30], which can give accurate measurements by the time stamp from the initiator (Lora_A) to the responder (Lora_B) with nanosecond resolution. Figure 1 shows the RTT measurement illustration; the pseudorange measurement can be built as where ρ AB or ρ BA is the pseudorange measurement between Lora_A and Lora_B, R AB or R BA is the geometric range between Lora_A and Lora_B, t r A is the clock offset of Lora_A at the receiving time, t s A is the clock offset of Lora_A at the transmitting time, t r B is the clock offset of Lora_B at the receiving time, and t s B is the clock offset of Lora_B at the transmitting time.
If the clock characteristics of Lora_A and Lora_B are stable, t r A = t s A and t r B = t s B at the adjacent time of receiving and transmitting. The time-of-flight (ToF) measurements can be written as where T round is the time-of-flight (ToF) measurements of Lora_A from Tx_A to Rx_A, T reply is the time difference of Lora_B between Rx_B and Tx_B.
The geometric distance can be calculated by The pseudorange measurement can be built as

Position Estimation.
Four distance measurements of Lora transceivers whose positions are known are used to determine the three-dimensional coordinates of an unknown position [31], as shown in Figure 2. The position of user (x u , y u , z u ) can be calculated by where R iu is the pseudorange measurement of AP i , i is the AP index, and u is the user index, (x i , y i , z i ) are the locations of AP i , and ε iu is the measurement error of AP i . The geometric distance can be calculated by where ½e i x , e i y , e i z is called a geometry matrix. The observation equations of Lora RTT can be expressed as the following matrix form: : ð8Þ The matrix on the right-hand side of Equation (8) is defined as A and ε, and the two-column vectors on the lefthand side are defined as b. Equation (8) can be written as If an initial value X 0 is used for the solution-updating process, the Newton-Raphson method is described Then, the position X 1 can be updated iteratively according to It should be noted that the measurement error is considered Gaussian white noise, when using the least-squares method.

Ranging Characterization of Lora
3.1. Clock Error. It is supposed that the clock offsets of devices Lora_A and Lora_B are ε A and ε B ; therefore, the ranging error will increase with the increase of flight time. The equa-tion of ranging error is as follows: where ε t is ranging error caused by the clock offsets.
If the clock error of Lora_A and Lora_B is the same, Equation (12) can be written as It is supposed that the distance between the two Lora nodes is between 10 meters and 5000 meters; then, R AB is from 3 ns to 1500 ns. The clock error of packaged crystal oscillator (PCO) is generally more than 25 ppm, the temperature compensated crystal oscillator (TCXO) is from 0.5 ppm to 5 ppm, and the oven-controlled crystal oscillator (OCXO) may be less than 0.1 ppm. According to the above parameters, we estimate the influence of clock error on Lora ranging accuracy, as shown in Table 1. It can be found that TCXO and OCXO are best used as the clock of the Lora positioning system.  Ranging Accuracy and Characterization. The reflection of the indoor environment to the Lora positioning signal is very serious, for example, irregular room structure, walking people, tables and chairs, and glass. Because of signal interference and multipath effect, Lora's ranging error may be non-Gaussian distribution. We collect the ranging data of Lora under different conditions such as line-of-sight (LOS), non-line-of-sight (NLOS), and human occlusion, which is compared with the real distance to analyze the ranging characterization. Three sets of ranging data are collected under the LOS condition; the ranging error of Lora is shown in Figure 3. The average error is -0.61 m, the maximum error is 1.2 m, and the minimum error is -5.24 m. It can be found that the ranging error of LOS has a linear trend, which can be corrected by the polynomial fitting method.
Similarly, three sets of ranging data are collected under the NLOS condition, such as using people's bodies to block Lora's antenna; the ranging error of Lora is shown in Figure 4. The average error is -0.01 m, the maximum error is 8.6 m, and the minimum error is -3.32 m. It can be found that the ranging error of NLOS is much worse than that of LOS; therefore, it is better to use the Lora indoor positioning system under the condition of LOS.
In order to analyze the distribution characteristics of Lora ranging error, the six groups of data collected above are combined, as shown in Figure 5. Figure 5(a) shows the histogram with a distribution fit, and Figure 5(b) is the normal probability plot. It can be concluded that the probability distribution of Lora ranging error is non-Gaussian white noise. Therefore, it is necessary to use nonlinear filter to solve the location problem.
The piecewise fitting correction method of LOS is used to correct the Lora ranging value, as shown in Figure 6. The formula of the piecewise fitting correction method can be expressed as where R is the pseudorange measurement of Lora, R 3.3. Geometry Factor. The dilution of geometry precision (GDOP) [32,33] can be expressed as HDOP and GDOP can be defined as , where the normalization weight is given by The filtering density is approximated by Optionally at each time, take N samples with replacement from the set where the probability to take sample i is w i t and let w i t = 1/N (4) Time update Generate predictions according to the proposal distribution: where xDOP 2 means the dilution of precision (DOP) for the x-coordinate and yDOP 2 means the DOP for the y-coordinate.
In order to analyze the influence of the geometry factor on Lora positioning performance, a simulation of geometry distribution is designed, which is composed of four Lora transceivers. Suppose the length and width of the room are 40 meters and the height is 3 meters, as shown in Figure 7. The HDOP of the indoor positioning system is given in Figures 8(a) and 9(a); the GDOP of the indoor positioning system is given in Figures 8(b) and 9(b). The results show that four Lora transceivers can obtain the suitable geometric distribution in their projection area, whose HDOP and G DOP are less than 1.2. However, outside the projection area, the geometric distribution will deteriorate; HDOP and G DOP will be greater than 2, which will make the positioning error more than twice of the ranging error.

Methodology Based on Particle Filter
4.1. Recursive Bayesian Estimation. Applied nonlinear filtering is based on discrete-time nonlinear state-space models relating a hidden state X t to the observations Y t , denote the observations at time t by Y t = fy 0 , ⋯, y t g, the Bayesian solu-tion to compute the posterior distribution is given by where t is the time stamp, x t is the state variable, pðX t-1 /Y t-1 Þ is the posterior probability distribution of the last moment, pðX t /X t-1 Þ is the state transition probability, pðX t /Y t-1 Þ is the prior probability distribution, pðy t /X t Þ is the likelihood function, and pðy t /Y t−1 Þ is the normalization function.
from the posterior probability pðX t /Y t Þ of the state can be extracted, where X i t is the state of the particle, w i t is the weight of the particle; then, where δ is the Dirac delta function and N is the number of particles.

Wireless Communications and Mobile Computing
The Sequential Importance Sampling (SIS) method is used to calculate the weight of particles, which is written as The prior probability distribution is used as the importance density function: Then, the formula for calculating the weight of particles is where t is time stamp, i is the number of particles, and w is the weight of particles.

4.3.
Particle Filter Implementation. The particle filter algorithm is summarized in Table 2. Firstly, the state parameters and weights of particles are initialized; secondly, the iterative process of the particle filter algorithm is divided into four steps, which includes measurement update, estimation, resampling, and time update.

Experimental Results and Analysis
5.1. Experimental Setup. The performance of the Lora positioning system is evaluated in a room as shown in Figure 10; the size of the room is about 25 meters long, 4 meters wide, and 2.5 meters high; and the antenna coordinates of Lora are surveyed precisely with a total station.

Experimental
Results. Figure 11 shows the static test without pseudorange correction for the Lora positioning system, Figure 11(a) is the positioning results, Figure 11 Figure 12 shows the static test without pseudorange correction (the piecewise fitting correction method) for the Lora positioning system, Figure 12(a) is the positioning results, Figure 12 The positioning error in terms of the cumulative distribution function on the databases with and without pseudorange correction is shown in Figure 13. When the positioning error on the x-axis threshold is 0.2 m and 0.6 m, the CDF with pseudorange correction is 61% and 99%, which are higher than the 32% and 85% without pseudorange correction. When the positioning error on the y-axis threshold is 0.2 m and 0.6 m, the CDF with pseudorange correction is 71% and 99.9%, which are higher than the 52% and 94.8% without pseudorange correction.

Conclusions
The long-distance transmission of Lora wireless technology makes it possible to be widely used in the smart factory; this paper proposes Lora RTT measurement for indoor positioning, which has two key aspects of innovations: Firstly, a Loraaided particle filter localization method is designed to solve the problem for indoor positioning. Secondly, numerous experiments were carried out with Lora RTT measurement data to evaluate the performance of the proposed approach; we used the CDF criteria to measure the quality of the estimated location in comparison to the truth location. The results show that the indoor positioning accuracy is improved obviously with the help of the piecewise fitting correction method. At the same time, the Lora indoor positioning system can achieve a positioning accuracy of 1 m under the condition of LOS. In the future, we will focus on Lora indoor positioning and pseudorange correction under the condition of NLOS.

Data Availability
No data were used to support this study.

Conflicts of Interest
The authors declare that they have no conflicts of interest.