Low-Memory Indoor Positioning System for Standalone Embedded Hardware

As the proportion and importance of the indoor spaces in daily life are gradually increasing, spatial information and personal location information become more important in indoor spaces. In order to apply indoor positioning technologies in any places and for any targets inexpensively and easily, the system should utilize simple sensors and devices. In addition, due to the scalability, it is necessary to perform indoor positioning algorithms on the device itself, not on the server. In this paper, we construct standalone embedded hardware for performing the indoor positioning algorithm. We use the geomagnetic field for indoor localization, which does not require the installation of infrastructure and has more stable signal strength than RF RSS. In addition, we propose low-memory schemes based on the characteristics of the geomagnetic sensor measurement and convergence of the target’s estimated positions in order to implement indoor positioning algorithm to the hardware. We evaluate the performance in two testbeds: Hana Square (about 94 m × 26 m) and SK Future Hall (about 60 m × 38 m) indoor testbeds. We can reduce flash memory usage to 16.3% and 6.58% for each testbed and SRAM usage to 8.78% and 23.53% for each testbed with comparable localization accuracy to the system based on smart devices without low-memory schemes.


Introduction
With the rapid development and increasing utilization of ICT (Information and Communications Technology), the various services and systems based on the smart devices are rapidly expanding. Moreover, as the indoor spaces are gradually enlarged with the development of architectural technology, the activities and services for the outdoor spaces can be accomplished in the indoor spaces. As a result, the proportion and importance of the indoor spaces in daily life are gradually increasing. Spatial information and personal location information that have been provided in the outdoor spaces becomes more important in the indoor spaces along with the increase in the proportion of the indoor spaces in daily life. For more diverse services in the indoor spaces, existing LBS-related systems and services require indoor spatial information and personal location information. Since most of these LBS applications like asset tracking and indoor navigation often require more fine-grained positioning accuracy and ease of deployment, accurate and economical solutions for indoor positioning system are key enabling technologies for Location Based Services (LBS).
In the past few decades, a diverse range of indoor localization schemes have been proposed. These schemes can be classified by the type of sensor signals used, which includes RF (Radio Frequency), acoustic, IR (Infrared), light, etc. Among these, the indoor positioning system (IPS) based on RF signals such as Bluetooth Low Energy (BLE) or Wi-Fi is the most common since such RF technology is widely adopted by smart devices and signals are often available in indoor environment. The RF based IPSs may measure the received signal strength (RSS) [1][2][3], time of arrival (ToA) [4], or time difference of arrival synchronization overhead compared to the fast speed of RF signal propagation. Therefore, most of the RF based IPSs rely on sensing RSS. However, it is not easy to build high accuracy IPS even with RF's RSS due to the time varying and unstable nature of RF signal, which is caused by multipath propagation, diffraction, and scattering of RF signals incurred by the indoor structures such as walls, furniture, humans, and elevators.
An alternative signal that can be used for IPS is the geomagnetic field signal generated by the earth movement. The geomagnetic field signal has several distinct advantages over other signals. First, IPS based on the geomagnetic field does not require infrastructure such as access points or beacons since the geomagnetic field is created by nature unlike RF signals. Second, the geomagnetic field signal is easy and cheap to sense by using IMU (Inertial Measurement Unit) sensors, also known as motion sensors, which include the magnetic field sensor in addition to the accelerometers and gyroscope sensors which are usually included in IoT devices. Third, as shown in Figure 1, the signal strength of the geomagnetic field is much more stable over time than those of RF or ultrasonic signals, which would potentially enable higher accuracy IPS [7]. These characteristics enable inexpensive IPS implementation based on the geomagnetic field regardless of factors such as the indoor structures in testbeds and the previously installed infrastructure. Position change due to the target's movement occurs continuously. However, the absolute positioning schemes such as the fingerprinting method do not use the currently estimated position to determine the next position, which leads to irregular and discontinuous route prediction. In contrast, a relative positioning scheme such as Pedestrian Dead Reckoning (PDR) estimates the target's movement based on the previous position. Therefore, it can produce a smoother contiguous route for the pedestrian movement. In general, it leads to smaller localization error for a short distance, but it often results in huge localization errors for a long distance due to the accumulation of the errors. In addition, PDR cannot absolutely determine the current position without the initial position. Therefore, in this paper, in order to complement each algorithm, we use not only fingerprinting with K-NN (K-Nearest Neighbor) algorithm but also the PDR algorithm that estimates the relative position change of pedestrians as the indoor positioning algorithm [8].
In order to make indoor LBS easily applicable and inexpensive, simple sensors and lightweight and inexpensive embedded hardware have to be offered. The embedded hardware for IPS can be composed of a computing unit for performing indoor positioning algorithms, a sensor unit for sensing the current state of the target, and a communication Position change due to the target's movement occurs continuously. However, the absolute positioning schemes such as the fingerprinting method do not use the currently estimated position to determine the next position, which leads to irregular and discontinuous route prediction. In contrast, a relative positioning scheme such as Pedestrian Dead Reckoning (PDR) estimates the target's movement based on the previous position. Therefore, it can produce a smoother contiguous route for the pedestrian movement. In general, it leads to smaller localization error for a short distance, but it often results in huge localization errors for a long distance due to the accumulation of the errors. In addition, PDR cannot absolutely determine the current position without the initial position. Therefore, in this paper, in order to complement each algorithm, we use not only fingerprinting with K-NN (K-Nearest Neighbor) algorithm but also the PDR algorithm that estimates the relative position change of pedestrians as the indoor positioning algorithm [8].
In order to make indoor LBS easily applicable and inexpensive, simple sensors and lightweight and inexpensive embedded hardware have to be offered. The embedded hardware for IPS can be composed of a computing unit for performing indoor positioning algorithms, a sensor unit for sensing the current state of the target, and a communication unit for sending and receiving data with a server. MCUs (Micro Controller Unit) for the embedded system, such as ATMEGA-128 [9] and STM32F103 [10], have very small size of SRAM and flash memory compared to the hardware of smart devices/PC. In order to implement the indoor positioning algorithm on the embedded hardware, the magnetic field map of the testbed should be stored in the embedded hardware to compare with current state which is sensed by the sensor unit. However, due to the small size of the flash memory, only small size of magnetic field map can be stored, so it is necessary to compress and store the magnetic field map in order to implement indoor localization algorithm to the embedded system for large indoor spaces. In addition, since the size of the SRAM is small, when the entire magnetic field map is loaded from the flash memory to the SRAM in order to implement the indoor localization algorithm, the delay to load the magnetic field map may increase, and real-time tracking services may not be provided properly. Therefore, it is also necessary to decrease the delay caused by the small size of SRAM. In [11], we have proposed methods to lower flash memory usage of the embedded hardware for IPS. For Real-Time Locating System (RTLS), we propose methods to reduce the usage of not only flash memory but also SRAM while achieving comparable performance to IPS based on the smart devices for two testbeds.
In a magnetic field map, 3-axis magnetic field data of a corresponding location are stored in a float format for each coordinate. When the magnetic field sensor measures magnetic field data, it gives integer format as an output and converts it into real measured magnetic field data through sensitivity-based scaling. Therefore, it is possible to increase the size of the magnetic field map stored in the embedded hardware by inverting the magnetic field map through the sensitivity of the magnetic field sensor and replacing the magnetic field map with the integer format. In addition, since the range of the magnetic field map is smaller than the range that the magnetic field sensor can measure, the magnetic field map can be compressed into the number of bits, which represents the smaller range, instead of all range. Moreover, there are some areas of the testbed where pedestrians cannot access, while the data are stored in the same format on these areas of the magnetic field map with other areas. However, due to inaccessibility, we do not use data of these areas for IPS. Instead of storing data in the same format for these areas, it is possible to decrease the size of the magnetic field map by expressing inaccessibility.
Since all the magnetic field maps must be searched at the initial stage of IPS, increase of the delay due to the SRAM size constraints is inevitable. However, when the estimated location of the target converges after the pedestrian walks a few steps, only magnetic field map data around the converged location is required. So, after the estimated location of the target converges, only the magnetic field map data around the converged location could be loaded from the flash memory to the SRAM in order to decrease the delay.
In this paper, we construct the lightweight embedded hardware and evaluate memory usage and performance of low-memory indoor positioning algorithms for the embedded hardware. The following are the main contributions of this paper:

