Smartphone-based indoor localization methods are frequently employed for position estimation of users inside enclosures like malls, conferences, and crowded venues. Existing solutions extensively use wireless technologies, like Wi-Fi, RFID, and magnetic sensing. However, these approaches depend on the presence of active beacons and suitable mapping surveys of the deployed areas, which render them highly sensitive to the local ambient field clutters. Thus, current localization systems often underperform. We embed small-volume and large-moment magnets in pre-known locations and arrange them in specific geometric forms. Each constellation of magnets creates a super-structure pattern of supervised magnetic signatures. These signatures constitute an unambiguous magnetic environment with respect to the moving sensor carrier. The localization algorithm learns the unique patterns of the scattered magnets during training and detects them from the ongoing streaming of data during localization. Our work innovates regarding two essential features: first, instead of relying on active magnetic transmitters, we deploy passive permanent magnets that do not require a power supply. Second, we perform localization based on smartphone motion rather than on static positioning of the magnetometer. Therefore, we present a novel and unique dynamic indoor localization method combined with artificial intelligence (AI) techniques for post-processing. Experimental results have demonstrated localization accuracy of 95% with a resolution of less than 1m.

Localizing people inside buildings using smartphone sensors draws increased interest. Common methods use RFID1 or Wi-Fi.2 Magnetism recently attracted considerable attention due to its pervasiveness and autonomy.3 There are two main positioning approaches utilizing magnetic sensors: identifying magnetic field characteristics of the infrastructure signatures as locations fingerprints,4 and using active magnetic flux transmitters as markers.5 

When using fingerprints, a magnetic map is built considering magnetic anomalies as landmarks.6 This scheme does not require additional hardware deployment, while interferences and anomalies from indoor building objects greatly improve magnetic field discernibility.3 Yet, this approach requires known magnetic maps or massive calculation to build simultaneous localization and mapping (SLAM). Moreover, in strong electromagnetic interference environments, magnetic fields may differ from the fingerprints causing potential localization errors.7 The second method uses external magnetic field transmitters, producing fields located by the smartphone magnetometer, regardless of existing building magnetic fingerprints.8 Generating the magnetic flux is energy consuming and expensive transmitter units are required. Both approaches depend either on active magnetic devices, or suitable mapping surveys of the deployed areas, making them sensitive to local magnetic field clutters.

We present a simple, low-power, robust smartphone localization in unknown-magnetic-fingerprint locations by deploying an array of permanent magnets in pre-known locations. By detecting its unique magnetic signature using machine learning-based algorithms, a passive localization method is obtained.

As the proposed method is landmark-based, we draw comparisons to three competing state-of-the-art approaches for indoor localization with landmark-based magnetism mechanisms are covered in Ref. 3. Wang et al.8 presented UnLoc, established on landmarks matching. MapCraft, introduced by Xiao et al.,9 is rooted on the conditional random fields method. The IODetector from Li et al.10 used joint thresholds. For completion, we also refer to localization methods based either on spatial-temporal sequence matching or on fusion with motion.3 

Consider commercial buildings where many people carry uncontrolled ferrous materials. The magnetic field is measured by the cell-phones’ vector magnetometer. Magnetic clutter is present, e.g., stationary magnetic gradients of the construction infrastructure, distorting the natural magnetic flux and causing spoof localizations. The infrastructure may contain large-scale electrically conductive loops acting as sources of magnetic alternating transmissions.11 Furthermore, moving ferrous objects create interference either from inside the building (people carrying ferrous objects) or from outside (cars, trains). Finally, the cellphone itself generates clutter, both by moving in the environmental field and from its uncontrolled internal electrical currents.11 

Ferromagnetic bodies create three-dimensional distortions of the ambient Earth magnetic field. Usually, dipole approximation is acceptable. Here, the anomaly magnetic flux decreases with inverse proportion to the third power of the distance. The decay for the magnetic field B is:

(1)

where K is a constant with range of 0.1-0.2, M the total magnetic moment in Am2, and r is the dipole-to-sensor distance. Typical values of indoor background clutter (e.g., corridor surroundings) lie around 10-20 μT, easily detectable by smartphone magnetometers with common sensitivity of about 1μT. Generating patterns having good signal-to-interference-ratios (SIRs), an induced field of 40-50 μT is required. By Eq. (1), for r between 0.5-1m, a magnet of 125Am2 is required. Such devices exist: fixed neodymium magnets, powerful mainly due to the tetragonal Nd2Fe14B crystal structure, having exceptionally high uniaxial magneto-crystalline anisotropy. The neodymium alloy is composed of microcrystalline grains aligned in powerful magnetic fields during manufacture. The resulting magnetic energy value is 18 times greater than “ordinary” magnets by volume. This allows using small but very prominent magnets as passive beacons or markers, producing the required signals. The magnetic field is three-dimensional and the phone sensor can measure each one of its components.

We embed small-volume-large-moment permanent magnets in given locations inside the building and arrange them in specific geometric configurations. This results in super-structure patterns of supervised magnetic signatures, constituting unambiguous magnetic environments. The localization algorithm learns these unique patterns during a training stage and detects them from ongoing data streaming during real-time localization: the test stage. Localization is based on smartphone motion rather than on static positioning of the magnetometer.

Each permanent magnet creates a dipole or a quadrupole, depending on its geometry. The dipole creates non-uniform magnetic flux, resulting in magnetic fields that differ from the source at every azimuth, and used to code the reference magnet. By placing an array of magnets in different orientations, a coded magnetic field is created. A magnetic sensor passing along a path of coded magnets can determine its unique position by matching the pre-learned code.

Let Bx[n], By[n], and Bz[n] respectively hold the nth sample of the x, y, and z magnetic field components, processed with moving time frames of N samples. Note B̲xi,B̲yi,B̲ziR1×N the ith time frame of the x, y, and z components. Denote the concatenated ith frame as fi=B̲xi,B̲yi,B̲ziR1×3N. Assume two hypotheses for each frame fi: H0 if the embedded magnetic pattern is absent and H1 if it is present in that frame. Define the following indicator I(fi):

(2)

The goal is to correctly classify (fi) ∀i.

We implement six AI-based algorithms with different modeling mechanisms: two variations of support vector machine (SVM),12 with and without principal components analysis (PCA).13 To efficiently perceive non-linear trends, a fully-connected deep neural network (FC-DNN)14 was used with 4 hidden layers of 400 neurons each. Optimization was carried using Adam.15 These methods lack feedback information in their mechanisms, instructive when dealing with time series modeling. Thus, a recurrent neural network (RNN),16 a gated recurrent unit (GRU),17 and long-short term memory (LSTM)18 networks are implemented.

Measurements were collected using Xiaomi-mi4 smartphone and the Sensor Kinetics Pro sensor acquisition application, which recorded magnetic sensing information from the BOSCH magnetic field sensor with sensitivity between 0-1600μT, resolution of 0.3μT, and power consumption of 0.5mA.

Experiments were conducted in four environments of different intrinsic magnetic patterns. In each, the user strolled with the smartphone in-pocket and recorded 30 minutes of data, comprising 10 passes by the embedded magnetic pattern. To generate randomness, walking pace differed between 0.8-2 m/s and walking distance ranged between 0.5-1m (Fig. 1).

FIG. 1.

Schematic view of the experimental setup.

FIG. 1.

Schematic view of the experimental setup.

Close modal

The walking heading ranged between 0° and 360° while elevation remained unchanged. The magnets were positioned at height of 1.5m and at distance of 3m from one another. The average SIR was 8 dB.

The data contained five signals: 3-axial magnetic signals, pitch, and roll, notated Bx, By, Bz, P, R, respectively. The magnetic norm, B, was calculated to enhance the prominent energy of instilled magnets (Fig. 2):

