A Study of WiFi-Aided Magnetic Matching Indoor Positioning Algorithm

Aiming at the shortcomings of the existing indoor location algorithm, such as low accuracy of positioning, high deployment and maintenance cost, and unstable robustness, this paper proposes a method of indoor location based on the integration of smartphone with WiFi and magnetic field using multisensor fusion. In the initial stages of positioning, rough location is achieved by WiFi-RSSI fingerprints which provides an initial location and geomagnetic matching area for indoor positioning based on particle filter magnetic field matching. This paper proposes the use of median filter algorithm to deal with the original magnetic field data and covariance interpolation algorithm to generate magnetic field map, and effectively reduce the interference which caused by geomagnetic fluctuations, thereby it will improves the positioning accuracy. Finally, through conducting comprehensive experiments and tests, the results show that the proposed technique can reliably achieve 0.836 meters precision in current experimental environment.


Introduction
As the most people spend 70% to 90% of their time using mobile location-based services (LBS) in indoor environments, the need for indoor location technology is increasing and becoming critical.In recent years, with the rapid development of wireless communication technology and the widespread popularity of intelligent terminals, wireless location technology has also become a research focus.At present, the widely used global positioning system in the outdoor field can achieve relatively accurate positioning and navigation, but the GPS signal in the indoor serious degradation or even unavailable [1].The indoor positioning system based on the wireless network framework is widely studied because it does not need to add other hardware, and has low cost, wide deployment and other advantages [2] [3].However, WiFi signals may be affected by attenuation, multipath fading, human obstruction and so on, which may lead to a decrease in positioning accuracy, although positioning can be achieved by WiFi fingerprint or propagation model [4].
Modern architecture of reinforced concrete or steel frame structure on the indoor magnetic field disruption, the formation of a non-uniform magnetic field environment create the differences of the magnetic field in different tracks.
Thus, using of the magnetic field in the indoor environment, unique, stability and the difference between different regions to achieve positioning become possible.Therefore, some teams began to explore the use of geomagnetism to achieve indoor positioning, which is more representative of the University of Oulu, Finland, Janne Haverinen et al. and the use of geomagnetism for indoor positioning.The research team has completed a verification test in a mine tunnel of about 1380 meters with a positioning accuracy of 1.5 meters [5].At the Massachusetts Institute of Technology (MIT), the researchers rely on indoor magnetic fingerprint matching and inertial sensor combination to locate in the office environment.The results showed that the cumulative error of 0.71 meters was 50%, 1.64 meters probability was 90% [6].Due to the complexity of the indoor environment, all kinds of technology have limitations, so many indoor positioning methods are difficult to achieve a wide range of popularization.Therefore, it can achieve the goal of low cost, high precision, favorable timeliness and strong universality by merging the multi-indoor positioning technology, taking advantage of various methods and complementing the deficiency [7].Combined with the advantages and shortcomings of existing single positioning technology, mobile phone which combined with WiFi and geomagnetic fingerprint fusion positioning is proposed.In the positioning phase, the magnetic matching region is selected by the RSSI positioning result.Subsequently, it is precisely positioned by the geomagnetic field.This combination method can effectively overcome the positioning error caused by multipath effect of RSSI and solve the problem of too slow convergence rate of particle filter in magnetic field localization.

Location Model
In the office environment, the first set walking path in accordance with certain laws, and then experimental personnel holding a smartphone to walk at a constant speed in the set route, collecting and recording the magnetic field used to generate line magnetic filed map.Secondly, a reference point (RP) which corresponds to an absolute coordinate is used to assist the positioning of the target is set on the route.At the same time, the RSS of WiFi and the magnetic field are captured at each reference point for positioning.Mobile users in the environ-ment has access to map data, the use of handheld terminals, real-time data acquisition and the use of existing algorithms to obtain real-time positioning results.
In this paper, the feasibility and data acquisition and processing of magnetic field for indoor location are introduced.As shown in Figure 1, the magnetic matching indoor positioning algorithm assisted by WiFi is introduced.Compared with the wireless fingerprint positioning method, the geomagnetic matching location error is small [8], but due to the non-uniqueness of the geomagnetic field, the mismatch ratio of the magnetic matching algorithm is seriously.In order to reduce the mismatch ratio of magnetism positioning, and WiFi fingerprint algorithm is combined to improve positioning accuracy [9] [10].

Geomagnetic Data Acquisition and Processing
With the development of micro-electro-mechanical systems (MEMS), mobile intelligent terminals are embedded with sensors, such as magnetometers and the like for mobile users to use and magnetic field positioning, and it provides the possibility.In order to prove the stability of the geomagnetic signal, two sets of data are collected at different time periods in the same place.As shown in Figure 2, the geomagnetic signal has a certain stability, but there is some fluctuation in the local, which provides a theoretical basis for making full use of the geomagnetic field to do indoor positioning.