1.
Development of the embedded hardware for indoor localization: We develop the lightweight embedded hardware which consists only of essential modules for indoor localization, which leads to IPS being inexpensive and easily applied.

2.
Development of the indoor positioning technology based on geomagnetic field: We propose a localization algorithm that can combine the advantage of both PDR and fingerprinting method based on geomagnetic field whose signal strength is much more stable over time than that of RF without infrastructure.

3.
Low-memory algorithms for the embedded hardware: We propose low memory schemes for the embedded hardware with limited resources, such as flash memory and SRAM, in order to implement the indoor positioning algorithm to the embedded hardware by using the convergence of estimated positions and characteristics of the sensor modules and testbeds.
To evaluate our low-memory embedded hardware schemes for IPS, we use two testbeds: Hana Square and SK Future Hall at Korea University. The dimensions of each testbed are 94.4 m by 26 m and 60.1 m by 37.9 m. For comparative evaluation, we have also implemented IPS based on smart devices which use Wi-Fi fingerprinting techniques and proposed indoor positioning technology based on geomagnetic field without lowmemory schemes. The rest of this paper is organized as follows. Section 2 surveys recent studies related to indoor localization algorithms and simple hardware designs for the algorithms. Section 3 presents our proposed low-memory embedded hardware schemes for IPS. Section 4 explains the experimentation methodology and analyzes the experiment results, comparing the performance of IPS using the smart device. Section 5 concludes the paper.

