# Low-Power Indoor Positioning Algorithm Based on iBeacon Network

Authors: Xiaona Zhang; Shufang Zhang; Shuaiheng Huai
Journal: Complexity
 (2021)

---

## Abstract

In this article, we use a low-power iBeacon network to conduct an in-depth analysis and research on the principle of indoor positioning and adopt an efficient and fast positioning algorithm. Secondly, based on the obtained analysis, an iBeacon-based indoor positioning system is proposed to analyze how to use iBeacon for accurate positioning and whether it can effectively compensate for the current mainstream positioning system. We analyze the requirements of the iBeacon-based indoor positioning system and propose the design of this positioning system. We analyze the platform and environment for software development, design the general framework of the positioning system, and analyze the logical structure of the whole system, the structure of data flow, and the communication protocols between each module of the positioning system. Then, we analyze the functions of the server module and the client module of the system, implement the functions of each module separately, and debug the functions of each module separately after each module is implemented. The feasibility of the algorithm and the performance improvement are confirmed by the experimental data. Our results show that the communication distance is improved by approximately 20.25% and the accuracy is improved by 5.62% compared to other existing results.


---

## Body

## 1. Introduction

With the research of artificial intelligence and big data becoming increasingly active, people have increasingly urgent demands for location-based services (LBS) under the background of “Internet+” and the era of intelligent Internet of Things [1]. If people can know where they are and get the geographic location information around them, then it is especially important for people’s life and travel. More and more intelligent technology companies have invested a lot of human and material resources into the research of location services; this technology has now a fairly mature application market. We believe that shortly, with the continuous improvement and innovation of science and technology, LBS will play an extremely important role in the intelligent Internet of Things.Indoor positioning, as one of the main technical supports of LBS, is also the primary goal of the research. In life, people spend most of the day in an indoor environment, and time is especially valuable in today’s fast-paced life, so if a person goes shopping in a mall, they need to quickly find the location of the store where the goods are located to reduce unnecessary time wastage [2]. In large parking lots, if there are as many as several thousand cars, there is no quick access to the parking location, which will also bring great inconvenience; thus, in today’s libraries, large shopping malls, convention halls, and waiting rooms in airports all need indoor positioning for location services. At present, many mobile terminals such as smartphones are popular, and the number of cell phone holdings is increasing dramatically, so some indoor positioning technologies for cell phones are also being studied more often. Location techniques based on smartphone terminals often do not require many other positioning aids, and today’s smartphones also integrate a variety of sensors, such as temperature sensors, acceleration sensors, and geomagnetic sensors [3]. Moreover, we can save more positioning costs and use the sensors carried by the locator’s cell phone itself to be able to locate the location, so using the cell phone as the main tool to achieve indoor positioning has considerable practical value and practical significance. However, a single indoor positioning technology has some technical defects in the positioning process to meet the positioning needs, so it also needs to be integrated with other positioning technologies for positioning.Therefore, this article proposes an optimized indoor positioning scheme based on the fusion of iBeacon positioning and PDR positioning, using the acceleration sensors and geomagnetic sensors carried by smartphones themselves [3], combined with the low-cost, simple deployment, and higher accuracy iBeacon positioning technology for indoor fusion positioning, which improves the accuracy of indoor positioning to a great extent. The development of IoT, big data, cloud computing, and other technologies as the core technologies of smart classrooms has promoted the development of smart classrooms, and the data sources of education big data mainly include four aspects such as IoT sensing, video recording, image recognition, and platform acquisition, among which the data collected by IoT sensing mainly include time, content, and location information [4]. However, there is relatively little research related to location information in the smart classroom, and for the special characteristics of positioning in the smart classroom, the following requirements are needed for positioning in the smart classroom: high accuracy, strong anti-interference, good stability, low energy consumption, low cost, and lightweight appearance. This study will research the positioning technology according to the special requirements of positioning in smart classrooms to develop relevant smart applications and services based on the location information.


## 2. Current Status of Research

With the advent of the intelligent Internet of Things era, LBS has been gradually used in all occupations. GPS meets the outdoor positioning and navigation needs of pedestrians to a certain extent but cannot better reflect its effect indoors, so many experts and scholars at home and abroad have proposed different algorithms and improvements for indoor positioning technology [5]. Moneer et al. proposed a self-calibration method using received signal strength (RSS) histogram to realize the mapping between the reference device and the user device, considering that the difference between the device used in establishing the location fingerprint library (reference device) and the device used in the positioning phase (user device) may lead to the reduction of positioning accuracy [6]. A self-calibration method using RSS histogram to achieve mapping between the reference device and the user device is proposed, which requires no human intervention, and the effectiveness of the method is verified by using five different smartphones in a real environment [4]. However, the shortcomings of the location-based fingerprint database approach are as follows: first, the workload of building a fingerprint database in the offline phase is large, and the establishment of an RSS fingerprint database is crucial in location-based indoor positioning systems, which usually requires a lot of time and effort; second, the fingerprint database needs to be frequently updated and maintained over time [7]. iBeacon performs orientation sensing based on its signal strength RSSI (Received Signal Strength Indication), and the change of RSSI value is used to determine the distance of the user from the iBeacon device. If the RSSI of a certain interval (1 meter) is known, then the interval is less than 1 meter if it is greater than that value and greater than 1 meter if it is less than that value. After the arrangement of multiple base stations, the relative interval with two or more base stations can be used to find the general area of the user’s orientation.Song et al. proposed an indoor positioning system using geomagnetic field perturbations and ambient light and applied a particle filter to the system, which resulted in an average positioning error of 4 m when tested in an office building; however, the overall positioning accuracy continued to decrease as the test area increased [8]. The main source of these magnetic anomalies is iron ore or other metallic minerals distributed in the subsurface, and these metallic minerals can generate unique magnetic maps, which can be used for localization. Experiments conducted at an underground copper-zinc mine in central Finland have shown that the final positioning accuracy of the system is about 1.5 m [9]. This positioning technology provides an efficient positioning solution for subsurface environments where only a small amount of infrastructure is available and there is a need for positioning, but the positioning solution based on this technology requires specific equipment to map the magnetism in the early stage, and the variation of geomagnetic intensity is not obvious in a small area, so the overall positioning accuracy of the system is not high [10]. The overall positioning accuracy is not high [3].Based on the above analysis and research summary, this article proposes a multifilter iBeacon indoor localization method based on the analysis of iBeacon indoor localization principle, characteristics, and shortcomings to achieve the ultimate research goal of this article: low cost, high accuracy, and reliable indoor localization system [11]. To address the problem that the iBeacon-based indoor positioning system does not have high positioning accuracy when the beacon node deployment density is low, an improved weighted mass center positioning algorithm is introduced to enable the system to achieve high positioning accuracy even when the beacon node deployment density is low, which reduces the hardware overhead of this system and improves the practical use-value of the system. The Kalman filtering algorithm and the recursive averaging filtering algorithm are proposed to improve the continuity and reliability of the localization results. An indoor positioning system based on the method described in this article is implemented using the existing iBeacon devices in the laboratory, and the deployment of the devices and data collection in the parking lot are carried out to verify the feasibility and reliability of the positioning method and the positioning results.


