1. Introduction
The Global Positioning System (GPS) serves as the de facto technology due to its precisely accurate positioning information outdoor. However, GPS inability to work in the indoor environments necessitated the researchers to delve into other alternatives for indoor positioning. Indoor localization got a huge interest, especially during the last decade, primarily due to the excessive use of smartphones. In addition, various companies’ services, which are collectively called Location Based Services (LBS), also accelerated this endeavor as indoor localization serves as the backbone of these services. Not only that, such indoor localization can be extremely helpful to locate workers working in emergency situations such as fire, earthquake, etc. Indoor positioning technology can be broadly divided into two categories: infrastructure dependent systems and infrastructure independent systems. The former either makes the use of existing devices such as WiFi [
1,
2,
3] or installs new hardware such as placing Bluetooth [
4], and RFID (Radio Frequency Identification) [
5] chips in the building. Although the aforementioned technology provides very accurate location information, it often requires extra time and high cost for hardware installations. Moreover, the localization systems cannot work properly and in some situations entire system goes down in the absence of the installed hardware. The latter approach relies on either the utilization of omnipresent phenomena such as geomagnetic anomalies or it uses already available off the shelf hardware. One such example is the sensors in the mobile phones such as the use of accelerometer, gyroscope, etc. The idea of using the magnetic field anomalies for indoor localization has gained wide attraction during the last few years [
6,
7,
8]. Although this technology is prone to drift error, it is simple, cheap and does not require installation and maintenance of any additional infrastructure.
Table 1 discusses the technologies used for indoor positioning and localization [
9,
10].
We focus on the infrastructure free approach as all smartphones have built in sensors which can easily be adopted for indoor localization. These sensors, developed using Micro-Electric Mechanical Systems (MEMS), are becoming more reliable than before. This research aims to use three such sensors: magnetometer, accelerometer and gyroscope. The contributions of this research work can be summarized as below:
An algorithm is presented to generate the patterns using the geomagnetic data. The generated patterns are computationally efficient to process.
A deep learning based artificial neural network is presented to detect user states of walking and stationary using gyroscope data.
An efficient infrastructure free user indoor localization algorithm is presented for when the user’s initial position is unknown.
The rest of the paper is organized in the following manner.
Section 2 gives an overview of the geomagnetism, its important characteristics and fingerprinting approach. Related research work is described in
Section 3.
Section 4 is about the proposed method and its working mechanism. The performance of the proposed method is discussed along with the results in
Section 5. Discussion is given in
Section 6. Finally the conclusion is drawn in
Section 7.
3. Related Work
The application of magnetic fields to solve the problem of indoor positioning and localization can be broadly categorized into two groups: active magnetic fields and passive magnetic fields. The former approach accomplishes this task by generating artificial magnetic fields. Sheinker et al. and Blankenbach & Norrdine in [
14,
15] utilized the same technique to get sub-meter accuracy in small testing areas. These active magnetic fields are strong and less affected by the environment, hence providing very good accuracy. The latter approach, on the other hand, benefits from earth geomagnetic field and is getting more attention from industry and academia. Since we focus on latter approach, the following section discusses few works related to this approach.
Chung et al. in [
16] developed an indoor localization system using magnetic disturbances as a fingerprint. The magnetic sensor worn on the chest is used for the system. The authors compared the performance of their system with RADAR, Horus, WhereNet, Ubisense and GSM fingerprinting and showed that the system performs well in terms of precision (90% within 1.64 m) in positioning, as compared to other systems. One limitation of the system is that, in the case of larger fingerprinting map, the error goes higher. The proposed system uses chest hung sensor instead of smart phones, which makes it less vulnerable to user shaking and moving.
Li et al. in [
17] investigated the use of geomagnetic field for the indoor localization using smart phone sensors. They used geomagnetic field value alone for the localization and proved that, if more elements of geomagnetic fields are used, the error is very small. However, the error may rise up to 20 m or higher in certain cases and user may be positioned in other than the original building as well if there is no knowledge of the original building. Thus, the authors suggest the use of other sensors along with geomagnetic field to remove such errors and increase precision.
Li et al. in [
18] use HMR2300 and Galaxy Nexus to test the indoor localization based on geomagnetic fingerprinting. HMR2300 is placed on a trolley both to generate the database and test system localization accuracy. The results show that the error lies between 0.6 and 6.9 m without normalization. However, the accuracy is very poor in the case of using Galaxy Nexus and it goes up to 10 m. The authors suggest to use geomagnetic filed values with other positioning techniques such as WiFi to reduce the error. The author used a trolley to make the fingerprinting database; however, in real scenarios, while using mobile phone, the geomagnetic field strength values vary, which in turn can lead to higher error. Moreover, only one floor of 36 × 2 m dimension is used for the experimentation with only 20 points in total, thus the results cannot be generalized.
Zhang et al. in [
19] proposed geomagnetism fingerprinting based navigation system which utilizes the crowd sourced built geomagnetic map for indoor navigation. The system includes the modules for map generation, localization and navigation using geomagnetic data. A revised Monte Carlo localization approach is used to find the indoor location. To find the initial position the system uses the continuous geomagnetic data samples of few tens of seconds. The algorithm is able to converge 90% of the errors to approximately 5 m with 30 s of data. Although the system is able to get the initial position with low error, 30 s time is very long for location estimation. Even at the velocity of 0.8 m per second, user travels approximately 24 m in the given time. Such long time may not be available in many real time situations, not to mention the fact that user frequent change of direction may make location finding more difficult as well.
Jung, J., Lee, S.M., and Myung, H., in [
20] addressed the problem of robot relocation using ambient magnetic and radio measurements. They propose magnetic SLAM (Simultaneous Localization and Mapping) which is based on Rao–Blackwellized particle filter and grid-based SLAM frameworks. They make the use of two magnetometers (Honeywell, HMR 2300) and one radio range sensors (Nanotron, nanoLOC TRX) to improve the performance of SLAM. The results of the approach show a mean error of less than 1 m for both approaches. Although the results of their algorithm are quite attractive, few points are very critical for the practical implementation of their approach. First, they placed two magnetometers on robot at a specified distance from each other. The distance between the magnetometer is very important, as, if the magnetometers come close, they can interfere the geomagnetic readings, which will lead to incorrect magnetic intensities. Second, the place tested for the approach is very small, only few meters square. Third, their approach cannot be adopted for localization using smart phone, as it is not possible to deploy multiple magnetometers on a smartphone.
An indoor navigation system based on WiFi and geomagnetic fingerprinting is presented in [
21]. The error of geomagnetic positioning is controlled by restricting search space with the help of WiFi APs (Access Point). The system is tested in two distinct areas with dense APs and with scattered APs. The experiment is conducted using Samsung galaxy S3 and S4. The experiment results show that the average error is reduced to 4.5 m when utilizing WiFi-aided geomagnetic navigation, which is up to 10.2 m in the case when WiFi alone is used. The results show that WiFi-aided magnetic matching positioning serves as a reliable solution for indoor navigation. This approach relies heavily on the use of WiFi to restrict the search space for geomagnetic matching and if WiFi is not used the error for geomagnetism alone goes up to 16.6 m. In addition, WiFi approach is infrastructure dependent and its failure result in system being non functional.
Meng et al. in [
22] introduce an indoor localization which uses the magnetic sensor of the smartphone to localize a user. The magnetic map is formed with the help of local weight regression, as presented by Cleveland [
23]. The LWR uses the local data to fit points with the help of polynomials weighted fitting and least square method is used to calculate the polynomial coefficient. The user collected magnetic data are filtered with moving average filtering model and then user’s location is estimated using a particle filter method. The experiment is performed in 27 × 7 m building with Honor7 smartphone and the results demonstrate that the average error with filtered data is 0.229 m while the unprocessed data show an error of 0.394 m. The test environment is only one building with short space and the experiment is conducted with only one smartphone, thus the device dependence is not studied. In addition, as mentioned in the paper, the measurements are taken with fixed height and smartphone direction and how the magnetic attitude will vary with changing height is not studied. An indoor localization system is offered in [
24] which is based on WiFi, image and magnetic fingerprints, Bluetooth and people co-occurrence. The image database contains the images of each room which helps to narrow down the search area. The SIFT (Scale Invariant Feature Transform) is used to extract the features from the images. The user time-specific activities are also taken into account to determine the location. The experimental results reveal that the proposed system achieves an accuracy of 87.3% on average to successfully locate the user. The system is based on user’s social information along with the camera, WiFi, Bluetooth and smartphone sensors and uses the spatio-temporal co-occurrence information for localization which raises privacy concerns. In addition, the system is infrastructure dependent, as it uses the WiFi which is not pervasive.
A fingerprinting based localization scheme based on magnetic field strength and channel state information is discussed in [
25]. A Line of Sight (LOS) identification algorithm is presented to narrow down the localization area. Afterwards, the channel state information is combined with magnetic field strength to formulate the fingerprint database. Then, localization is performed by matching the user scanned magnetic field information with the fingerprint database with the help of Multi-dimensional scaling k-nearest neighbor algorithm with Minkowski distance. The results show that the system is able to accurately locate a user within 1.7 m for 80% of test points. An indoor localization approach based on visual images and geomagnetism called VMag is presented in [
26]. The approach utilizes the smartphone sensors and does not require additional infrastructure assistance. The data from magnetic sensor are fused with visual images for indoor localization. A neural network based method is also introduced for extracting the features from visual images. Afterwards, a context aware particle filter approach is used for tracking. The approach is able to achieve a probability of 91% for 1.34 m accuracy for four different tested environments including a laboratory, a garage, a canteen and an office.
An indoor localization system is presented in [
27] which utilizes the magnetic field information to locate a user. Instead of using the magnetic intensity alone, it considers magnetic
x,
y and
z values and calculates representative features. The features including entropy, power of the coefficients, variance, variance of Fast Fourier Transform, intensity, Zero Crossing Rate, kurtosis, skewness and correlation coefficient are extracted and later used for localization process. The clustering is performed as well by taking into account the magnetic intensity. A classifier is designed to estimate the location based on the extracted features. The presented approach shows good results, however with a single device.
28 presented an indoor localization approach based on camera, WiFi and inertial sensors including accelerometer, gyroscope, compass and magnetometer. Initially, the scene is identified using the camera on the smartphone and deep learning has been utilized for the said purpose. Fingerprinting approach is used for WiFi and geomagnetism to aid the localization process. The proposed system is able to achieve an accuracy of 1.32 m at 95%. Even though the system achieves a very good accuracy, it is not always practical to hold the mobile phone in a position to acquire the image of the scene which is the very pivotal component of the proposed system. In addition, using mobile phone camera consumes the phone battery very quickly as well. Moreover, the draw back of using the camera is that it cannot work in dark environment. Another fact which cannot be undermined is that the system also uses the WiFi fingerprinting which makes it infrastructure dependent.
This research presents an indoor localization system which benefits from the geomagnetic disturbances prevail in indoor environments. These disturbances are caused by ferromagnetic materials such as doors, elevators, concrete containing iron, etc. The majority of the already available indoor positioning and localization systems based on geomagnetism use fingerprinting technique. The main drawbacks of the traditional fingerprinting based techniques are that the database needs to be updated periodically otherwise the accuracy of the localization systems is affected. Secondly, the geomagnetic data are device dependent which means that measuring magnetic flux intensity using two different smart phones shows very different values. This makes it very difficult to use geomagnetism for indoor localization for all devices alike. The above mentioned problems are resolved using the geomagnetic patterns. Thus, instead of using magnetic flux intensity values, we use the patterns formed by these values.
Figure 2 shows that patterns for magnetic intensity are very similar for different devices, thus we make the database of these patterns. In addition, even though the magnetic field strength values changes, they form the similar patterns. Thus, patterns are not affected by the change in the geomagnetic strength values. The proposed method is discussed in detail in the next section.
4. The Proposed Method
The indoor localization that this study presents leverages off-the-shelf sensors already available in smartphones.
Figure 3 shows the block diagram of the proposed system. We make the use of three sensors including magnetic sensor, accelerometer and gyroscope. The gyroscope is used to determine the heading estimation of the user. Additionally, it has been utilized to ascertain the state of the user i.e., whether he is moving or stationary. The accelerometer and magnetometer are employed to estimate the user current location. Although, traditionally, accelerometer needs the initial position to determine the next position, we use it without the initial position in this case. The magnetometer is the main sensor which computes the user location by taking the advantage of the accelerometer. Our proposed system incorporates three modules and, in the following section, each module is discussed separately.
4.1. The Gyroscope Module
In the current study, the purpose of using the gyroscope is twofold: motion detection and the heading estimation. Even though accelerometer is used traditionally for the motion detection, we use gyroscope for the same purpose for two reasons. First, the gyroscope supports fast data rate than accelerometer so working at higher data rate is possible. Second, gyroscope is more tolerant to noise, so, with a little preprocessing, data quality is good to be used for the system. Various techniques exist that can be adopted for motion detection including Artificial Neural Networks (ANN), Support Vector Machines (SVM), Decision Trees (DT), Principal Component Analysis (PCA), etc. We use ANN in our work, as it is easy to implement and shows good performance as well.
The ANN is the mathematical model based on the human brain neuron and it works well for pattern recognition, forecasting, data compression, etc. A typical ANN is consisted of an input layer, one or more hidden layers and an output layer each containing small units called neurons or nodes, as shown in
Figure 4. The layers are interconnected with the directed edges and each edge carries a weight which is used to determine the activation of the neuron in the next hidden layer with the help of a mathematical function. Similarly, another function computes the output of the ANN. ANNs are used to determine the decision boundaries in the form of weights and biases, which is achieved with the help of training. ANNs are characterized into supervised and unsupervised based on their training methods. The number of the input nodes depend on the number of the features and are selected equal to the number of features. The feature selection is the most important process in the ANN modeling. Integrating too many features degrades the performance of the ANN model; similarly, the features which have no or less variance produce poor results. Conventionally a feature analysis algorithm such as PCA is utilized to analyze the behavior of the extracted features. A PCA is performed in the current study to analyze how well the selected features can classify the motion and shown in
Figure 5.
The weights of the ANN are determined using the back-propagation algorithm [
29] in which outputs are computed and then errors are propagated backwards to adjust the weights accordingly. This process is repeated until the error is converged to a certain threshold. In the current study, an ANN with five hidden layers and five nodes is used with supervised training. The priority of using ANN over other traditional methods is set for motion detection in current study because the use of ANN is reported in [
30] for motion classification, in [
31] for motion classification using smartphone, in [
32] for step counting based on accelerometer and gyroscope data, in [
33] for step detection and step length estimation, and in [
34] for stride detection using smartphone.
The input vector
is used for the ANN where
t shows the time and
m is the size of the input vector. For the current study,
m is five because we use four features from the gyroscope and a bias node. The details of the features used as an input vector are given in
Table 2.
The output vector
is used for the ANN where
n is the size of the output vector, which is two in our study. We use the gyroscope data to determine whether the use is walking or stationary at a particular time. We use sigmoid activation function for the ANN.
The sensor data from smartphone sensors is collected at a sampling frequency of 10 Hz and is pre-processed using a low pass filter to reduce the noise effect. The selected features value varies significantly when the user changes its state from stationary to walking. For training the ANN, 5000 samples of every feature are used. The ANN for user state prediction achieves an accuracy of 95%.
4.2. The Acceleration Module
The accelerometer is used to calculate the distance traveled by the user in a given time frame
f where the size of
f for this study is 1 s. The accelerometer provides three-axis acceleration values and the total acceleration is calculated as follows:
We use step detection model to calculate the distance for each frame. A step detection algorithm is proposed as well which works on the acceleration data. The algorithm has the following steps:
- (1)
Compute the magnitude of the acceleration for a given sample
i- (2)
Compute the variance in acceleration using
where
is empirically calculated value for medium walking speed and
.
- (3)
Find the local maxima as step candidates and then apply Threshold 1 and Threshold 2. Threshold 1 is applied on acceleration and Threshold 2 is on the distance between the peaks.
After step detection, we use Weinberg model [
35] to measure the step length:
where
and
represent the maximum and minimum values of acceleration for the given frame and
is empirical step length estimation. The value of
is 0.55 in the original article but we use a value of 0.52 as it gives more accurate results for our data.
When step detection and step length estimation is complete, we can calculate the position of the user using the following equation:
where
represents the heading angle (yaw) and we make the use of Euler angles to calculate it as:
The calculated distance using accelerometer module is used to assist the magnetometer module to find the exact position of the user. The details of this process are discussed in the next section.
4.3. The Magnetometer Module
The magnetometer module is the key part of the system which decides the user location in the indoor environment. The location of the user is found by matching the user scan with the fingerprint database. The database contains patterns formed by magnet
x, magnet
y and magnetic
z values for each point. Our experiments reveal that accuracy is higher if
x,
y and
z magnetic values are matched as compared to magnetic field intensity B alone, so we store the patterns formed by
x,
y and
z magnetic values. Since the orientation of the smart phone is fixed in front of the user, as shown in
Figure 6, the values of three magnetic axis can be used. Additionally, the fixed behavior of smartphone orientation guarantees the quality of data as well and sensor and shaking noise is removed by using a low pass filter. For fingerprint database, it is not appropriate to take continuous scans and average them as various scans may have different lengths of data due to the varying speed of the user. Instead, we take 100 observations at each point separated by 1 m and then these observations are averaged. Afterwards, interpolation is used to generate data values between these points.
The fingerprint database approach has associated disadvantage of its need to be updated periodically. Moreover, various smartphones exhibit different geomagnetic values at the same time for the same place which makes it impossible to use the fingerprint approach for all smartphones. Preferably, we use the patterns formed by smartphones as compared to the geomagnetic values themselves. Pattern matching in itself is a computationally expensive process which may hinder the performance of the system, so we present the concept of Binary Grid (BG) which stores the patterns in a binary form. We call it binary as it contains only two integers: 0 and 1. The 1 is where we have a magnetic value and 0 otherwise. Algorithm 1 is proposed to generate the BG for given geomagnetic intensity values. It is easy and computationally efficient to convert the values to patterns and store and extract them. Here, we explain the algorithm with the help of a toy example.
Algorithm 1 Generate geomagnetic pattern |
- 1:
- 2:
- 3:
- 4:
- 5:
- 6:
fordo - 7:
- 8:
- 9:
end for
|
Let us say that we have to transform the geomagnetic values shown in
Figure 7 to the pattern and store it in the BG. First, we need to decide the size of the BG. The total number of rows in the grid is the difference of maximum and minimum magnetic values, while the columns are the length of the frame or, in this case, the total data points taken.
First, a matrix containing zeros of
M ×
N size is declared where
M is number of rows and
N is the number of columns. Then, each magnetic data point is taken and converted to a row number by subtracting it from the maximum data point and rounding it. Afterwards, a 1 is added to the calculated row and this process is repeated for all the data values. The BG shown in
Figure 7 (left) is for the first twenty values only of the graph shown in
Figure 7 (right), while
Figure 8 shows the magnetic
x axis for Galaxy S8 and its associated BG.
For the current study, magnetic data values from Samsung Galaxy S8 are gathered to make the BG. Afterwards, this grid is used to match the user scans for both Samsung Galaxy S8 and LG G6. We use a 1 s frame at a sampling rate of 10 Hz to perform the pattern matching. Each frame is taken, converted to the pattern using the given algorithm and then matched against the BG (geomagnetic pattern database). The point with the lowest error is selected as the user location and error is calculated using the Euclidean distance. Algorithm 2 is used as the localization algorithm.
Table 3 shows the notations used in the algorithm.
Algorithm 2 User positioning using geomagnetic and acceleration data. |
1: | fordo |
2: | for do |
3: | |
4: | |
5: | |
6: | end for |
7: | |
8: | |
9: | end for |
10: | ; |
First, a user sample of geomagnetic values is taken and converted to a pattern using the given algorithm. Then, that sample pattern is matched against the pattern database. The point with the lowest Euclidean distance is taken as the geomagnetic position. This process is repeated for ten consecutive samples.
The distance traveled by the user is also calculated using the acceleration data. Five such iterations are made and then the estimated positions using geomagnetic pattern matching for five iterations are considered for final location. The underlying reason for taking five windows is to reduce the error in matching caused by the similarity of magnetic values at different places. Even though that pattern matching performs very well in finding the user position, the user position is often miscalculated, which results in high errors. Each window is exactly one frame ahead of the previous window. This difference is used to infer the next location of the user. By taking user position for five consecutive windows, we are able to find the outliers and replace them with correct positions using the distance calculated using the accelerometer data. Since each window is separated by one frame and the average distance traveled by user in one frame is 0.85 to 0.95 m, the location calculated by the algorithm for each window should match the same, otherwise it is not correct. We follow the same logic to calculate the final location of the user.
Figure 9 shows the flow chart of the proposed algorithm. In the following a toy example is given to better explain how the algorithm works.
Toy example: Let us say that we have user taken geomagnetic values given in
Figure 8; the blue bars on the figure show the size of the frame taken for pattern matching. After the first iteration of the inner loop given in Algorithm 2, we have ten geomagnetic positions and ten distance values for the same frames. Now, we assume that each geomagnetic position is a correct estimate and adjust its preceding and conceding positions with the help of the acceleration distance we have. For example, for
set of geomagnetic position estimates and
set of distance data, the set of candidate positions is calculated as:
For the data values given in
Figure 10, the geomagnetic estimates and distance data are given in
Table 4.
For simplicity, in this explanation, we only take x coordinate of geomagnetic estimate. The acceleration distance is in meters and show the distance for one frame. Thus, if we consider that the first geomagnetic estimate is correct, then the next positions can be calculated using the distance data and they will be 4.42, 5.25, 6.04, 6.97, 7.82, 8.72, 9.51, 10.39 and 11.2, respectively. We call these calculated positions as position candidates and we calculate all the possible candidates by considering each of these 10 geomagnetic estimates as the correct position. This yields ten sets of position candidates. The calculated candidate sets are then compared with geomagnetic estimates and positions are:
One set of position candidates is selected as the geomagnetic positions and its first position is the starting position of the user. This process is repeated for five windows. The size of the window is same, i.e., ten frames. The only difference is that the second window is one frame ahead of the first frame and so on, as shown in
Figure 10. Thus, after the five windows are finished processing, we get five starting positions. Sometimes, the calculated five positions are not consistent so we need to look for any outliers. This will ensure more stable and accurate position. We use the following equation to find the outliers.
where
is set to 10, as we have at most 10 m data. The outliers are removed and positions are calculated using the correct positions and distance data. For example, the
x coordinate of five positions calculated for the above given example are 3.51, 4.46, 32.46, 6.88 and 7.76, respectively. Thus, using the outlier finding equation, the third position in this sequence is an outlier and it is replaced with the correct position using the distance data. The positions corrected after the removal of outliers are called the finalized positions.