Related Works
A number of solutions [12][13][14][15][16][17] have been proposed in the literature that rely on a number of technologies including WiFi, BLE, etc. and technologies such as RSSI, Angle of Arrival (AoA), Time of Flight (ToF), etc. for indoor localization and tracking using smart devices to sense signals.
In [12], Kotaru et al. target for the devices with a Wi-Fi chip such as smart phones based on already deployed Wi-Fi infrastructure. They propose SpotFi that uses a two-dimensional multiple signal classification algorithm to estimate the angle of arrival and time of flight of the most significant multipath propagation components from Wi-Fi CSI data.
Indoor localization algorithms are typically evaluated within varying evaluation environments including varying node densities and building architectures. Since such unintended variations have been shown to significantly influence localization-accuracies. In [13], in order to identify their proposed optLoc localization algorithms, they have identified the most accurate path-loss functions and localization algorithms and their optimal settings for twelve additional factors of typical model-based RSS indoor localization algorithms by considering successful localizations, correct floor-detections, and low errordistances, as accuracy criteria. They showed that optLoc achieved lower localization error rates and error distances.
The time varying and unstable nature of RF signal is caused by multipath propagation, diffraction, and scattering of RF signals incurred by the indoor structures. In [14], they use Sub GHz transceivers for both accuracy and power consumption. They show that Sub GHz transceivers are better suited than Wi-Fi transceivers in both considered terms and are especially more robust regarding the influence of obstacles and peoples.
Several previous studies [15][16][17] have adopted iBeacons as APs, which are implementations of Bluetooth Low Energy (BLE) wireless technology, because they are cheaper, easier to deploy, and have lower power consumption whereas Wi-Fi cannot be deployed in all locations. Similar to Wi-Fi-based systems, these studies use technologies such as Angle of Arrival, Time of Arrival, Time Difference of Arrival, and Signal Strength. In [17], they use the combination of channel-separate polynomial regression model (PRM), channelseparate fingerprinting (FP), outlier detection, and extended Kalman filtering (EKF) for smartphone-based indoor localization with BLE beacons using BLE RSS.
However, the indoor positioning technologies may require additional installation of such APs or beacons, and the performance varies depending on the location and the number of APs. In addition, these studies assume that the target owns a smart device which is not efficient in terms of weight and cost. In addition, there are some environments, such as factory, where Wi-Fi cannot be deployed and targets cannot be allowed to carry the smart devices.
There are only a few approaches [18][19][20][21] in which they develop lightweight hardware designs or utilize simple interfaces, rather than using the smart devices, for indoor localization.
In [18], they introduce Foglight, a visible light enabled indoor localization system for IoT devices that relies on unique spatial encoding produced when mechanical mirrors inside a projector are flipped based on gray-coded binary images. Foglight employs a simple hardware at the client's side with a few components: light sensors and entry-level microcontrollers. However, they also need to install digital light processing projectors in the environment.
In [19], they propose the light-weight wearable sensing device integrating a low-cost Ultra-Wide Band module and microelectromechanical system IMU to provide a costeffective hardware solution with data fusion algorithms for wearable indoor localization. The inertial measurement for indoor localization suffers from cumulative errors in the integral operations, which cannot satisfy long-time localization applications while UWB po-sitioning technology is vulnerable to barrier blocking between moving nodes and anchors, which has limited its accuracy for NLoS occasions. They use the Kalman filter algorithm to integrate the two methods by using an iterative compensation of the two location results, in order to achieve higher precision indoor positioning.
In [20], they use the RFID system based on IR-enabled RFID tags, which initiate communication with the RFID reader, sending data every few seconds. The system is based on reference RFID tags, which act as fingerprints while a single RFID reader is proposed to reduce costs, and stability and robustness are provided to RFID-based localization solution through fusion with IR data.
In [21], for museum visitors, they develop simple BLE devices with periodically transmitting packets, which are received by geo-localized BLE receivers. Collected packets are provided to the locator server to estimate the positions of the visitors. The position estimation is based on a feed-forward neural network and a nonlinear least square algorithm.
However, in some studies they need additional installation of infrastructure which could lead to enormous cost depending on the environments and significant difference in performance with same technologies in different places. In addition, because they are focused on the lightweight hardware, the hardware only senses the current state of the user but does not calculate the indoor positioning algorithm. Instead, the hardware transmits the sensing data to the server and the server calculates the indoor positioning algorithm, so that the hardware itself cannot perform indoor positioning algorithms, which cannot assure the scalability.