## 3. Design of Low-Power Indoor Positioning Algorithm under iBeacon Network

### 3.1. Optimized Indoor Positioning Algorithm

The indoor environment is complex and variable, such as people walking, walls and physical objects blocking, cochannel interference from electronic devices, and multipath effect formed by the superposition of multiple signals, can affect the propagation of electromagnetic signals. Meanwhile, the indoor environment is unique, so determining the wireless signal attenuation model that matches the indoor environment will directly affect the performance of positioning [12]. The indoor positioning algorithm based on the wireless signal attenuation model is more suitable in the indoor environment with fewer obstructions, more openness, and more stability. The signal fading model is divided into the free space fading model and logarithmic distance fading model, and the free space fading model is a special state, which is the base model of the logarithmic distance fading model [13]. The logarithmic distance fading model is an improvement of the free space fading model and a more realistic model.The special characteristics of the free space are shown by the fact that the wireless signal transmitting and signal to receive device is a more ideal scenario, with no obstructions and small spacing between them. The RSSP at distance d from the signal access point is denoted as follows:(1)Prd=λPrGrGI16π2d2r.The above formula inr is the system loss parameter, independent of the experimental environment, for the total hardware loss. The formula for the path loss Prd is introduced as follows:(2)Pld=10lnλPrGrGI16π2d2r.The free space loss model is more ideal, logarithmic distance path loss model compared to the free space loss model to introduce the path loss indexn; the model equation is as follows:(3)Pld=Pld0−10nlndd0−X,where Pld denotes the signal strength, X denotes the loss factor, and P denotes the signal strength value (in dBm) at the reference distance d0. When the value of d is taken as 1 m, the value of Pld is the value of RSSI at 1 m from the beacon node, and the functional relationship between the distance and RSSI value is as follows:(4)d=10pd+p010np,where the mouth (4) is the RSSI value at distance d. The function between the distance d and the value Pld of RSSI can be determined by curve fitting to determine the values of parameters Pld and np. However, the signal strength eigenvalue RSSI signal is unstable in the actual environment and thus has large fluctuations, so it is less resistant to noise [14]. Its positioning principle is that the distance from the receiver to the transmitter is determined using the known RSSI value, and then the actual physical coordinates of the receiver are calculated by the trilateral geometric positioning algorithm.Three circles are made with known coordinates of three reference nodesAP1x1,y1, AP2x2,y2, AP3x3,y3, coordinates of the point to be measured MPx,y, and distances r1,r2,r3 from the node to be measured to each circle center AP, as shown in Figure 1.Figure 1
Principle diagram of three-sided positioning algorithm.The three circles intersecting at a point MP can be calculated to get the coordinates of that point. The distance determined by the decay model has some error, resulting in three circles not intersecting at a point, but a region consisting of ABC in the figure, and the MP coordinates are obtained by solving the weighted center of mass for that region.(5)r12=x−x12+y−y12,r12=x−x22+y−y22,r12=x−x32+y−y22.The core of the matching model algorithm is matching, and this model requires a mapping relationship between the radio signal strength and the actual physical coordinates and then calculates the actual physical coordinates of the point to be measured by receiving the radio signal feature value RSSI. It is based on the principle of first establishing a fingerprint database in the offline sampling phase, which contains the fingerprint vector and actual physical coordinate information of each anchor node [15]. Then, the matching algorithm is applied in the online positioning stage to match the fingerprint vectors in the fingerprint database to find the closest anchor node and get the coordinates of the point to be measured.The Bayesian algorithm is a class of classification algorithms based on the Bayesian formula, and the plain Bayesian algorithm is one of the more classical algorithms. The probabilistic model localization algorithm is the application of the Bayesian classification algorithm to indoor localization. The plain Bayesian algorithm requires that the individual signal eigenvalues are independent of each other and the anchor nodes are uniformly distributed, and the Bayesian formula is shown in equation (6).(6)PB|A=PB|APBPA.Suppose there are N anchor nodes RPs in the fingerprint library withr1,r2,r3; the physical coordinates of the i-th RP are L=xi,yi. The mobile terminal receives RSSI information from P Bluetooth APs, which is denoted as R′=r1,r2,r3,…,rp. For the probabilistic localization algorithm, the posterior probability PLi|R′ of the R′ vector accepted by the mobile receiver at each anchor node is obtained, and the coordinates of the point to be measured can be derived, as shown in equation (7).(7)PLi|R′=PLi|R′∗PLi∑i=1PPLi|R′∗PLi.The posterior probability is applied to find the coordinates of the point to be measured:(8)LX,Y=∑i=1PLi|R′∗PLiPx,y.The RSSI signal strength value received at a reference point that obeys a Gaussian distribution can be derived as(9)pri′|Li=expri′+u22γ2.The above probabilistic model-based localization algorithm requires attributes to be independent of each other, and this assumption is more difficult to achieve in the actual environment, which has a greater impact on the model being able to classify correctly, and in indoor localization requires each anchor node to be uniformly distributed in the indoor space, which is difficult to achieve in complex environments. Therefore, the Bayesian algorithm model is not suitable for use in more complex environments.The complexity and specificity of the indoor environment make the radio signal propagation in indoor space generate large interference, which affects the positioning accuracy. Radio signal propagation in the complex indoor environment will encounter obstacles such as bypass, scattering, and reflection, making the radio signal propagation in free space in different directions; these signals are superimposed at the data receiving end, but the signal propagation along different paths will result in time delay, which affects the signal strength and phase, resulting in these received signals being distorted, thus affecting the positioning accuracy. This is the multipath effect. The working frequency band of Bluetooth is the common wireless frequency band all over the world, and it is widely used in the commercial field of TV, microwave oven, WIFI, and other electronic devices. The radio signals generated by these devices will interfere with the signals at the transmitter and receiver side of the signal, thus affecting the positioning accuracy. The RSSI value of radio signals transmitted by APs will be lower than the real value when they pass through the occluders, and different occluders produce different occlusion effects, thus affecting the accuracy of positioning. Table1 shows the loss of electromagnetic waves by common indoor objects.Table 1
Loss of common indoor objects to electromagnetic waves.
Type of obstructionCorresponding loss (dB)Cloth1∼6Wall4∼8Glass window4∼9Cement soil9∼14Reinforced concrete15∼24Gypsum board wall20∼32Insulation22∼39Metal objects24∼42Due to the indoor spatial multipath effect, radio signal cochannel interference and object occlusion affect the radio signal, which in turn affects the RSSI value and ultimately the positioning accuracy. Therefore, the received RSSI signal values need to be optimized by filtering algorithms to reduce the impact of noise on localization accuracy. The traditional fingerprint positioning algorithm uses solving for the mean value in the offline stage to process the signals collected by the same AP multiple times at the same reference point, and if only solving for the mean value is used to process the signals, large errors will be generated throughout the matching and positioning process [16]. The indoor environment is complex and changeable, which makes the RSSI value received by the mobile terminal fluctuate in real-time, and the more complex the environment is, the greater the fluctuation is; then, the RSSI value received at any moment will have a large fluctuation error, and the data in the traditional fingerprint library are filtered out part of the fluctuation error by solving for the mean value, which makes the two cannot be well matched. Therefore, the use of mean filtering cannot reduce the influence of indoor environmental noise on the received value and thus cannot better improve the accuracy of positioning.As shown in Figure2, based on the above considerations, this article discards the traditional mean filtering technique to filter the data in the fingerprint database and instead performs Gaussian filtering to de-dry the RSSI data in the fingerprint database. Gaussian filtering can effectively reduce the impact of small probability and strong interference noise on the RSSI sample data collected at the anchor node to achieve higher localization accuracy. The algorithm is based on the following principle: n RSSI data from one AP are received at the same anchor node, the value of the higher probability interval is selected, and the final fingerprint vector of the anchor node is obtained by taking the geometric mean of the selected value. In this article, we select any anchor node in the localization area and count the frequency of the collected RSSI data, which shows that the frequency of RSSI values distributed in each uniform interval approximately obeys Gaussian distribution.Figure 2
RSSI data before and after the filtering process.