(3)

We aimed to reduce dependency of measurements on the smartphone orientation. Thus, we generated the horizontal and vertical magnetic components, Bh and Bv, correspondingly:19 

(4)
(5)
FIG. 2.

3 minutes of magnetic norm recorded by the smartphone. The rectangular borders the target magnetic signature, shown in zoom-in view.

FIG. 2.

3 minutes of magnetic norm recorded by the smartphone. The rectangular borders the target magnetic signature, shown in zoom-in view.

Close modal

All magnetic signals sense prominent magnetic anomalies around the magnets relative to the intrinsic magnetic environment. While B expectedly captures the explicit target pattern, Bh follows the same behavior while being user-orientation-independent.

During pre-processing, rectangular windows of 12.5s with 80ms shift divided the data into frames, capturing the entire embedded pattern in a single frame, while containing each target signature multiple times. The database contains 72000 data frames.

We perform feature extraction from the time series measurements to feed the AI with a compact and informative data. The extended ith time frame is:

(6)

Each signal component in f̃i is mapped to 20 features with physical and statistical orientations. To facilitate temporal behavior, each feature vector is concatenated to 2 feature vectors affiliated with 2 adjacent past time frames, resulting in 360 features per time frame. Past look of 2 frames enhanced performance without overconsuming computational load. Let FE(·) hold the feature extraction operator and denote x̃iR1×360 as the feature vector extracted from f̃i. For i > 2:

(7)

Each feature vector is linked with a binary label yi0,1, indicating magnetic signature.

We construct the training and testing datasets with a leave-one-out methodology and perform four training-testing procedures. The reported results correspond to the statistical mean of test accuracy over this 4-fold process.

The localization performance (ROC) of the six AI algorithms is shown in Fig. 3, allowing analysis of the trade-off between true positive rate (TPR) and false-positive rate (FPR) in various operation points.20 The Long Short-Term Memory (LSTM) network leads. Following the LSTM come GRU and RNN. Even though they show degraded performance relative to the LSTM due to less advanced temporal modeling, their architecture is leaner regarding memory and computational load, being more adequate for on-device applications. The least performant methods are the DNN and SVM. LSTM shows 95% accuracy (based on Ref. 21), while GRU and RNN reach 93% and 90%, respectively. DNN shows 85%, SVM-PCA method reaches 80%, and SVM produces 75% accuracy. The superiority of the LSTM over competing methods is explained as follows. LSTMs are able to learn optimal time series context via feedback-based learning for temporal classification, this context being pre-specified and fixed in the DNN and SVM methods. Even though the RNN employs feedback, it suffers short-term memory, preventing it from modeling temporal context between early and late periods. To mitigate this gap, the GRU and LSTM architectures contain gate mechanisms that regulate information flow through the network. While the GRU contains fewer parameters that require less memory and training data, the LSTM embeds an additional memory unit inside its gate allowing enhanced control over information flow.22 

FIG. 3.

Receiver operating characteristic (ROC) curve, comparing localization performance of six AI-based methods. Zoom-in view is given.

FIG. 3.

Receiver operating characteristic (ROC) curve, comparing localization performance of six AI-based methods. Zoom-in view is given.

Close modal

For performance evaluation, we employ the key metrics of mean localization error (MLE) and classification accuracy.3 These metrics are sensitive to changes in test environments, so the following values are listed for reference only. UnLoc achieved MLE between 1-2m and outperformed MapCraft. Both approaches show lower performance compared to the proposed approach, localizing at maximal error of 1m. The IODetector was able to obtain localization accuracy as high as 82% indoor, which falls short to the 95% presented by the LSTM-based algorithm covered in this study. Additional methods, rooted on spatial-temporal sequence matching or on fusion with motion,3 also show lower MLE and classification accuracy compared to our study.