Hardware Configuration
In order to construct a standalone IoT device for the indoor positioning system, the embedded hardware should consist of a MCU for performing the indoor positioning algorithms, an IMU sensor for sensing target's movement and geomagnetic field data, and a communication module for sending the calculated data to a server/gateway. Figure 2 shows the components of the hardware for the indoor positioning system and the data exchange between each component of the hardware. positioning technology is vulnerable to barrier blocking between moving no anchors, which has limited its accuracy for NLoS occasions. They use the Kalm algorithm to integrate the two methods by using an iterative compensation of location results, in order to achieve higher precision indoor positioning.
In [20], they use the RFID system based on IR-enabled RFID tags, which communication with the RFID reader, sending data every few seconds. The s based on reference RFID tags, which act as fingerprints while a single RFID proposed to reduce costs, and stability and robustness are provided to RFI localization solution through fusion with IR data.
In [21], for museum visitors, they develop simple BLE devices with per transmitting packets, which are received by geo-localized BLE receivers. C packets are provided to the locator server to estimate the positions of the visi position estimation is based on a feed-forward neural network and a nonlin square algorithm.
However, in some studies they need additional installation of infrastructu could lead to enormous cost depending on the environments and significant diff performance with same technologies in different places. In addition, because focused on the lightweight hardware, the hardware only senses the current sta user but does not calculate the indoor positioning algorithm. Instead, the h transmits the sensing data to the server and the server calculates the indoor po algorithm, so that the hardware itself cannot perform indoor positioning alg which cannot assure the scalability.

Hardware Configuration
In order to construct a standalone IoT device for the indoor positioning sys embedded hardware should consist of a MCU for performing the indoor po algorithms, an IMU sensor for sensing target's movement and geomagnetic field d a communication module for sending the calculated data to a server/gateway. shows the components of the hardware for the indoor positioning system and exchange between each component of the hardware.

Measuring the Geomagnetic Field Vectors
The IMU sensor integrates three different sensors: accelerometer, gyrosc magnetic sensor, each of which measures its sensor value in the three-dimensio and Z axes. Using the magnetic field sensor, we can measure the three-dim components of the geomagnetic field vector. Because the geomagnetic fiel

Measuring the Geomagnetic Field Vectors
The IMU sensor integrates three different sensors: accelerometer, gyroscope, and magnetic sensor, each of which measures its sensor value in the three-dimensional X, Y, and Z axes. Using the magnetic field sensor, we can measure the three-dimensional components of the geomagnetic field vector. Because the geomagnetic field vector depends on the orientation of the device, if we turn the device, the axis is changed, which makes the geomagnetic field values change. It can be fixed by using the orientation value. The orientation value shows us how much the device has been rotated by the absolute threedimensional cardinal dimension, namely north, east, south, west, up, and down. This orientation value can be estimated by the IMU sensor.

Construction of the Geomagnetic Field Maps
Similar to radio map construction in RF-based fingerprinting, we need to construct the geomagnetic field maps for our testbeds. However, geomagnetic field maps are easier to construct than radio maps. This can be attributed to the following reasons. First, we only need to collect one geomagnetic field signal instead of multiple beacon or AP signals. Second, the geomagnetic field signal is more stable over time compared to unstable timevarying RF signals. Thus, signal sampling and calibration is generally faster. Using the IMU sensor, we collect the geomagnetic field vector signals at the reference points and also records the physical coordinates of the reference points.

Indoor Localization Techniques
The device measures the signal strength of the geomagnetic field when the target moves. The device produces the fingerprint of a current location from the signal strength and compares it with those of reference points in the magnetic field map. In case of the geomagnetic field vector fingerprint, Euclidean distances between the geomagnetic field vectors are calculated to find a reference point of a closest geomagnetic field vector, socalled nearest neighbor (NN). The K-NN algorithm produces K nearest neighbors and estimates the final location as a weighted sum of their locations.
The Pedestrian Dead Reckoning (PDR) is the process of calculating the current position from the initial given position by estimating the movement of a pedestrian. More specifically, PDR estimates the step count, the step length, and the orientation of the movement by using the IMU sensor. It usually determines the step by analyzing the pattern of the accelerometer sensor data and estimates the direction of the target's movement by analyzing the IMU sensor data, i.e., gyroscope, magnetometer, and accelerometer sensor signals of the device. In addition, step length can be determined by the minimum and maximum acceleration measured in the Z axis in a single stride [22]. PDR is a relative positioning scheme since it calculates the next position relative to the current position by estimating the relative target's movement. Figure 3 shows the flow chart of the proposed localization algorithm. The initial position is estimated by using the absolute positioning scheme such as fingerprinting. Then, the next position of the user is estimated by using PDR every step while the absolute position is updated by the absolute positioning scheme, i.e., fingerprinting every k steps. The estimated absolute position data (P_abs) is not directly applied for every step to prevent the position data from sudden fluctuation caused by the localization inaccuracy. Instead, the difference (error) between the current position data (P_current) and the position data (P_abs) estimated through the absolute positioning scheme is applied to every k steps. Furthermore, when the difference is larger than threshold (thrsh), the system does not apply the difference, which could lower reliability in continuous route prediction. On the other hand, when the difference is smaller than threshold (thrsh), which means the estimated location of the target converges, the system decreases the threshold (thrsh) and increase the k, which is the update interval of the absolute position estimation (P_abs). However, if the threshold (thrsh) is too small, the current position data could be hard to update through the estimated absolute position data (P_abs), which leads to large localization error for a long distance due to the accumulation of the PDR localization errors. So, we set the minimum magnitude of the threshold (min_thrsh).