### 3.2. Low-Power iBeacon Network System Design

The system mainly contains a cell phone client system and server system, where the server system is better divided into scheduling server system and location engine server system, and the main structure is shown in Figure3.Figure 3
Encounter structure of the system.The main role of the scheduling server is to perform client connection verification and query of idle location servers and exists as a bridge between client and location server communication. When a mobile client needs to locate a location, first, it sends a location request to the connection scheduling server, which verifies the request sent by the client according to the agreed rules to ensure whether the request is valid; on the other hand, the scheduling system also performs a query of the location engine server to check whether the location engine server is idle, and if so, it sends the address and port number of the available location engine server to the client after the client’s request is verified [17]. If it exists, the address and port number of the location engine server that can be used will be sent to the client after the client’s request and verification are passed so that the client can query the location. This is to ensure that the location server cannot be used casually and to protect the location server from overloading the number of connections and causing server downtime and to ensure the quality of location.The way it works is that devices equipped with low-power Bluetooth (BLE) communication use BLE technology to send their own unique ID to their surroundings, and the application that receives that ID takes some action based on it. For example, if an iBeacon communication module is installed in a store, an information server can be run on iPhones and iPads, or the server can send discount coupons and store credit to customers. In addition, iBeacon can also be used to send information to applications when appliances break down or stop working.The location server mainly estimates and determines the location of the mobile client, and after the client gets the available IP address and port number from the scheduling server, it continuously sends the current surrounding iBeacon signal measurement data to the location server, which compares the measurement data with the data in the database, estimates the current location coordinates according to the location algorithm, and returns the map and location. The location server will compare the measurement data with the data in the database, estimate the current location coordinates according to the location algorithm, and return the map and location coordinate to the location client, which will display the location according to the location coordinates.The cell phone client system mainly includes the fingerprint collection client and the positioning display client; the fingerprint collection client mainly collects the RSSI fingerprints of the iBeacon signals around the location, saves the collected fingerprints in the form of files, and uploads them to the fingerprint database. The positioning display client mainly collects the signals around the current location in real-time and sends the collected iBeacon signal value groups to the positioning server in a certain format, and the positioning server returns the positioning result data after the algorithm estimation and finally displays the positioning result in the cell phone client.The indoor positioning system adopts wireless LAN as the communication network, considering that the system adopts the client-server mode of client and server; i.e., the client and the back-end server are separated, each client can establish a connection to a back-end server, and the server can always listen to the requests from the client. Once this virtual network link is established, the client and the server can establish a communication connection. iBeacon uses BLE technology, specifically, broadcast frames called “alerting” frames in BLE. An announcement frame is a frame that is sent periodically and can be received by any BLE-enabled device. iBeacon does this by embedding Apple’s own formatted data in the payload portion of such an announcement frame. The data for this article comes from Apple.The data preprocessing on the client-side mainly focuses on the raw data from the accelerometer and the geomagnetic sensor in the PDR module, where the data filtering algorithm used for processing the data from the accelerometer is the sliding average algorithm, and the data from the geomagnetic sensor are filtered by the low-pass filter algorithm. According to the algorithm principle in Chapter 2, to deduce the current position of the pedestrian, the number of steps, step length, heading angle, and so forth need to be known into the deduction formula to calculate the position coordinates. The PDR positioning algorithm module mainly includes original data acquisition, data preprocessing, gait detection algorithm, step length estimation, heading angle estimation module, and position estimation [18]. The specific steps are as follows: (1) the acceleration and geomagnetic sensor data are acquired, followed by preprocessing. (2) The processed acceleration is used for face detection using the gait detection algorithm in the previous chapter. (3) The stride length is estimated according to the improved stride length formula. (4) The heading angle is taken as the median value of the divided interval, which reduces the error caused by jitter during the experiment to some extent. (5) After obtaining the values of all the above steps, the position of the pedestrian can be estimated.The location client needs to send a location request to the scheduling server when it needs to locate, the scheduling server receives the request and verifies it by returning the available location server I address and port to the location client, and the location client returns the connection success information to the scheduling server after receiving the returned location server address and port. In the positioning process, the positioning client starts to send the iBeacon information of the current location to the positioning server, and after the positioning server receives the message from the client, it makes the location estimation and returns the estimated location coordinates to the positioning client, and the positioning client displays the location coordinates according to the received location. At the end of the positioning process, the positioning client stops sending the current location beacon signal information to the positioning server and, at the same time, sends a positioning termination request to the scheduling server [19–21]. The scheduling service receives the positioning termination request, then performs the positioning termination operation, and then sends a termination completion command to the positioning client after the operation is completed.The iBeacon indoor positioning system uses two main protocols, one is the connection-oriented Transmission Control Protocol Internet Protocol (TCP/P), and the other is the nonlong connection User Datagram Protocol (UDP) [22–25]. The other is the UDP, which is a nonlong connection. The interaction between the cell phone client and the scheduling server uses the TCP/IP connection because the whole process needs to have a long connection considering the security of the system. The communication method between the positioning client and the positioning server is UDP because in the process of positioning, considering the high frequency of sending positioning data, if TCP/TP communication method is used, it may cause data blocking, and once the data blocking phenomenon occurs, the positioning will have a large delay, and then the next positioning will have a considerable. There will be considered errors in the subsequent positioning. If the UDP transmission method is used, only the real-time positioning data need to be transmitted to the server and the server receives or does not receive. It only needs to continuously transmit the current data to the server; the server only needs to estimate the location according to the current data; the estimated location is thrown to the positioning client; the positioning client can be displayed according to the received information, even in the process of positioning. Even if some data are lost in the process of positioning, there is no need to worry; just wait for the next data.