Median Filter Algorithm
Median filtering is essentially a method of determining the filter output response by minimizing the sum of the absolute values of the errors [11].Let a set of observations be the sum of the absolute values of the approximations . ( To the minimum, it must have  ( ) ( ) To satisfy the Formula (2), the value in the middle position after the size order should be taken.As shown in Figure 3, the collected geomagnetic field intensity data, even in the same sampling point, for a period of time, the data will be 2uT jitter, so we use the median filter and the original data Smoothing filter.The filtered data can improve the match rate when the original data is retained, which is the main feature of the original data.

Covariance Interpolation Algorithm
Because of the characteristics of geomagnetic space fluctuation, the covariance interpolation algorithm is more effective than other interpolation algorithms.
Kriging is a mathematical statistical method for spatial interpolation [12].Being used to weight around the measurements to arrive at the location of the forecast is not measured.Commonly used formula is: where S i is the position (S )

Particle Filtering Algorithm
The use of smartphone that owns magnetometer to read the magnetic field data is relative to the phone's coordinate system.In terms of the same position to change the attitude of the mobile phone, reading the magnetic field vector is different, while the smartphone carried by the magnetometer itself exists measuring noise, and the error is random.This also leads to the non-uniqueness of geomagnetic fingerprints in the region.The particle filter algorithm can solve this problem.Particle filter algorithm, including the following basic steps: 1) Initialization.The particle set = is generated by a priori probability 0 ( ) p x , and all the particle weights are 1 N .
( ) ( ) Which d represents the step size, θ ∆ represents the direction of the user changes in the value of the direct use of compass and gyroscope measured, that i t θ is the direction of the particles i at the moment t , similarly, that ( ) x y represents the particles i at the time of the location coordinates.Respectively,

3) Importance of resampling
Based on the Monte Carlo method, the objective function is fitted by random sampling.At the moment 1 t + , for a set of particles ( ) i t X , the state of each par- ticle is updated to ( ) X + produce random particles around the new position to get a new set of particles Since each particle represents a possibility of the target state, the purpose of system observation to make the particle similar to the actual situation obtains a larger weight, and the particle with the larger difference from the actual situation gets a smaller weight.Consequently, the weighting of exponential distribution is calculated: Weighted normalization:

5) Estimate the user location
The current location is estimated using the particles sampled in the previous step.

Experimental Setup
In order to verify the fingerprint model and proposed algorithm in this paper, an experimental building was chosen as the experimental environment.In the experiment, we select the Huawei honor-7 smartphone as a receiving device.TPlink dual-band router is as the WiFi access point to construct the WiFi fingerprint library and auxiliary magnetic matching positioning.The experimental scenarios were selected in the back hall corridor of the Science and Technology Building hall.In this area, four APs were deployed.In the corridor, according to the established route, setting a RP reference point every 0.5 meters, and recording the RP's WiFi signal RSSI which generates fingerprints database.Then, on the same route, according to the uniform velocity motion, the geomagnetic field is collected, and the collected data is filtered through the median filter, mapped to the route uniformly.Finally, covariance interpolation is used to generate the geomagnetic map.

Experimental Simulation and Analysis
In the positioning phase, first, the use of WiFi fingerprints obtain the initial position and rough location of the delineation.In combination with the error of the RSSI localization algorithm in the experiment, we will delimit the rough position and then retrieve the magnetic filed data of the database in the coarse position and use the particle filter algorithm to match the geomagnetic data in the geomagnetic map, and the geomagnetic data is collected in the actual movement.
Secondly, the use of mobile phones with accelerometer and electronic compass inferres the direction and displacement of the user movement.Subsequently, using the geomagnetism distribution in the coarse region, the particle filter algorithm is used to realize the accurate indoor location, and finally determine the moving trajectory of the user.
In the use of WiFi positioning phase, we use the commonly used location fingerprint method.In the known indoor area, n WiFi access points (AP1, AP2, AP3... APn) is deployed.Furthermore, the RSS values ing, K nearest neighbor algorithm is used.Instead of using the nearest distance as the location of the mobile terminal, the nearest K ( 2 k ≥ ) sampling points are selected and the K sampling points are calculated by the Formulas ( 9) and (10) of the average coordinates, as the target location coordinates.

( , )
i i x y represents the position coordinates of the i sample point.With ( , ) x y as the center and 3 times the standard deviation of the RSSI as the radius to determine the matching area of the magnetic field, to achieve accurate matching of magnetic field by particle filter.
According to the specific circumstances of the experimental scene, the next phase of the magnetic filed data generated by the map is shown in Figure 6.It can be seen from Figure 6 that the color of the energy distribution is closer to red in the one-meter wide corridor, indicating that the energy is stronger near the coordinate point (2750, 750), because the energy is the strongest point near the floor for the building body pillars.
In this paper, the particle filter algorithm for magnetic matching positioning can use the location of the results of geomagnetic matching to provide a search range.At the same time, the geomagnetic data collected online includes the location information at this moment, (magnetic field data and direction angle, which the online data and database map to match.)The resulting positioning of the trajectory is shown in Figure 7.
The error analysis of WiFi-RSSI and geomagnetic field in Figure 8 shows that the average error of WiFi-RSSI positioning is 2.23 meters, at the same time, due    to the location of WiFi-RSSI, the convergence of the particle filter is obviously improved, and the run-time is saved, and the mean of positioning error is 0.836 meters.Because the measured value is disturbed by the surrounding environment, the effect of the whole algorithm is in a fluctuating state.The accuracy and stability of the algorithm are determined by the RSSI algorithm that was originally used.At the same time, the whole consideration is used in the algorithm, instead of judging the position of one or several data, so the degree of susceptibility to interference is better than that of wifi.

Conclusion
In order to solve the problem which is high mismatching rate in the process of matching the location of the magnetic field, this paper proposes a fusion location algorithm of WiFi aid magnetic field, which is simple and low cost, and it combines with particle filter algorithm to achieve ideal the positioning effect.The experimental results show that this method has potential advantages in improving the accuracy and real-time performance.Future work will continue to optimize the algorithm and research to improve positioning accuracy and timeliness.

Figure 2 .
Figure 2. Stability and local fluctuation of geomagnetic field with (a) at different days and (b) different mobile phones.

Figure 4 .
Figure 4. Spatial distribution of interpolated magnetic field.

Figure 7 .
Figure 7. WiFi-RSSI and geomagnetic fusion positioning of the trajectory.

Figure 8 .
Figure 8. Error of WiFi-RSSI and magnetic field fusion positioning.