Magnetic Map Compression Methods for Constrained Memory
In general, in a magnetic field map, 3-axis magnetic field data of a corresponding location are stored in a float format for each coordinate. As shown in Table 1, the magnetic field sensor measures magnetic field data in 16-bit integer format and converts the 16-bit integer data to the data in a 32-bit float format which represents the real measured magnetic field data by using sensitivity-based scaling. Therefore, we could replace the magnetic field map with integer format by inverting the magnetic field map through the sensitivity of the magnetic field sensor, which could lead to increase the size of the magnetic field map stored in the embedded hardware, as shown in sensitivity based compression formula below. In the formula, mag map represents the real measured magnetic field map in 32-bit float format, mag compression 1 map represents converted magnetic field map in 16-bit integer data, and scale represents sensitivity of the magnetic sensor which is 4912/32752 in Table 1. Since the magnetic field data range of the magnetic field map is limited, the magnetic field map can be compressed into the number of bits that can represent the limited range, instead of all range, as shown in formulas of the range based compression and the number of bits that represent the limited range below. In the formulas, mag compression 2 map is the data in which the minimum value is zero by shifting mag compression 1 map . n bits map represents the number of bits required to store compressed data of the magnetic field map. In addition, it is necessary to decompress the compressed data for performing the indoor positioning algorithm. The decompression process is performed by reversing the compression process as shown in the decompression process formula below.

Magnetic Map Compression Methods for Constrained Memory
In general, in a magnetic field map, 3-axis magnetic field data of a corresponding location are stored in a float format for each coordinate. As shown in Table 1, the magnetic field sensor measures magnetic field data in 16-bit integer format and converts the 16-bit integer data to the data in a 32-bit float format which represents the real measured magnetic field data by using sensitivity-based scaling. Therefore, we could replace the magnetic field map with integer format by inverting the magnetic field map through the sensitivity of the magnetic field sensor, which could lead to increase the size of the magnetic field map stored in the embedded hardware, as shown in sensitivity based compression formula below. In the formula, represents the real measured magnetic field map in 32-bit float format, represents converted magnetic field map in 16-bit integer data, and scale represents sensitivity of the magnetic sensor which is 4912/32752 in Table 1. Since the magnetic field data range of the magnetic field map is limited, the magnetic field map can be compressed into the number of bits that can represent the limited range, instead of all range, as shown in formulas of the range based compression and the number of bits that represent the limited range below. In the formulas, is the data in which the minimum value is zero by shifting .
represents the number of bits required to store compressed data of the magnetic field map. In addition, it is necessary to decompress the compressed data

× scale
There are some areas of the testbed where targets cannot access, and '0' are stored in the same format on these areas of the magnetic field map with other areas where the target can access. These areas can be expressed as 1-bit '0' and can be compressed by expressing the magnetic field map in the form of a bitmap and data array as shown in Figure 4. The bitmap shows target accessibility as 1 bit per coordinate. Areas where the target cannot access occupy a large portion of the testbed, so this method can compress a large portion of the magnetic field map. There are some areas of the testbed where targets cannot access, and '0' are stored in the same format on these areas of the magnetic field map with other areas where the target can access. These areas can be expressed as 1-bit '0' and can be compressed by expressing the magnetic field map in the form of a bitmap and data array as shown in Figure 4. The bitmap shows target accessibility as 1 bit per coordinate. Areas where the target cannot access occupy a large portion of the testbed, so this method can compress a large portion of the magnetic field map.

Map Load Strategy for Reducing Load Delay
Since the size of the SRAM is small, it is also necessary to decrease the delay caused by the SRAM size constraints. Since all the magnetic field maps must be searched at the initial stage of indoor positioning algorithm, increase of the delay due to the SRAM size constraints is inevitable. However, when the estimated locations of the target converge after the pedestrian walks a few steps, only magnetic field map data around the converged location is required. So, after the pedestrian walks a few steps, only the magnetic field map data around the converged location are loaded from the flash memory to the SRAM in order to decrease the delay. Figure 5 shows the proposed algorithm for determining the size of the magnetic field map to load to SRAM. Because the size of magnetic field map is usually larger than the