## 3.1. Optimized Indoor Positioning Algorithm

The indoor environment is complex and variable, such as people walking, walls and physical objects blocking, cochannel interference from electronic devices, and multipath effect formed by the superposition of multiple signals, can affect the propagation of electromagnetic signals. Meanwhile, the indoor environment is unique, so determining the wireless signal attenuation model that matches the indoor environment will directly affect the performance of positioning [12]. The indoor positioning algorithm based on the wireless signal attenuation model is more suitable in the indoor environment with fewer obstructions, more openness, and more stability. The signal fading model is divided into the free space fading model and logarithmic distance fading model, and the free space fading model is a special state, which is the base model of the logarithmic distance fading model [13]. The logarithmic distance fading model is an improvement of the free space fading model and a more realistic model.The special characteristics of the free space are shown by the fact that the wireless signal transmitting and signal to receive device is a more ideal scenario, with no obstructions and small spacing between them. The RSSP at distance d from the signal access point is denoted as follows:(1)Prd=λPrGrGI16π2d2r.The above formula inr is the system loss parameter, independent of the experimental environment, for the total hardware loss. The formula for the path loss Prd is introduced as follows:(2)Pld=10lnλPrGrGI16π2d2r.The free space loss model is more ideal, logarithmic distance path loss model compared to the free space loss model to introduce the path loss indexn; the model equation is as follows:(3)Pld=Pld0−10nlndd0−X,where Pld denotes the signal strength, X denotes the loss factor, and P denotes the signal strength value (in dBm) at the reference distance d0. When the value of d is taken as 1 m, the value of Pld is the value of RSSI at 1 m from the beacon node, and the functional relationship between the distance and RSSI value is as follows:(4)d=10pd+p010np,where the mouth (4) is the RSSI value at distance d. The function between the distance d and the value Pld of RSSI can be determined by curve fitting to determine the values of parameters Pld and np. However, the signal strength eigenvalue RSSI signal is unstable in the actual environment and thus has large fluctuations, so it is less resistant to noise [14]. Its positioning principle is that the distance from the receiver to the transmitter is determined using the known RSSI value, and then the actual physical coordinates of the receiver are calculated by the trilateral geometric positioning algorithm.Three circles are made with known coordinates of three reference nodesAP1x1,y1, AP2x2,y2, AP3x3,y3, coordinates of the point to be measured MPx,y, and distances r1,r2,r3 from the node to be measured to each circle center AP, as shown in Figure 1.Figure 1
Principle diagram of three-sided positioning algorithm.The three circles intersecting at a point MP can be calculated to get the coordinates of that point. The distance determined by the decay model has some error, resulting in three circles not intersecting at a point, but a region consisting of ABC in the figure, and the MP coordinates are obtained by solving the weighted center of mass for that region.(5)r12=x−x12+y−y12,r12=x−x22+y−y22,r12=x−x32+y−y22.The core of the matching model algorithm is matching, and this model requires a mapping relationship between the radio signal strength and the actual physical coordinates and then calculates the actual physical coordinates of the point to be measured by receiving the radio signal feature value RSSI. It is based on the principle of first establishing a fingerprint database in the offline sampling phase, which contains the fingerprint vector and actual physical coordinate information of each anchor node [15]. Then, the matching algorithm is applied in the online positioning stage to match the fingerprint vectors in the fingerprint database to find the closest anchor node and get the coordinates of the point to be measured.The Bayesian algorithm is a class of classification algorithms based on the Bayesian formula, and the plain Bayesian algorithm is one of the more classical algorithms. The probabilistic model localization algorithm is the application of the Bayesian classification algorithm to indoor localization. The plain Bayesian algorithm requires that the individual signal eigenvalues are independent of each other and the anchor nodes are uniformly distributed, and the Bayesian formula is shown in equation (6).(6)PB|A=PB|APBPA.Suppose there are N anchor nodes RPs in the fingerprint library withr1,r2,r3; the physical coordinates of the i-th RP are L=xi,yi. The mobile terminal receives RSSI information from P Bluetooth APs, which is denoted as R′=r1,r2,r3,…,rp. For the probabilistic localization algorithm, the posterior probability PLi|R′ of the R′ vector accepted by the mobile receiver at each anchor node is obtained, and the coordinates of the point to be measured can be derived, as shown in equation (7).(7)PLi|R′=PLi|R′∗PLi∑i=1PPLi|R′∗PLi.The posterior probability is applied to find the coordinates of the point to be measured:(8)LX,Y=∑i=1PLi|R′∗PLiPx,y.The RSSI signal strength value received at a reference point that obeys a Gaussian distribution can be derived as(9)pri′|Li=expri′+u22γ2.The above probabilistic model-based localization algorithm requires attributes to be independent of each other, and this assumption is more difficult to achieve in the actual environment, which has a greater impact on the model being able to classify correctly, and in indoor localization requires each anchor node to be uniformly distributed in the indoor space, which is difficult to achieve in complex environments. Therefore, the Bayesian algorithm model is not suitable for use in more complex environments.The complexity and specificity of the indoor environment make the radio signal propagation in indoor space generate large interference, which affects the positioning accuracy. Radio signal propagation in the complex indoor environment will encounter obstacles such as bypass, scattering, and reflection, making the radio signal propagation in free space in different directions; these signals are superimposed at the data receiving end, but the signal propagation along different paths will result in time delay, which affects the signal strength and phase, resulting in these received signals being distorted, thus affecting the positioning accuracy. This is the multipath effect. The working frequency band of Bluetooth is the common wireless frequency band all over the world, and it is widely used in the commercial field of TV, microwave oven, WIFI, and other electronic devices. The radio signals generated by these devices will interfere with the signals at the transmitter and receiver side of the signal, thus affecting the positioning accuracy. The RSSI value of radio signals transmitted by APs will be lower than the real value when they pass through the occluders, and different occluders produce different occlusion effects, thus affecting the accuracy of positioning. Table1 shows the loss of electromagnetic waves by common indoor objects.Table 1
Loss of common indoor objects to electromagnetic waves.
Type of obstructionCorresponding loss (dB)Cloth1∼6Wall4∼8Glass window4∼9Cement soil9∼14Reinforced concrete15∼24Gypsum board wall20∼32Insulation22∼39Metal objects24∼42Due to the indoor spatial multipath effect, radio signal cochannel interference and object occlusion affect the radio signal, which in turn affects the RSSI value and ultimately the positioning accuracy. Therefore, the received RSSI signal values need to be optimized by filtering algorithms to reduce the impact of noise on localization accuracy. The traditional fingerprint positioning algorithm uses solving for the mean value in the offline stage to process the signals collected by the same AP multiple times at the same reference point, and if only solving for the mean value is used to process the signals, large errors will be generated throughout the matching and positioning process [16]. The indoor environment is complex and changeable, which makes the RSSI value received by the mobile terminal fluctuate in real-time, and the more complex the environment is, the greater the fluctuation is; then, the RSSI value received at any moment will have a large fluctuation error, and the data in the traditional fingerprint library are filtered out part of the fluctuation error by solving for the mean value, which makes the two cannot be well matched. Therefore, the use of mean filtering cannot reduce the influence of indoor environmental noise on the received value and thus cannot better improve the accuracy of positioning.As shown in Figure2, based on the above considerations, this article discards the traditional mean filtering technique to filter the data in the fingerprint database and instead performs Gaussian filtering to de-dry the RSSI data in the fingerprint database. Gaussian filtering can effectively reduce the impact of small probability and strong interference noise on the RSSI sample data collected at the anchor node to achieve higher localization accuracy. The algorithm is based on the following principle: n RSSI data from one AP are received at the same anchor node, the value of the higher probability interval is selected, and the final fingerprint vector of the anchor node is obtained by taking the geometric mean of the selected value. In this article, we select any anchor node in the localization area and count the frequency of the collected RSSI data, which shows that the frequency of RSSI values distributed in each uniform interval approximately obeys Gaussian distribution.Figure 2
RSSI data before and after the filtering process.


