iBeacon-based indoor positioning system: from theory to practical deployment

ABSTRACT


INTRODUCTION
In the forthcoming decade, indoor positioning will be an essential part of smart cities, where users and service providers can gain many advantages from the position information.It will be applied in various aspects such as robot navigation, indoor location tracking, emergency rescuing, business intelligence and analytics, experience improvement, health care, and other indoor location-based services.There are many technology were proposed to turn indoor positioning into reality such as wireless fidelity (Wi-Fi) [1], ultra-wide band (UWB) [2], radio frequency identification (RFID) [3], and so on.However, due to their high cost or less reliability, such technologies seem unsuitable for indoor localization.Therefore, Bluetooth low energy (BLE) have emerged as a new candidate to compensate for the old ones.With the release of the Bluetooth 4.0 standard in 2009, Bluetoothbased indoor positioning system (IPS) gained popularity.Since then, the standard's requirements have made it possible to use the technology for localization in more sophisticated ways by establishing a brand-new class of gadgets called "Bluetooth beacons".The development of iBeacon is an example.The new devices running on iBeacon protocol have the possibility to broadcast at predetermined intervals, which improves the hardware and the immunity to interference while greatly increasing the energy efficiency of the system compared to those that used the previous standards.Spachos and Plataniotis [4], the group of authors introduces an indoor localization system that helps to enhance the user experience in a museum.This study focuses on estimating the distance from the exhibits to the user's location, collecting useful analytics regarding each visit, and providing a recommendation to the users.The experiment results show that the BLE beacon is a promising solution for a smart interactive museum.Liu et al. [5] introduce a smart home control that includes five parts: web server, home gateway, smart terminal, smartphone app, and BLE beacons.The results show that the proposed system provides a good solution ISSN: 2088-8708  iBeacon-based indoor positioning system: from theory to practical deployment (Thai-Mai Dinh Thi) 5157 with appropriate accuracy, execution time, extensibility, and endurance.Chan et al. [6], for the first time, use iBeacon to support non-verbal students in special education.iBeacon in this study is utilized to display contextually related picture cards for the classroom via a unique identifier of the nearest detected beacon.Molina et al. [7] use Wi-Fi and BLE beacon for positioning in the airport.Khruahong et al. [8] posed a situation of needing to find lost property in an indoor environment using iBeacon.Chen et al. [9] designed a tracking and monitoring system for the child.The designed system used mobile iBeacon nodes for crowdsourced finding and static iBeacon nodes for indoor positioning.Chiu et al. [10] iBeacons were used to aid Wi-Fi indoor positioning.In this hybrid setup, Wi-Fi access points may create distinct large zones, and iBeacons can precisely pinpoint the user's location within an enclosed space.The findings demonstrate that the hybrid system developed may reach a certain degree of accuracy and may be a viable localization option for a mobile application.Lin et al. [11] introduce a iBeacon-based indoor positioning solution for patient.Their deployment strategy can be divided into three phases: preparatory, measure, and location identification.The first phase involves iBeacon calibration and device deployment.Meanwhile, the second and third phases involve collecting data and then indicating the user's location using a previous database.In addition, some systems that use BLE beacons include [12], [13].Thus, it can be seen that iBeacon has been used in many studies before.However, there is no research on how to build a practical iBeacon-based IPS.Ye et al. [14] is one of the few studies that identify the influencing factors when building an iBeacon-based IPS.However, this study is still very rudimentary.Hence, this work will provide a comprehensive insight into this problem.The rest of this paper is organized as follows.In section 2, we briefly introduce iBeacon protocol and methods of positioning using received signal strength (RSS) from iBeacon.We present a comprehensive guideline for IPS providers and developers who want to deploy a practical IPS in section 3, including hardware deployment in subsection 3.1 and software deployment in subsection 3.2.Section 4 introduces an indoor application and evaluates the accuracy of the proposed system.Ultimately, section 5 concludes this work.

INDOOR POSITIONING WITH iBeacon AND RSS MEASUREMENT 2.1. iBeacon protocol
Apple unveiled the Bluetooth communication protocol known as iBeacon in 2013.When a device emitting iBeacon is nearby (commonly those devices are called beacons), the beacon allows smartphones, tablets, and other devices to know its (relative) location.As its name implies, an iBeacon device acts as a lighthouse.Instead of emitting light to provide navigation for ships, iBeacon devices broadcasts BLE signals to let smartphones know their location.Its signal contains four pieces of information which are: − Unique universal identifier (UUID): general information, refers to the name of organization that is using it.− Major: segment of UUID, refers to the beacon's general location.For example, this beacon is located in the building #1.− Minor: smaller subsegment, refers to beacon's detailed location.For example, this beacon is located in floor 5. − Tx-Power: refers to RSS.