Map Load Strategy for Reducing Load Delay
Since the size of the SRAM is small, it is also necessary to decrease the delay caused by the SRAM size constraints. Since all the magnetic field maps must be searched at the initial stage of indoor positioning algorithm, increase of the delay due to the SRAM size constraints is inevitable. However, when the estimated locations of the target converge after the pedestrian walks a few steps, only magnetic field map data around the converged location is required. So, after the pedestrian walks a few steps, only the magnetic field map data around the converged location are loaded from the flash memory to the SRAM in order to decrease the delay. Figure 5 shows the proposed algorithm for determining the size of the magnetic field map to load to SRAM. Because the size of magnetic field map is usually larger than the size of the SRAM, the magnetic field map is first divided into the maximum size that can be loaded to SRAM (max_sram), and pieces of the map are loaded from flash memory to the SRAM to perform indoor positioning algorithm. In order to perform the indoor positioning algorithm at the initial stage of indoor positioning system, the indoor positioning algorithm should perform for all pieces of the map, so all the pieces of the map have to be loaded to the SRAM, which could lead to several load operations. When the estimated positions of the target (knn_neighbors) are within a certain range (range), the system can determine that the position of the target converges. When the target's estimated position converges, the target's next estimated positions are nearby the converged position, so the KNN algorithm may be performed only around the estimated position. Therefore, the magnetic field map loaded into the SRAM (load_size) for performing indoor localization algorithm could only be a part of the magnetic field map around the estimated location. So, when the target's estimated position converges, part of the magnetic field map load to the SRAM. However, if the magnetic field map loaded into the SRAM (load_size) for performing indoor localization algorithm is too small, indoor localization algorithm does not perform properly due to the operation in the limited area. So, we set the minimum size of the magnetic field map loaded into the SRAM (min_load_size) for performing indoor localization algorithm. In addition, if loaded map piece size (map_piece_size) is too small, the estimated position according to the target's movement could be often beyond the boundary of the loaded map, which lead to additional load operations. When there is an estimated position at the boundary between the map pieces, it is necessary to load pieces which border the boundary, so that a maximum of 4 pieces should be loaded into the SRAM at the same time. So, we set the minimum size of the map pieces to 1/4 of the maximum map size that can be loaded to SRAM (max_sram), which leads to minimize the number of the load operations. size of the SRAM, the magnetic field map is first divided into the maximum size that can be loaded to SRAM (max_sram), and pieces of the map are loaded from flash memory to the SRAM to perform indoor positioning algorithm. In order to perform the indoor positioning algorithm at the initial stage of indoor positioning system, the indoor positioning algorithm should perform for all pieces of the map, so all the pieces of the map have to be loaded to the SRAM, which could lead to several load operations. When the estimated positions of the target (knn_neighbors) are within a certain range (range), the system can determine that the position of the target converges. When the target's estimated position converges, the target's next estimated positions are nearby the converged position, so the KNN algorithm may be performed only around the estimated position. Therefore, the magnetic field map loaded into the SRAM (load_size) for performing indoor localization algorithm could only be a part of the magnetic field map around the estimated location. So, when the target's estimated position converges, part of the magnetic field map load to the SRAM. However, if the magnetic field map loaded into the SRAM (load_size) for performing indoor localization algorithm is too small, indoor localization algorithm does not perform properly due to the operation in the limited area. So, we set the minimum size of the magnetic field map loaded into the SRAM (min_load_size) for performing indoor localization algorithm. In addition, if loaded map piece size (map_piece_size) is too small, the estimated position according to the target's movement could be often beyond the boundary of the loaded map, which lead to additional load operations. When there is an estimated position at the boundary between the map pieces, it is necessary to load pieces which border the boundary, so that a maximum of 4 pieces should be loaded into the SRAM at the same time. So, we set the minimum size of the map pieces to 1/4 of the maximum map size that can be loaded to SRAM (max_sram), which leads to minimize the number of the load operations.

Environment Configurations
We construct a lightweight embedded hardware for indoor positioning system using development boards. The embedded system consists of MCU, IMU, and BLE module, as mentioned in Section 3.1. We use STM32L476 for MCU module, MPU-9250 for IMU module, and HM-11 for BLE module. Table 2 shows the detailed specification of each module.

Environment Configurations
We construct a lightweight embedded hardware for indoor positioning system using development boards. The embedded system consists of MCU, IMU, and BLE module, as mentioned in Section 3.1. We use STM32L476 for MCU module, MPU-9250 for IMU module, and HM-11 for BLE module. Table 2 shows the detailed specification of each module. Accelerometer Gyroscope Magnetometer

BLE
HM-11 [25] BLE v4.0 Figure 6 shows the embedded hardware system based on the development boards of the modules shown in the table, which are connected through jumper cables. IMU exchanges data and commands with MCU using I2C protocol while BLE exchanges data and commands with MCU using UART protocol.

IMU
MPU-9250 [24] Accelerometer Gyroscope Magnetometer BLE HM-11 [25] BLE v4.0 Figure 6 shows the embedded hardware system based on the development boards of the modules shown in the table, which are connected through jumper cables. IMU exchanges data and commands with MCU using I2C protocol while BLE exchanges data and commands with MCU using UART protocol.
.  Figure 7 shows the geomagnetic field maps of the testbeds collected with a Samsung Galaxy S10 smartphone. Both testbeds include some empty spaces, which are outdoor spaces, restricted areas, or hall spaces connected to other floors where people actually cannot go. The empty spaces of Hana Square testbed and SK Future Hall testbed are 57.12% and 87.26% of the total area, respectively.    Figure 7 shows the geomagnetic field maps of the testbeds collected with a Samsung Galaxy S10 smartphone. Both testbeds include some empty spaces, which are outdoor spaces, restricted areas, or hall spaces connected to other floors where people actually cannot go. The empty spaces of Hana Square testbed and SK Future Hall testbed are 57.12% and 87.26% of the total area, respectively.