## 3.2. Low-Power iBeacon Network System Design

The system mainly contains a cell phone client system and server system, where the server system is better divided into scheduling server system and location engine server system, and the main structure is shown in Figure3.Figure 3
Encounter structure of the system.The main role of the scheduling server is to perform client connection verification and query of idle location servers and exists as a bridge between client and location server communication. When a mobile client needs to locate a location, first, it sends a location request to the connection scheduling server, which verifies the request sent by the client according to the agreed rules to ensure whether the request is valid; on the other hand, the scheduling system also performs a query of the location engine server to check whether the location engine server is idle, and if so, it sends the address and port number of the available location engine server to the client after the client’s request is verified [17]. If it exists, the address and port number of the location engine server that can be used will be sent to the client after the client’s request and verification are passed so that the client can query the location. This is to ensure that the location server cannot be used casually and to protect the location server from overloading the number of connections and causing server downtime and to ensure the quality of location.The way it works is that devices equipped with low-power Bluetooth (BLE) communication use BLE technology to send their own unique ID to their surroundings, and the application that receives that ID takes some action based on it. For example, if an iBeacon communication module is installed in a store, an information server can be run on iPhones and iPads, or the server can send discount coupons and store credit to customers. In addition, iBeacon can also be used to send information to applications when appliances break down or stop working.The location server mainly estimates and determines the location of the mobile client, and after the client gets the available IP address and port number from the scheduling server, it continuously sends the current surrounding iBeacon signal measurement data to the location server, which compares the measurement data with the data in the database, estimates the current location coordinates according to the location algorithm, and returns the map and location. The location server will compare the measurement data with the data in the database, estimate the current location coordinates according to the location algorithm, and return the map and location coordinate to the location client, which will display the location according to the location coordinates.The cell phone client system mainly includes the fingerprint collection client and the positioning display client; the fingerprint collection client mainly collects the RSSI fingerprints of the iBeacon signals around the location, saves the collected fingerprints in the form of files, and uploads them to the fingerprint database. The positioning display client mainly collects the signals around the current location in real-time and sends the collected iBeacon signal value groups to the positioning server in a certain format, and the positioning server returns the positioning result data after the algorithm estimation and finally displays the positioning result in the cell phone client.The indoor positioning system adopts wireless LAN as the communication network, considering that the system adopts the client-server mode of client and server; i.e., the client and the back-end server are separated, each client can establish a connection to a back-end server, and the server can always listen to the requests from the client. Once this virtual network link is established, the client and the server can establish a communication connection. iBeacon uses BLE technology, specifically, broadcast frames called “alerting” frames in BLE. An announcement frame is a frame that is sent periodically and can be received by any BLE-enabled device. iBeacon does this by embedding Apple’s own formatted data in the payload portion of such an announcement frame. The data for this article comes from Apple.The data preprocessing on the client-side mainly focuses on the raw data from the accelerometer and the geomagnetic sensor in the PDR module, where the data filtering algorithm used for processing the data from the accelerometer is the sliding average algorithm, and the data from the geomagnetic sensor are filtered by the low-pass filter algorithm. According to the algorithm principle in Chapter 2, to deduce the current position of the pedestrian, the number of steps, step length, heading angle, and so forth need to be known into the deduction formula to calculate the position coordinates. The PDR positioning algorithm module mainly includes original data acquisition, data preprocessing, gait detection algorithm, step length estimation, heading angle estimation module, and position estimation [18]. The specific steps are as follows: (1) the acceleration and geomagnetic sensor data are acquired, followed by preprocessing. (2) The processed acceleration is used for face detection using the gait detection algorithm in the previous chapter. (3) The stride length is estimated according to the improved stride length formula. (4) The heading angle is taken as the median value of the divided interval, which reduces the error caused by jitter during the experiment to some extent. (5) After obtaining the values of all the above steps, the position of the pedestrian can be estimated.The location client needs to send a location request to the scheduling server when it needs to locate, the scheduling server receives the request and verifies it by returning the available location server I address and port to the location client, and the location client returns the connection success information to the scheduling server after receiving the returned location server address and port. In the positioning process, the positioning client starts to send the iBeacon information of the current location to the positioning server, and after the positioning server receives the message from the client, it makes the location estimation and returns the estimated location coordinates to the positioning client, and the positioning client displays the location coordinates according to the received location. At the end of the positioning process, the positioning client stops sending the current location beacon signal information to the positioning server and, at the same time, sends a positioning termination request to the scheduling server [19–21]. The scheduling service receives the positioning termination request, then performs the positioning termination operation, and then sends a termination completion command to the positioning client after the operation is completed.The iBeacon indoor positioning system uses two main protocols, one is the connection-oriented Transmission Control Protocol Internet Protocol (TCP/P), and the other is the nonlong connection User Datagram Protocol (UDP) [22–25]. The other is the UDP, which is a nonlong connection. The interaction between the cell phone client and the scheduling server uses the TCP/IP connection because the whole process needs to have a long connection considering the security of the system. The communication method between the positioning client and the positioning server is UDP because in the process of positioning, considering the high frequency of sending positioning data, if TCP/TP communication method is used, it may cause data blocking, and once the data blocking phenomenon occurs, the positioning will have a large delay, and then the next positioning will have a considerable. There will be considered errors in the subsequent positioning. If the UDP transmission method is used, only the real-time positioning data need to be transmitted to the server and the server receives or does not receive. It only needs to continuously transmit the current data to the server; the server only needs to estimate the location according to the current data; the estimated location is thrown to the positioning client; the positioning client can be displayed according to the received information, even in the process of positioning. Even if some data are lost in the process of positioning, there is no need to worry; just wait for the next data.