Indoor positioning with RSS measurement from BLE iBeacon
By the method employed for localization, systems that use RSS from BLE iBeacons can be divided into two groups: i) techniques based on distance and ii) techniques based on fingerprints (FP).In distancebased techniques, one should gain distance information from the well-known propagation model (1), where RSS( 0 ) and RSS(  ) are the received signal strength at the reference distance  0 = 1 m and   , respectively. is path loss exponent and  is Gaussian noise with zero mean.The distance between target and the i -th iBeacon node can be expressed as (2).
After having distance from at least 3 beacons, we can estimate the target's position through lateralbased or least square method.This approach has the benefit of being straightforward and requiring less effort for site surveying and maintaining.However, it offers a low level of precision.Meanwhile, fingerprinting approach is a two-part method that consists of an offline phase and an online phase.Site surveying, which involves sampling the region of interest's fingerprints at predetermined reference points (RPs), is carried out during the offline phase.Smartphone sensors normally are used to obtain fingerprints.A database is used to Int J Elec & Comp Eng, Vol. 13, No. 5, October 2023: 5156-5164 5158 store the sampled fingerprints and the coordinates that go with them.After that, the data is utilized to train by machine learning algorithm to discover the optimal function for mapping the sampled fingerprints to their accurate coordinates.Following that, during the online phase, the learned function is utilized to infer a user's coordinates from the measured fingerprints at the user's position.This method is widely used because its stability and high precision.However, its drawback is time-consuming.

PROPOSED SYSTEM IMPLEMENTATION OF iBeacon AS INDOOR POSITIONING SYSTEM 3.1. Hardware deployment 3.1.1. Deployment of beacon ID
We can understand this relationship by (3).
In practical applications, the signal needs to be read and converted into relevant information by smartphone applications.Hierarchically, the UUID value can be used to differentiate an organization's iBeacon from others, the major value is used for specification of any iBeacon within a group, and the minor value is for identifying a particular iBeacon [15].An iBeacon implementation example is provided by Apple in [16].In this article, the author uses the UUID to differentiate the product of a company from others, this parameter is shared by all locations.Major is used for distinguishing products in a specific area from others.And minor is used to differentiate the product type in the exact location.Considering a large-scale case, i.e., many companies and organizations/corporations want to implement an indoor positioning system using iBeacon, the deployment in terms of identification value should be: i) use the UUID to differentiate buildings managed by an organization/corporation, ii) use the major number to distinguish floors in a building, and iii) using minor numbers to distinguish rooms/areas in a floor.For resource-saving and efficient management, the major assigned to the floors from the building to the building should be the same, while the minor is optional.Moreover, the homogeneous selection of the major number allows positioning both in 2-dimensional space and 3-dimensional space by mapping from major to the floors' numerical order.Suppose we need to deploy several iBeacon for two buildings of company A, namely CT1 and CT2.CT1 and CT2 consist of 2 and 3 floors, respectively.Each floor in a building need three iBeacons.Then, the implementation strategy is given by Table 1.

iBeacon hardware placement
The study in [17] introduces a novel iBeacon placement strategy called crystal placement (CiP).By placing the iBeacons into an equilateral triangle, CiP allows the mobile device to hear the maximum number of beacons in the environment, thereby increasing positioning accuracy.We would agree with them that desired height should be greater than 175 cm.But we would argue that CiP is only optimal for the weighted centroid localization algorithm and not for others.Another research [18] also recommended placing beacons in the shape of equilateral triangles with an optimal distance between two adjacent beacons is 3√3 meter instead of 5159 50 m as [17] suggest.This strategy ensures the number of beacons that need to be deployed is the smallest and also provides the highest accuracy for the fusion of multilateration and pedestrian dead reckoning (PDR).In general, geometry-based methods recommend placing beacons in the form of an equilateral triangle [18], [19].
With FP, it is not necessary to set beacons to equilateral triangles.An environment-dependent beacon placement strategy would be better than CiP.Basically, indoor environments are divided into two categories: corridors and open spaces.Among them, for perceived objects such as humans, the effort to locate and navigate the object in the aisles is less than in the open space.Therefore, the number of beacons needed to deploy and the positioning algorithm for these two areas may be different for optimizing the system's cost.