IMU
MPU-9250 [24] Accelerometer Gyroscope Magnetometer BLE HM-11 [25] BLE v4.0 Figure 6 shows the embedded hardware system based on the development boards of the modules shown in the table, which are connected through jumper cables. IMU exchanges data and commands with MCU using I2C protocol while BLE exchanges data and commands with MCU using UART protocol.
.  Figure 7 shows the geomagnetic field maps of the testbeds collected with a Samsung Galaxy S10 smartphone. Both testbeds include some empty spaces, which are outdoor spaces, restricted areas, or hall spaces connected to other floors where people actually cannot go. The empty spaces of Hana Square testbed and SK Future Hall testbed are 57.12% and 87.26% of the total area, respectively.

Comparison of Magnetic Field Map Collected by Different Sensor Models
Since the geomagnetic field map shown in Figure 7 is a map collected by the smartphone whose magnetic field sensor module is different from that of the embedded hardware, the bias between the magnetic field map which is collected by the smartphone and magnetic field data measured by the embedded hardware may occur. Therefore, in order to remove the bias, we recollect a portion of the geomagnetic field map with the embedded hardware and compare it with the geomagnetic field map collected by the smartphone. Figure 8 shows the comparison of the magnetic field map based on the embedded hard-ware (left side of the figure inside the box) before and after removing the bias and the magnetic field map collected by the smartphone (right side of the figure inside the box). The magnetic field maps collected based on the embedded hardware after removing the bias show similar patterns to the magnetic field maps collected by the smartphone.
Since the geomagnetic field map shown in Figure 7 is a map collected by the smartphone whose magnetic field sensor module is different from that of the embedded hardware, the bias between the magnetic field map which is collected by the smartphone and magnetic field data measured by the embedded hardware may occur. Therefore, in order to remove the bias, we recollect a portion of the geomagnetic field map with the embedded hardware and compare it with the geomagnetic field map collected by the smartphone. Figure 8 shows the comparison of the magnetic field map based on the embedded hardware (left side of the figure inside the box) before and after removing the bias and the magnetic field map collected by the smartphone (right side of the figure inside the box). The magnetic field maps collected based on the embedded hardware after removing the bias show similar patterns to the magnetic field maps collected by the smartphone.  Table 3 shows the statistical characteristics for each axis of the magnetic field maps for each testbed. For Hana Square testbed, applying the compression method based on the sensitivity and range of the magnetometer described in Section 3.5. to the z-axis of the magnetic field map, the range of the z-axis of the magnetic field map is 150.4556, which can be expressed as about 1004 discrete data with the sensitivity of the magnetic field sensor, and these discrete data can be expressed by 10-bit integer format. Applying to the x, y, and z axes, the magnetic field map data expressed as float (32-bit) can be compressed to about 31%. In addition, about 57% of the testbed is inaccessible to targets. When the bitmap-based compression method, mentioned in Section 3.5., is additionally used, the magnetic field map can be compressed to 16.3% of the original size. Likewise, for SK Future Hall testbed, the magnetic field map can be compressed to 6.58% of the original size with magnetometer sensitivity-based compression method, range-based compression method, and bitmap-based compression method.   Table 3 shows the statistical characteristics for each axis of the magnetic field maps for each testbed. For Hana Square testbed, applying the compression method based on the sensitivity and range of the magnetometer described in Section 3.5. to the z-axis of the magnetic field map, the range of the z-axis of the magnetic field map is 150.4556, which can be expressed as about 1004 discrete data with the sensitivity of the magnetic field sensor, and these discrete data can be expressed by 10-bit integer format. Applying to the x, y, and z axes, the magnetic field map data expressed as float (32-bit) can be compressed to about 31%. In addition, about 57% of the testbed is inaccessible to targets. When the bitmap-based compression method, mentioned in Section 3.5., is additionally used, the magnetic field map can be compressed to 16.3% of the original size. Likewise, for SK Future Hall testbed, the magnetic field map can be compressed to 6.58% of the original size with magnetometer sensitivity-based compression method, range-based compression method, and bitmap-based compression method.  Figure 9 shows the ratio of the magnetic field map size required for performing indoor localization algorithm (load_size) and the size of map pieces to load to the SRAM per load operation (map_piece_size) compared to the sizes in initial step in Hana Square and SK Future Hall. As shown in the figure, as the target moves, the size of the magnetic field map required for performing the indoor positioning algorithm (load_size) decreases, and the ratios of the magnetic field map loaded to the SRAM compared to the original map converge to 8.78% and 23.53% for Hana Square and SK Future Hall testbeds, respectively. The converged ratio of the required magnetic field map size (load_size) loaded to SRAM for performing indoor localization algorithm in SK Future Hall is larger than that in Hana Square because the size of the magnetic field map in Hana Square is larger than SK Future Hall. In addition, in SK Future Hall, the size of the magnetic field map loaded to SRAM reaches the minimum magnetic field map size for performing indoor localization algorithm (min_load_size), as mentioned in Section 3.6. Therefore, the magnetic field size to load into the SRAM does not converge to smaller value in SK Future Hall. In addition, when the size of the magnetic field map required for performing the indoor positioning algorithm (load_size) are smaller than the maximum map size that can be loaded to SRAM (max_sram), the size of the map pieces becomes 1/4 of the maximum map size that can be loaded to SRAM (max_sram), which is minimum size of the map pieces, as mentioned in Section 3.6. The size of the map pieces reaches the minimum size faster in SK Future Hall than in Hana Square because the size of the magnetic field map in SK Future Hall is smaller than Hana Square. Figure 9 shows the ratio of the magnetic field map size required for performing indoor localization algorithm (load_size) and the size of map pieces to load to the SRAM per load operation (map_piece_size) compared to the sizes in initial step in Hana Square and SK Future Hall. As shown in the figure, as the target moves, the size of the magnetic field map required for performing the indoor positioning algorithm (load_size) decreases, and the ratios of the magnetic field map loaded to the SRAM compared to the original map converge to 8.78% and 23.53% for Hana Square and SK Future Hall testbeds, respectively. The converged ratio of the required magnetic field map size (load_size) loaded to SRAM for performing indoor localization algorithm in SK Future Hall is larger than that in Hana Square because the size of the magnetic field map in Hana Square is larger than SK Future Hall. In addition, in SK Future Hall, the size of the magnetic field map loaded to SRAM reaches the minimum magnetic field map size for performing indoor localization algorithm (min_load_size), as mentioned in Section 3.6. Therefore, the magnetic field size to load into the SRAM does not converge to smaller value in SK Future Hall. In addition, when the size of the magnetic field map required for performing the indoor positioning algorithm (load_size) are smaller than the maximum map size that can be loaded to SRAM (max_sram), the size of the map pieces becomes 1/4 of the maximum map size that can be loaded to SRAM (max_sram), which is minimum size of the map pieces, as mentioned in Section 3.6. The size of the map pieces reaches the minimum size faster in SK Future Hall than in Hana Square because the size of the magnetic field map in SK Future Hall is smaller than Hana Square.