Additional experiments were conducted using the LSTM algorithm to inspect generalization and robustness. First, localization accuracy with respect to the walking pace of the carrier was analyzed, to verify our approach as applicable to real-life scenarios. Walking paces were taken from the ensemble {0.8, 1.2, 1.6, 2} m/s. Performance analysis showed respective average localization accuracies of 94.5,96.2,95.6,94%. This evaluation stresses high robustness of the proposed approach for slow and fast paces. The optimal walking pace, in terms of maximal accuracy, is expected to vary depending on the smartphone sampling rate, distance between magnets, and carrier walking distance. Future work will cover this extended analysis.

Localization should apply in intrinsic environments of low SIR levels. While experiments dealt with 8dB SIR, we synthetically inspected the performance in SIRs ranging from 6dB to 0dB. Results have shown that 6dB SIR barely affects the performance with average degradation of less than 2% in accuracy, while 4dB SIR leads to an accuracy of 88%, and 0dB SIR reaches 82%.

Another experiment synthetically decimated the resolution of recordings to simulate CPU load. While measurements were taken at 120Hz, 60Hz and 30% lead to 88% and 75% accuracy respectively.

In practical scenarios, it is beneficial to record fewer shots of the magnetic pattern during training to avoid inefficiency and fatigue. Experiments showed that instead of crossing the magnetic pattern 30 times in each of the 4 environments, 20 times were sufficient for 90% accuracy, and 10 times provide accuracy of 80%.

These experiments point to the robustness of the LSTM algorithm to dominant magnetic interference and lower amounts of training data. It also emphasized the highly generalized modeling the LSTM performs that enables it to identify the target signature with missing information derived from impeded data resolution.

A new low-power dynamic indoor localization method combined with AI is presented. Passive permanent magnets are deployed instead of active magnetic transmitters. The localization was performed based on smartphone motion rather than on the static positioning of the magnetometer. Among various AI schemes, LSTM network showed leading performance of 95% accuracy. Additional experiments point on the robustness of the LSTM algorithm to dominant magnetic interference and lower amounts of training data. These results are very promising regarding applying passive localization of a moving person in indoor environment. For instance, it may be used for locating potential customers passing by a targeted area in a shopping mall or a store aisle. Further refinement of this method will address specific magnets orientation, pre-defined pattern positioning, and improved AI models to reach higher accuracies.

The data that support the findings of this study are available from the corresponding author upon reasonable request.

1.
L.
Yang
,
Y.
Chen
,
X.-Y.
Li
,
C.
Xiao
,
M.
Li
, and
Y.
Liu
, “
Tagoram: Real-time tracking of mobile RFID tags to high precision using COTS devices
,” in
Proceedings of the 20th Annual International Conference on Mobile Computing and Networking
,
2014
, pp.
237
248
.
2.
X.
Shixiong
,
L.
Yi
,
Y.
Guan
,
Z.
Mingjun
, and
W.
Zhaohui
, “
Indoor fingerprint positioning based on Wi-Fi: An overview
,”
ISPRS Int. J. Geo-Information
6
(
5
),
135
(
2017
).
3.
S.
He
and
K. G.
Shin
, “
Geomagnetism for smartphone-based indoor localization: Challenges, advances, and comparisons
,”
ACM Comput. Surv.
50
(
6
),
1
(
2018
).
4.
H.
Xie
,
T.
Gu
,
X.
Tao
,
H.
Ye
, and
J.
Lu
, “
A reliability-augmented particle filter for magnetic fingerprinting based indoor localization on smartphone
,”
IEEE Trans. Mob. Comput.
15
(
8
),
1877
1892
(
2016
).
5.
K.
Watanabe
 et al., “