## 4. Analysis of Results

### 4.1. Analysis of Positioning Algorithm Test Results

To test the accuracy of positioning, we mainly selected 5 points and performed 10 times of positioning for each coordinate point, and the returned coordinates of 10 times were averaged and compared with the original coordinates. The positioning results are shown in Figure4. The average error of the 10 positioning results of the selected 5 points is about 1 meter, and the accuracy is within 2 meters, and most of the accuracy is within 1 meter.Figure 4
Positioning results.Next, we conducted 40 separate positioning measurements on the point (12, 3, 0), and the results of the test are shown in Figure5. From the measurement results, we can see that the probability of the iBeacon-based indoor positioning system achieving accurate and error-free positioning is 20%, the probability of error within 1 meter is 75%, and the probability of error exceeding 2 meters is 5%, and the average error variance is calculated to be 1.11 meters. At the same time, we used the improved k-nearest neighbor algorithm for testing and found that the phenomenon of jumping of positioning points occurred from time to time. Because of the jumping of positioning points, the average error of positioning was significantly larger than that of the system based on the improved k-nearest neighbor algorithm, and after some testing, it was found that the average variance of the positioning error was 1.47 meters when the k value was kept constant using the ordinary k-nearest neighbor algorithm. From the above test, it can be concluded that the positioning accuracy can reach a high level when iBeacon is used as AP and the improved k-nearest neighbor algorithm is used for positioning.Figure 5
Point (12, 3, 0) measurement results.The speed of the location test is evaluated using the network packet capture software Wireshark to assist in testing, through Wireshark to the server’s IP and location of the port number for packet capture. The test process is as follows: the packet capture software is configured through the cell phone in the test environment for positioning operations and multiple positioning; the packet capture software log is used to view the analysis, basically each time the location of the packet sent to the location of the estimated results of the issue of its interval within 1 second. In a good network environment, the positioning test is conducted 20 times for the same location, and the average positioning time is calculated to be 0.91 seconds, which fully illustrates that the positioning speed of the system is also fast and fully meets the demand of real-time positioning. The positioning can also be roughly measured during the walking process, and the positioning can be done during the normal walking process, and the location coordinates displayed by the client can follow movement, which means that the latest location estimation results have been obtained. Therefore, after testing, it can be concluded that the positioning speed of this system is still quite fast and can make the position estimation in a very timely manner, as shown in Figure6.Figure 6
Positioning speed results.The concurrency test of the location server is to test its ability to respond to multiple clients at the same time. Since it is impossible to find many cell phones for testing, this test is mainly written by the test program, which finds some iBeacon signal fingerprints in the database, takes out the RSSI values from the fingerprints, and then writes a test program to simulate multiple cell phone terminals to send measurement reports to the location server simultaneously in parallel. When a thousand test data are sent to the location server for processing, the location server can still return the location estimation results in a relatively short time, which means that the current location server can locate a thousand clients at the same time without too many problems, but there is no detailed test on how many clients can be located at the same time. The concurrency of the iBeacon-based indoor positioning system is at least a thousand or more.