Indoor Positioning Experiment Results
We tested total 20 paths for 2 testbeds (Hana Square and SK Future Hall), each of which consist of 100 pedestrian steps. For comparative evaluation, we test the localization performance of (1) Wi-Fi fingerprinting method with K-NN mapping, (2) the proposed indoor localization algorithm based on the magnetic field without low-memory schemes (magnetic field map compression and map load strategy) using the smartphone (Samsung Galaxy S10) and (3) the proposed indoor localization algorithm based on the magnetic field with low-memory schemes using the embedded hardware. Table 4 shows the average localization errors of each path in Hana Square and SK Future Hall when walking on random paths on the testbeds with the smartphone and the embedded hardware. As shown in the table, our proposed IPS based on the magnetic field using the embedded hardware with low-memory schemes achieves the average errors of Figure 9. The ratio of the magnetic field map required for performing indoor localization algorithm (load_size) and the size of map pieces to load to the SRAM per load operation (map_piece_size) compared to the size in initial step in Hana Square and SK Future Hall.

Indoor Positioning Experiment Results
We tested total 20 paths for 2 testbeds (Hana Square and SK Future Hall), each of which consist of 100 pedestrian steps. For comparative evaluation, we test the localization performance of (1) Wi-Fi fingerprinting method with K-NN mapping, (2) the proposed indoor localization algorithm based on the magnetic field without low-memory schemes (magnetic field map compression and map load strategy) using the smartphone (Samsung Galaxy S10) and (3) the proposed indoor localization algorithm based on the magnetic field with low-memory schemes using the embedded hardware. Table 4 shows the average localization errors of each path in Hana Square and SK Future Hall when walking on random paths on the testbeds with the smartphone and the embedded hardware. As shown in the table, our proposed IPS based on the magnetic field using the embedded hardware with low-memory schemes achieves the average errors of 1.33 m and 1.26 m for Hana Square and SK Future Hall with comparable performance to our proposed IPS based on the magnetic field using smartphone without low-memory schemes, which shows that there is less difference in the localization errors with and without lowmemory schemes. In addition, our proposed IPS based on the magnetic field could achieve much better localization accuracy compared to Wi-Fi fingerprinting schemes, which is due to the fact that Wi-Fi signal is unstable and time-varying and that fingerprinting method does not reflect target's continuous movements.

Conclusions
In this paper, we proposed the lightweight embedded hardware and low-memory schemes based on the characteristics of the geomagnetic sensor measurement and convergence of the target's estimated positions in order to perform the indoor positioning algorithms in the embedded hardware. Through the experiments on the Hana Square and SK Future Hall testbed, we can substantially reduce the size of the magnetic field map to 16.3% and 6.58% for each testbed respectively, which leads to reduced flash memory usage and reduced SRAM usage to 8.78% and 23.53% for each testbed respectively. We also show that the indoor localization performance of the lightweight embedded hardware with low-memory schemes is comparable to that of a full-run smart device without lowmemory schemes, which could achieve much better localization accuracy compared to Wi-Fi fingerprinting schemes.