Software deployment 3.2.1. Ontology and functionality
In this section, we will cover the implementation of the application on both Android and iOS platforms.Since we want to build an application with convenience like Google Maps, we use Google Map Software Development Kit (SDK) as a reference for both Android [20] and iOS [21] operating systems.The Google Map SDK provides us with many resources for building navigation applications.Any positioning system, regardless of the environment being applied: Outdoor or Indoor, should contain two main functions: positioning and navigation.In which positioning task involve finding and showing on display the current user's location.Meanwhile, the navigation part engages the task of finding the shortest path from the current location to a destination being approached.Applications on Android or iOS should work with modules given by Figure 1.
The ontology should include tables as listed in Figure 2. As mentioned above, buildings have a primary ID which is the of each iBeacon.In a building system with many floors, each floor is assigned an ID that is the Major number of iBeacon.Similarly, rooms on a floor will be assigned with the minor number, which is a subset of the Major.With the analysis of the iBeacon packet on the user's device, it is possible to determine the user's location at the corresponding building, floor, and room.Next, we need a dependence table to specify the relationship between nodes (or reference point or location where offline RSSs are collected).The start-id, and target-id fields are the start/current and destination locations in the algorithm, respectively.The distance field is the non-negative physical distance between nodes.The location table contains the connected nodes and FP data.

Positioning
There are two main options for positioning algorithm: i) range-based algorithm like trilateration or least square and ii) range-free algorithm like FP.It seems fair to say that FP is the method that has many advantages.Firstly, FP deals with the heterogeneity of indoor environments better than range-based algorithms.Secondly, FP works well when the position of the beacons is linear.The main idea of FP is to use big data to describe physical positions using RSSI in the interested indoor area.The fingerprint's first step is to build a socalled a radio map, which collects RSS data for all RP and stores it in a database.The user's position, in the second step, is then estimated by comparing on-the-fly RSS and pre-collected radio map using a matching algorithm.Figure 3 shows a visual representation of how fingerprinting works.Matching algorithms may be deterministic or probabilistic.However, deterministic is more widely used.In deterministic form, one or several RP are found that best match with recorded fingerprints.The matching mathematically tries to solve the (4).
in which,   is RSS form i -th beacon in online positioning phase and   (x  ) are RSS of i -th beacon at j -th RP.Algorithms of this type include K-nearest neighbors (KNN), weighted KNN (WKNN).Although we have better methods like neural network (NN) [22] or support vector machine (SVM) [22] but when compared to these methods KNN provide adequate positioning accuracy with lower computational cost [23].Hence, KNN is chosen as matching algorithm in this study.Assume that an interested area is deployed with M beacons and can be divided into L locations.Each grid point has a physical coordinate (x l , y l ) and includes N fingerprint points.Offline fingerprint vector can be expressed by (5).
However, KNN only use Euclidean distance that cannot accurately reflect the difference of signal propagation.
As we can show in [18] that the larger the RSS value the smaller the uncertainty, so we add a weight equals to invert of current RSS to have a better estimation.

Coordinating
One tricky problem when using Google Map SDK is that this kit only supports programmers developing outdoor navigation applications.When applying for indoor positioning, we first have to correctly attach the indoor floor's plan to a geographic coordinate to be positioned.Then, the floor's plan must be rotated by an angle equal to the building's orientation.Finally, a step is taken to convert the Cartesian (local) coordinate system with the optional origin to the geographic coordinate system, i.e., latitude and longitude.For example, in our case, latitude, γ, is calculated from (, ) in the Cartesian system (7), where ,  and  stand for the origin of the indoor floor's plan latitude, the scale depends on building's size, and the building's orientation, respectively.

Navigation
In order to add a path-finding function to the system, we use a graph-based approach.In this approach, we consider the indoor area's map as a graph.The graph contains a number of reference nodes, which are numbered from 1 to 16, as described in Figure 4(a).Each node represents a location on the map.Nodes are connected to each other, depending on whether there is an obstacle between two nodes.Each node has the following properties in the location table in Figure 2. The link (connection) between two nodes is also assigned a cost, which is used to compute the best path from one node to another.This cost is the Euclidean distance of two connected nodes.Then, having a graph of nodes, depend on type of operation system, we use GKGraph [24] (A-star-based) in GameplayKit framework for iOS or GraphBuilder [25] (Dijkstra-based) class in Hipster library for Android.The framework/library provides a function to find the path with the lowest cost, given a starting node (the user's current location) and an ending node (the destination).For example, assume that we have 3 points A, B, C with AB=3, AC=4, BC=5, respectively, we use the GraphBuilder class (Android) or GKGraph class (iOS) to connect the vertices and edges.The code snippet is described in Figure 4