### 4.2. System Performance Results Analysis

The complexity and peculiarities of the indoor environment of the wisdom education introduce a lot of environmental noise to the experimental data, and the interference of these noises comes from a variety of factors, such as multipath effects, wireless signal cochannel interference, and object occlusion, all of which can have an impact on the construction of the location fingerprint map and the real-time positioning of the user. The RSSI value has been collected several times to reduce the noise interference as much as possible, as shown in Figure7; a reference point is selected to collect data every second, and for a total of 60 times, the minimum value of RSSI value is -99, and the maximum value is -84, which means that the RSSI fluctuates greatly. In this article, the traditional mean filtering technique is abandoned, and the RSSI value of the experimental data approximately obeys the Gaussian statistical model through statistical analysis, so it is suitable to use the Gaussian algorithm to filter the RSSI to reduce the influence of noise on the construction of fingerprint database and real-time positioning to improve the positioning accuracy. The RSSI data filtered by Gaussian filtering in Figure 7 is smoother than the original data image, and the RSSI values have a small drop and smooth change. The smart classroom environment introduces large noise to the experimental data, and the Gaussian filtering process can effectively suppress fluctuations and reduce the impact of noise, thus improving the localization performance.Figure 7
Data acquisition results.The gait detection algorithm is mainly used to complete the task of step counting, and this article uses the change law of acceleration to enter the judgment of step counting and makes simple improvements to the traditional wave detection algorithm, and analyzes it by experiment. The experimental site is chosen in the corridor on the third floor of the experimental first building, the corridor is about 50m, and two types of uniform linear and variable speed linear detection are used to conduct 10 experiments, respectively, and compare the results, as shown in Figure8.Figure 8
Uniform linear walking pedometer detection statistics.As can be seen from Figure8, the accuracy of the gait detection algorithm is relatively high. In the uniform linear way, the accuracy of the basic gait detection algorithm is basically above 90%, while in the variable speed linear motion way, the accuracy is often reduced relative to the uniform linear, and if the speed is larger, the error of the gait counting may be larger; while in the actual positioning process, the speed of the pedestrian is often uncertain. The gait detection algorithm often has certain shortcomings, and further improvements are needed for different motion states.Firstly, the composition of this indoor positioning system is introduced, and then the positioning server and the mobile client are introduced separately. The development platform and function design of the positioning server are firstly introduced in detail; then the client development platform is briefly introduced, and finally, the coding process of iBeacon signal acquisition and analysis is introduced in detail. The system implements the weighted mass center positioning algorithm, Kalman filter algorithm, and recursive average filter algorithm and, initially, completes the functions of iBeacon signal parsing, real-time positioning, positioning result optimization, and map display. In the actual positioning test in the parking lot, the overall operation of the system is stable and the positioning effect is good, achieving the expected results. The developed indoor positioning system has been deployed in the pilot application unit of the project in which the author participated. Now, iBeacon technology has amazing application cases in many places and some search sites; just type in iBeacon technology and a lot of related information can be found. The application of iBeacon technology has started, and a well-known company in the industry is playing a leading role.This article summarizes the latest scientific research results based on the study of relevant literature. To realize an indoor positioning system with low cost, high accuracy, and good reliability, and considering the actual situation, we propose an iBeacon indoor positioning method incorporating multiple filters and develop an indoor positioning system based on this method. At present, the system has been deployed in the pilot application unit of the author’s project, and the actual use shows that the method can improve the accuracy and reliability of the positioning system. Therefore, the research, improvement, and application of the iBeacon indoor positioning system are of certain value and significance in this article.


## 4.1. Analysis of Positioning Algorithm Test Results

To test the accuracy of positioning, we mainly selected 5 points and performed 10 times of positioning for each coordinate point, and the returned coordinates of 10 times were averaged and compared with the original coordinates. The positioning results are shown in Figure4. The average error of the 10 positioning results of the selected 5 points is about 1 meter, and the accuracy is within 2 meters, and most of the accuracy is within 1 meter.Figure 4
Positioning results.Next, we conducted 40 separate positioning measurements on the point (12, 3, 0), and the results of the test are shown in Figure5. From the measurement results, we can see that the probability of the iBeacon-based indoor positioning system achieving accurate and error-free positioning is 20%, the probability of error within 1 meter is 75%, and the probability of error exceeding 2 meters is 5%, and the average error variance is calculated to be 1.11 meters. At the same time, we used the improved k-nearest neighbor algorithm for testing and found that the phenomenon of jumping of positioning points occurred from time to time. Because of the jumping of positioning points, the average error of positioning was significantly larger than that of the system based on the improved k-nearest neighbor algorithm, and after some testing, it was found that the average variance of the positioning error was 1.47 meters when the k value was kept constant using the ordinary k-nearest neighbor algorithm. From the above test, it can be concluded that the positioning accuracy can reach a high level when iBeacon is used as AP and the improved k-nearest neighbor algorithm is used for positioning.Figure 5
Point (12, 3, 0) measurement results.The speed of the location test is evaluated using the network packet capture software Wireshark to assist in testing, through Wireshark to the server’s IP and location of the port number for packet capture. The test process is as follows: the packet capture software is configured through the cell phone in the test environment for positioning operations and multiple positioning; the packet capture software log is used to view the analysis, basically each time the location of the packet sent to the location of the estimated results of the issue of its interval within 1 second. In a good network environment, the positioning test is conducted 20 times for the same location, and the average positioning time is calculated to be 0.91 seconds, which fully illustrates that the positioning speed of the system is also fast and fully meets the demand of real-time positioning. The positioning can also be roughly measured during the walking process, and the positioning can be done during the normal walking process, and the location coordinates displayed by the client can follow movement, which means that the latest location estimation results have been obtained. Therefore, after testing, it can be concluded that the positioning speed of this system is still quite fast and can make the position estimation in a very timely manner, as shown in Figure6.Figure 6
Positioning speed results.The concurrency test of the location server is to test its ability to respond to multiple clients at the same time. Since it is impossible to find many cell phones for testing, this test is mainly written by the test program, which finds some iBeacon signal fingerprints in the database, takes out the RSSI values from the fingerprints, and then writes a test program to simulate multiple cell phone terminals to send measurement reports to the location server simultaneously in parallel. When a thousand test data are sent to the location server for processing, the location server can still return the location estimation results in a relatively short time, which means that the current location server can locate a thousand clients at the same time without too many problems, but there is no detailed test on how many clients can be located at the same time. The concurrency of the iBeacon-based indoor positioning system is at least a thousand or more.