A smartphone 3D positioning method using a spinning magnet marker
,”
J. Inf. Process.
27
,
10
24
(
2019
).
6.
Q.
Wang
,
H.
Luo
,
F.
Zhao
, and
W.
Shao
, “
An indoor self-localization algorithm using the calibration of the online magnetic fingerprints and indoor landmarks
,” in
2016 International Conference on Indoor Positioning and Indoor Navigation (IPIN)
,
2016
, pp.
1
8
.
7.
C.
Gao
and
R.
Harle
, “
Sequence-based magnetic loop closures for automated signal surveying
,” in
2015 International Conference on Indoor Positioning and Indoor Navigation (IPIN)
,
2015
, pp.
1
12
.
8.
H.
Wang
,
S.
Sen
,
A.
Elgohary
,
M.
Farid
,
M.
Youssef
, and
R. R.
Choudhury
, “
No need to war-drive: Unsupervised indoor localization
,”
MobiSys’12: Proceedings of the 10th International Conference on Mobile Systems, Applications and Services
,
June 2012
.
9.
Z.
Xiao
,
H.
Wen
,
A.
Markham
, and
N.
Trigoni
, Lightweight map matching for indoor localisation using conditional random fields,
2014
.
10.
M.
Li
,
P.
Zhou
,
Y.
Zheng
,
Z.
Li
, and
G.
Shen
, “
IODetector: A generic service for indoor/outdoor detection
,”
ACM Trans. Sen. Netw.
11
(
2
),
1
(
2015
).
11.
E.
Weiss
and
R.
Alimi
,
Low-Power and High-Sensitivity Magnetic Sensors and Systems
(
Artech House
,
2018
).
12.
J. A. K.
Suykens
and
J.
Vandewalle
, “
Least squares support vector machine classifiers
,”
Neural Process. Lett.
9
(
3
),
293
300
(
1999
).
13.
S.
Wold
,
K.
Esbensen
, and
P.
Geladi
, “
Principal component analysis
,”
Chemom. Intell. Lab. Syst.
2
(
1
),
37
52
(
1987
).
14.
T. N.
Sainath
,
O.
Vinyals
,
A.
Senior
, and
H.
Sak
, “
Convolutional, long short-term memory, fully connected deep neural networks
,” in
2015 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)
,
2015
, pp.
4580
4584
.
15.
D. P.
Kingma
and
J.
Ba
, “
Adam: A method for stochastic optimization
,” arXiv:1412.6980 (
2014
).
16.
Z. C.
Lipton
,
D. C.
Kale
,
C.
Elkan
, and
R.
Wetzel
, “
Learning to diagnose with LSTM recurrent neural networks
,” arXiv:1511.03677 (
2015
).
17.
R.
Dey
and
F. M.
Salemt
, “
Gate-variants of gated recurrent unit (GRU) neural networks
,” in
2017 IEEE 60th International Midwest Symposium on Circuits and Systems (MWSCAS)
,
2017
, pp.
1597
1600
.
18.
M.
Schuster
and
K. K.
Paliwal
, “
Bidirectional recurrent neural networks
,”
IEEE Trans. Signal Process.
45
(
11
),
2673
2681
(
1997
).
19.
B.
Li
,
T.
Gallagher
,
A. G.
Dempster
, and
C.
Rizos
, “
How feasible is the use of magnetic field alone for indoor positioning?
,” in
2012 International Conference on Indoor Positioning and Indoor Navigation (IPIN)
,
2012
, pp.
1
9
.
20.
J. N.
Mandrekar
, “
Receiver operating characteristic curve in diagnostic test assessment
,”
J. Thorac. Oncol.
5
(
9
),
1315
1316
(
2010
).
21.
A. R.
Henderson
, “
Assessing test accuracy and its clinical consequences: A primer for receiver operating characteristic curve analysis
,”
Ann. Clin. Biochem.
30
(
6
),
521
539
(
1993
).
22.
J.
Chung
,
Ç.
Gülçehre
,
K.
Cho
, and
Y.
Bengio
, “
Empirical evaluation of gated recurrent neural networks on sequence modeling
,” arXiv:1412.3555 (
2014
).