Ambient magnetic field-based positioning with smartphones: a comparison of different f ingerprinting methods
Abstract
This dataset provides athe supporting material for the work entitled Ambient Magnetic Field-Based Positioning with Smartphones: A Comparison of Different Fingerprinting Methods, presented at the 2025 International Instrumentation and Measurement Technology Conference (I2MTC 2025) and published in the Zenodo repository. The document includes the following components: 1) A description of the experimental environment and setup. 2) An extended version of the results. 3) A comprehensive descriptor of the attached database. 4) Documentation of the accompanying code.
Full text
Ambient magnetic field-based positioning with smartphones: a comparison of different fingerprinting methods Zenodo package documentation Fernando J. ´ Alvarez , Fernando J. Aranda , Felipe Parralejo , Jos´e A. Moreno , Juan Espinosa and Rodrigo Gallardo Abstract This document provides a detailed description of the supporting material for the work entitled Ambient Magnetic Field-Based Positioning with Smartphones: A Comparison of Different Fingerprinting Methods”, presented at the 2025 International Instrumentation and Measurement Technology Conference (I2MTC 2025) and published in the Zenodo repository. The document includes the following components: 1) A description of the experimental environment and setup. 2) An extended version of the results. 3) A comprehensive descriptor of the attached database. 4) Documentation of the accompanying code. This supplementary material aims to enhance the reproducibility of the study, providing all relevant details regarding the data collection process, analysis methods, and implementation of the proposed algorithms. 1 Introduction This document provides supplementary material for the work entitled “Ambient Magnetic Field-Based Positioning with Smartphones: A Comparison of Different Fingerprinting Methods,” presented at the 2025 International Instrumentation and Measurement Technology Conference (I2MTC 2025). In this study, a distinct approach to magnetic positioning is adopted, focusing exclusively on the static positioning of a smartphone user using magnetic flux vector fingerprints. Unlike conventional methods that incorporate mobile measurements or integrate RF signals, this work solely relies on static fingerprinting. Building on previous analyses of fingerprinting-based positioning algorithms [1], [2], this study presents a similar evaluation centered exclusively on smartphone-based magnetic measurements. The fingerprinting algorithms under evaluation include, in summary, Weighted k-Nearest Neighbors (Wk-NN) and other distance-based algorithms, measurement probability-based methods, as well as machine learning techniques such as Support Vector Machines (SVM), Gaussian Process Regression (GPR), Random Forests (RF), and Multilayer Perceptron (MLP). Additionally, a comparative performance analysis is conducted against RSS Bluetooth Low Energy (BLE) fingerprinting data collected simultaneously. This document serves three primary purposes: 1. As an extended version of the original work, including all tables and figures omitted due to space constraints. 2. As a dataset descriptor, providing examples of usage. 3. As documentation for the software developed to reproduce the results presented in both the original article and this document. The remainder of this document is organized as follows: Section II summarizes the experimental setup, detailing the hardware, software, and data collection methodology. Section III presents an extended version of the results from the original article. Section IV describes the associated database. Section V is divided into two subsections: the first subsection explains the code provided as an example of database usage, while the second subsection details the code used to reproduce the results presented in Section III and the original article. Finally, Section VI discusses the study’s contextualization, its limitations, and general notes on the supplementary material. 1
2 Experimental setup and Data collection procedure 2.1 Positioning environment Experiment for this work were carried out in the University Research Institute building at the University of Extremadura, in its campus in the city of Badajoz (Spain). The building is a rectangular-shaped multifloor building with offices laboratories and other facilities destined to management and research. However, in this work only the ground floor and parts of the basement have been used, which includes the cafeteria and an auditory hall. Pictures of the building can are shown in Figure ... Figure 1: Picture of the University Research Institute building from the outside. The first region (Region A) encompasses the inner corridors of the first floor, shown in Figure 2. This area consists of a rectangular corridor measuring 210 m in length, along with a hall and an open corridor, covering approximately 400 m2. The second region (Region B), shown in Figure 2, corresponds to the cafeteria, which spans an area of 20 ×7 m2. The third region (Region C), shown in Figure 2, includes the auditorium and a small surrounding access corridor located below the ground floor. The auditorium’s sloped structure allows access from the ground floor at the top, while the bottom connects to the basement via the corridor. This region covers approximately 30 ×12 m2with a vertical elevation difference of 5 m. In order to build a fingerprnting-based positioning system 120 static references points for training and 70 for testing were selected. The coordinates for each point were obtained using the original SVG blueprints of the bulding, which can also be found between the supporting materials. The criteria used to select the grid of reference points for training was different in each region. In Region A, a 5-meter linear grid of reference points (RPs) was established. For Region B, a regular grid with 2.5 m spacing (a) (b) Figure 2: Region A 2
(a) (b) Figure 3: Region B (a) (b) Figure 4: Region C 3
was employed for positioning. Due to the auditorium’s unique layout, a regular grid was not feasible in Region C. Instead, reference points were placed along the steps where possible. In all three regions, test points were randomly selected by rolling a die onto the floor. The ground truth coordinates for both reference and test points were determined using telemeter measurements and validated against the building blueprint. In Figure 5, reference points are depicted in black, while test points are shown in red. A summary of the characteristics of the three regions is presented in Table 1. 0 20 40 60 80 100 West - East (m) 0 5 10 15 20 25 30 35 North - South (m) All Environment Region A - Corridors Region C - Auditory Hall Region B - Cafeteria Training Points Test Points Figure 5: Proposed experimental setup. Training point in black and testing points in red. Table 1: Characteristics of each Region inside the positioning environment with the number RP and magnetic samples (# Samp) taken for training (Tr.) and testing (Ts.) respectively. Region Area (m2) #Tr.RP #Ts.RP # Tr.Samp #Ts.Samp A 400 118 64 32370 22744 B 140 26 11 16229 2395 C 630 41 17 24071 3851 Total 1170 185 92 73272 30127 Data collection campaigns took place between October 19, 2024, and November 28, 2024. For each region, test and training subsets were gathered on different nonconsecutive days. The process involved three different smartphones: a Xiaomi Mi 10 Pro, a Huawei P30, and a Xiaomi Mi 8. All three devices were equipped with the AKM AK09918 magnetometer, featuring a sensitivity of 0.15 µT/LSB and an operational temperature range of -30 to 85 ºC. To ensure consistent measurement axes throughout the data collection process, smartphones were mounted on tripods. Each smartphone was assigned a dedicated tripod, maintaining a fixed height of 1 m for all measurements. Magnetic field samples were recorded in four orthogonal directions—approximately north, east, south, and west—at both training and testing points. Reference measurements were set to last 10 s, while test measurements had a duration of 4 s. An Android application was developed to collect, store, and manage sensor data. Although this study focuses on the characteristics of pure magnetic fingerprinting for positioning, most related research integrates this technology with other systems to enhance accuracy. Therefore, data collection included not only magnetometer readings but also gyroscope and accelerometer measurements, leveraging all available options from the Android Sensors API. During the measurement process, sensor data was continuously recorded in a text file, while start and stop timestamps for each measurement at a specific reference point (RP) and orientation were logged separately. The data from both files 4
was later merged in MATLAB, where the raw sensor readings were structured into a matrix format suitable for fingerprinting-based positioning. This format consists of input training and test matrices containing magnetic field components, along with output matrices representing the corresponding coordinates. 2.2 Data collection An Android application was developed to collect, store, and manage sensor information. Despite the fact that the purpose of this work is to study the characteristics of pure magnetic fingerprinting positioning, most of the related literature combines this technology with other systems to increase accuracy. Therefore, it was decided to collect data not only from the magnetometer but also from the gyroscope and accelerometer, using all the options available through the Android Sensors API. During the measurement process, all sensor information was continuously stored in a text file, while the start and stop timestamps associated with each measurement over a particular reference point (RP) and orientation were annotated in a separate file. The information from both files was combined using MATLAB, where the raw data was transformed into a matrix format suitable for fingerprinting-based positioning. This format consists of input training and test matrices containing the magnetic field components, and output matrices containing the associated coordinates. Finally, some heatmaps showing the strength of the magnetic field for some examples are shown. Figure 6shows the measurements with respect orientation north for the Xiaomi Mi 8 and Figure 7 shows for orientation respect east for the Mi 10. 5
All Environment 0 20 40 60 80 100 West - East (m) 0 5 10 15 20 25 30 35 North - South (m) -20 -10 0 10 20 30 40 50 60 70 80 Magnetic field ( T) (a) All Environment 0 20 40 60 80 100 West - East (m) 0 5 10 15 20 25 30 35 North - South (m) -20 0 20 40 60 80 100 120 140 160 180 Magnetic field ( T) (b) All Environment 0 20 40 60 80 100 West - East (m) 0 5 10 15 20 25 30 35 North - South (m) -100 -80 -60 -40 -20 0 20 40 60 80 100 Magnetic field ( T) (c) All Environment 0 20 40 60 80 100 West - East (m) 0 5 10 15 20 25 30 35 North - South (m) 50 100 150 200 Magnetic field ( T) (d) Figure 6: Magnetic field heatmaps over the three environments for the Xiaomi Mi 8. a) x-component, b) y-component, c) z-component and d) the module of the field. 6
All Environment 0 20 40 60 80 100 West - East (m) 0 5 10 15 20 25 30 35 North - South (m) -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 Magnetic field ( T) (a) All Environment 0 20 40 60 80 100 West - East (m) 0 5 10 15 20 25 30 35 North - South (m) -30 -20 -10 0 10 20 30 40 Magnetic field ( T) (b) All Environment 0 20 40 60 80 100 West - East (m) 0 5 10 15 20 25 30 35 North - South (m) -90 -80 -70 -60 -50 -40 -30 -20 -10 0 Magnetic field ( T) (c) All Environment 0 20 40 60 80 100 West - East (m) 0 5 10 15 20 25 30 35 North - South (m) 30 40 50 60 70 80 90 100 Magnetic field ( T) (d) Figure 7: Magnetic field heatmaps over the three environments for the Mi 10. a) x-component, b) y-component, c) z-component and d) the module of the field. 7
3 Database Description The complete database is divided by technology: Magnetic and BLE. Data from each technology is divided in four sets: each Region (A, B and C) separatly and one version with the three regions combined. Each independent database follows the same format, with small differences between Magnetic and Received Signal Strength (RSS) databases. This format is characterized by organizing information for each variable in columns with the same length. Each row, or position, over all column corresponds to the same measurement. Here only the documentation to work with the provided data is presented. •rss MsLst: List of all individually measured RSS values. A column vector with a large number of rows. Only in the case for BLE. •magnetic MsLst: 3 column matrix with all magnetic field measurements. Columns correspond to the x, y and z components. Onlu in the case of Magnetic databases. •referenceCoordinate MsLst: Coordinates in the local positioning system associated with the RSS measurement. •transmitterId MsLst: Identifier of the data transmitter. •transmitterSlotId MsLst: Identifier of the transmitter slot for the data. •receiverId MsLst: Identifier of the signal receiver. •timestamp MsLst: Reception timestamp measured in milliseconds. •orientation MsLst: Orientation of the receiver with respect to a reference direction in space. •measurementTypeId MsLst: Measurement type: 1-static training, 2-dynamic training, 3static validation, 4-dynamic validation, 5-static test, 6-dynamic test. In this case there are only measurements for types 1 and 5. •campaingId MsLst: Campaign ID. When data is collected without configuration changes, the same set of points may be repeated on different days. Each different day is considered a separate campaign. •sampleId MsLst: A single measurement can be divided into multiple consecutive groups. In such cases, this field is used to distinguish them. •targetId MsLst: A single measurement can be divided into multiple consecutive groups. In such cases, this field is used to distinguish them. •referencePointsId MsLst: Identifier of the measurement point, which must be uniquely related to the coordinates. •metadata: Structure containing additional information to identify the database: – dbName: Name of the database. – dbId: Integer number that identifies the database. – dbType: Type of data stored in the database. – receiversList: List of the integer IDs associated with each receiver used in the database. – receiversNames: LIst of the names of the receivers used in the database. – nReceivers: Number of individual receivers used. – transmitterIdS: – nReceivers: – nReceivers: 8
In active systems, the element to be positioned, also known as the target, is the receiver. That is, the object seeking to determine its location is the one performing the measurements and calculations (though these may be exported to another server). In contrast, passive systems do not require the target to take any measurements. To allow the same class of algorithms to be used for both systems, a slightly different nomenclature must be defined: targets are the elements to be located, while nodes are the passive elements of the system, regardless of whether the system is active or passive. Reference points are labeled according to their type. For instance, all training points should start with 1 if they are static, 2 if they are dynamic, and so on. 9
0 10 20 30 40 50 60 Error (m) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 CDF DB: All Algorithm: Wk-NN 0 10 20 30 40 50 60 70 80 90 Error (m) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 CDF DB: Region A Algorithm: Wk-NN 0 1 2 3 4 5 6 7 8 9 10 Error (m) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 CDF DB: Region B Algorithm: Wk-NN 0 2 4 6 8 10 12 14 16 18 Error (m) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 CDF DB: Region C Algorithm: Wk-NN Figure 9: CDF for the results of the Wk-NN over all regions. 16
5.3 Comparative Magnetic - BLE In order to directly compare results from the BLE and Magnetic fingerprinting systems, both are normalized with respect to NN for BLE. This means that results for each region, target, algorithm, and technoly (BLE or Magnetic) are divided by the corresponding results for same region and technology, but only the NN BLE. Table 6. Similarly, the CDF plots for the Wk-NN algorithm with results for magnetic and BLE for all regions are shown in Figure 10. Table 6: Magnetic and BLE fingerprinting results normalized by the results of the NN for BLE. Algorithm All Region A Region B Region C Magnetic BLE Magnetic BLE Magnetic BLE BMagneticLE BLE NN-Baseline 4.3 (3.6) 1.0 (1.0) 5.7 (4.1) 1.0 (1.0) 1.6 (2.2) 1.0 (1.0) 1.4 (1.4) 1.0 (1.0) Wk-NN 3.0 (2.1) 0.8 (0.9) 4.2 (2.7) 0.9 (1.0) 1.1 (1.5) 0.7 (0.6) 1.1 (1.0) 0.7 (0.6) Probabilistic 3.4 (2.4) 3.5 (2.6) 4.0 (2.5) 4.6 (2.7) 1.1 (1.3) 1.2 (1.2) 1.1 (1.0) 1.0 (0.6) SVM 3.5 (2.1) 3.5 (2.6) 4.1 (2.5) 4.6 (2.7) 1.4 (2.4) 1.2 (1.2) 1.1 (1.0) 1.0 (0.6) RF 3.6 (2.0) 3.1 (1.8) 4.7 (2.4) 3.6 (1.8) 1.7 (1.4) 1.4 (1.0) 1.5 (0.9) 1.2 (0.6) NNet 3.2 (2.2) 3.5 (2.6) 4.4 (2.7) 4.6 (2.7) 1.4 (2.6) 1.2 (1.2) 1.1 (1.1) 1.0 (0.6) GPR 12.2 (1.7) 13.1 (1.0) 12.3 (1.3) 13.1 (1.2) 23.1 (2.5) 22.8 (0.5) 15.1 (1.2) 14.8 (0.7) 0 10 20 30 40 50 60 70 80 90 Error (m) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 CDF All 0 10 20 30 40 50 60 70 80 90 Error (m) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 CDF Region A 0 2 4 6 8 10 12 14 Error (m) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 CDF Region B 0 5 10 15 20 25 30 Error (m) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 CDF Region C Figure 10: CDF for the results of the Wk-NN over all regions for both magnetic and BLE fingerprinting systems. 17
6 Notes and Discussion 6.1 Discussion We find it necessary to address some of the limitations of this work related to the provided package. This research is contextualized within the team’s experience in fingerprinting-based positioning using BLE RSS measurements from smartphones [1], [4]. Taking into account that, to the best of the authors’ knowledge, and within the context of indoor positioning, magnetic fingerprinting-based positioning has not been studied following the same criteria as Wi-Fi and BLE measurements, this work aims to fill that gap. 6.2 Notes •Current Version: 1. •If needed, this document and the associated materials will be updated in the future. Changes from previous versions will be indicated below. •Previous versions: – •Contact: If you have any doubts regarding the data, software, or experiments, please do not hesitate to contact me via email at [email protected]. 18
References [1] F. J. Aranda, F. Parralejo, et al., “Performance analysis of fingerprinting indoor positioning methods with ble,” Expert Systems with Applications, vol. 202, p. 117 095, 2022. [2] J. Torres-Sospedra, C. Pend˜ao, et al., “Let’s talk about k-nn for indoor positioning: Myths and facts in rf-based fingerprinting,” in 2023 13th International Conference on Indoor Positioning and Indoor Navigation (IPIN), 2023, pp. 1–6. [3] S.-H. Cha, “Comprehensive survey on distance/similarity measures between probability density functions,” in International Journal of Mathematical Models and Methods in Applied Sciences, Jan. 2007, pp. 300–307. [4] F. J. Aranda, F. Parralejo, et al., “Multi-slot BLE raw database for accurate positioning in mixed indoor/outdoor environments,” Data, vol. 5, no. 3, p. 67, Jul. 2020. 19