## 4.2. System Performance Results Analysis

The complexity and peculiarities of the indoor environment of the wisdom education introduce a lot of environmental noise to the experimental data, and the interference of these noises comes from a variety of factors, such as multipath effects, wireless signal cochannel interference, and object occlusion, all of which can have an impact on the construction of the location fingerprint map and the real-time positioning of the user. The RSSI value has been collected several times to reduce the noise interference as much as possible, as shown in Figure7; a reference point is selected to collect data every second, and for a total of 60 times, the minimum value of RSSI value is -99, and the maximum value is -84, which means that the RSSI fluctuates greatly. In this article, the traditional mean filtering technique is abandoned, and the RSSI value of the experimental data approximately obeys the Gaussian statistical model through statistical analysis, so it is suitable to use the Gaussian algorithm to filter the RSSI to reduce the influence of noise on the construction of fingerprint database and real-time positioning to improve the positioning accuracy. The RSSI data filtered by Gaussian filtering in Figure 7 is smoother than the original data image, and the RSSI values have a small drop and smooth change. The smart classroom environment introduces large noise to the experimental data, and the Gaussian filtering process can effectively suppress fluctuations and reduce the impact of noise, thus improving the localization performance.Figure 7
Data acquisition results.The gait detection algorithm is mainly used to complete the task of step counting, and this article uses the change law of acceleration to enter the judgment of step counting and makes simple improvements to the traditional wave detection algorithm, and analyzes it by experiment. The experimental site is chosen in the corridor on the third floor of the experimental first building, the corridor is about 50m, and two types of uniform linear and variable speed linear detection are used to conduct 10 experiments, respectively, and compare the results, as shown in Figure8.Figure 8
Uniform linear walking pedometer detection statistics.As can be seen from Figure8, the accuracy of the gait detection algorithm is relatively high. In the uniform linear way, the accuracy of the basic gait detection algorithm is basically above 90%, while in the variable speed linear motion way, the accuracy is often reduced relative to the uniform linear, and if the speed is larger, the error of the gait counting may be larger; while in the actual positioning process, the speed of the pedestrian is often uncertain. The gait detection algorithm often has certain shortcomings, and further improvements are needed for different motion states.Firstly, the composition of this indoor positioning system is introduced, and then the positioning server and the mobile client are introduced separately. The development platform and function design of the positioning server are firstly introduced in detail; then the client development platform is briefly introduced, and finally, the coding process of iBeacon signal acquisition and analysis is introduced in detail. The system implements the weighted mass center positioning algorithm, Kalman filter algorithm, and recursive average filter algorithm and, initially, completes the functions of iBeacon signal parsing, real-time positioning, positioning result optimization, and map display. In the actual positioning test in the parking lot, the overall operation of the system is stable and the positioning effect is good, achieving the expected results. The developed indoor positioning system has been deployed in the pilot application unit of the project in which the author participated. Now, iBeacon technology has amazing application cases in many places and some search sites; just type in iBeacon technology and a lot of related information can be found. The application of iBeacon technology has started, and a well-known company in the industry is playing a leading role.This article summarizes the latest scientific research results based on the study of relevant literature. To realize an indoor positioning system with low cost, high accuracy, and good reliability, and considering the actual situation, we propose an iBeacon indoor positioning method incorporating multiple filters and develop an indoor positioning system based on this method. At present, the system has been deployed in the pilot application unit of the author’s project, and the actual use shows that the method can improve the accuracy and reliability of the positioning system. Therefore, the research, improvement, and application of the iBeacon indoor positioning system are of certain value and significance in this article.


## 5. Conclusion

In this article, the mainstream and relatively mature indoor positioning technologies and indoor positioning algorithms are systematically introduced and compared, and the positioning technologies and algorithms applicable to this article are selected based on the summary analysis. The final experimental results show that the improved weighted center-of-mass positioning algorithm can still achieve high positioning accuracy when the deployment density of iBeacon devices is low, thus reducing the cost of implementing a high-precision indoor positioning system and increasing the practical application value of the system. Based on the fused multifilter iBeacon indoor positioning method proposed in this article, a low-cost, high accuracy, and reliable indoor positioning system is designed, developed, and experimentally verified in an indoor parking lot environment. The final experiment shows that the system can still achieve high positioning accuracy at low beacon node deployment density and after fusing the Kalman filtering algorithm and recursive averaging filtering algorithm. The integration of the Kalman filtering algorithm and recursive averaging filtering algorithm can suppress the jump of positioning results in the process of positioning so that the positioning continuity and reliability of the system can be greatly improved, which is of high practical value. Our results show an improvement of about 20.25% in communication distance and 5.62% in accuracy and high efficiency compared to other existing results.



---

*Source: 8475339-2021-05-07.xml*