. Indoor localization application
We have built a sample application for the test.Figure 5 shows some screenshots of indoor navigation applications.The application was developed for indoor positioning and navigation purposes and applied to the G2 building, University of Engineering and Technology, Vietnam National University.With a simple interface and easy-to-use operation, the application is able to provide the location service with relative accuracy.The main functions of the application on both iOS and Android platforms include: − Indoor map view: The application displays information about the map based on the location data of Google Map.When the user launches the application from the home screen, information about the indoor floor's plan is displayed.Since we use Google Map SDK for indoor map view purposes, we set the initial view at When the user enters the search box, the application suggests rooms related to the imported content.Once the user clicks on a recommended room, the application will deliver relevant information about that room, including the location and its description.The app then offers directions from the user's location to the searched room.
When the user clicks on the get directions/go button, the application will display the route (red line) from the user's location to the location of the searched room.When the user changes location but is still in the process of receiving navigation information, the paths on the map automatically update according to the user's location in real-time.
Figure 5. Screenshot of indoor positioning application in iOS platform.The app can be found at [26].
Another Android version can be found at [27] 4.2.The accuracy of our system 4.2.1.Experimental setup To evaluate the system's performance, we integrate the system into an iOS app running on iPhone.The experiment is conducted on the 1st floor of the G2 building of the University of Engineering and Technology.The tested area is 30×11 m.Eight Estimote iBeacons are placed around the area, each placed at the height of 1.8 m.The beacons' position is shown in Figure 4(a).All beacons are set to the same configuration, with broadcasting power and advertising interval being 0 dBm and 100 milliseconds, respectively.The radio map is built by collecting real data in the lobby, as shown in Figure 4(a).This map is divided into small square area with a 1-meter edge.We follow the setup described in Figure 6 to assess the localization accuracy of the proposed system.A total of two experiments were performed.In which, the KNN and WKNN algorithms are considered in two conditions: i) only using raw RSS and ii) applying a Kalman filter on raw RSS.

Experiment results
Figure 7 shows the positioning errors of the proposed method without Kalman filter in Figure 7(a) and after noise removal using Kalman filter in Figure 7(b).As can be seen, WKNN does better than KNN in both cases.It is reasonable because WKNN utilizes more information than KNN, resulting in higher accuracy.In case 1, WKNN and KNN have the same performance, i.e., 1.6 m error in terms of the median.Also, in this case, WKNN, however, has better performance than KNN in terms of average error, i.e., 1.78 m compared to 1.9 m.In addition, the variance of WKNN is also lower than KNN.It is because WKNN uses a weight for each calculation from the online to the offline vector, which is equivalent to a regulatory factor of the output position.We can see a similar trend in case 2. In this case, WKNN does better than KNN in both terms of median and average.The median and average error of WKNN and KNN is 1.18, 1.34, 1.24, and 1.39 m, respectively.WKNN and KNN in case 2 outperforms 25% and 16% WKNN and KNN in case 1, respectively.The variance in case 2 of both algorithms is also smaller than case 1.It indicates that noisy RSS can affect positioning results.Hence, it is recommended to apply filtering on raw RSS before feeding them into the matching algorithm.

CONCLUSION
This paper presents a framework that allows a service provider or programmer to build an indoor navigation system using iBeacon with available resources such as a smartphone or Google Maps SDK.The various problems are included for indoor positioning and navigation, such as hardware and software deployment for both Android and iOS.Besides, we also took into account the positioning accuracy by conducting two experiments related to the KNN algorithm as an estimator of the fingerprinting method.As the obtained results, it is recommended to use WKNN and filter on raw RSS.The procedure is partially extensible for other technologies, not only iBeacon but also Wi-Fi, RFID, UWB, or 5G system.

Figure 4 .
Figure 4.An example of how nodes are connected (a) under visual perspective and (b) by code


ISSN: 2088-8708 Int J Elec & Comp Eng, Vol. 13, No. 5, October 2023: 5156-5164 5162 maximum zoom by default.Users can manipulate the map displayed on the screen through swiping and interactive gestures such as zoom in, zoom out, or rotating the indoor map.− Positioning function: When signals from at least three iBeacon devices are available, the application matches the online RSSs with the radio map and delivers the user's location.This location is then marked directly on the map with a marker.When the user changes their position, the marker on the map changes according to the user's location as well.− Navigation function: The navigation function was designed with a search bar or picker.When the user touches the search box, it automatically displays a floating menu of all rooms.