# Improving Indoor Localization Using Bluetooth Low Energy Beacons

Authors: Pavel Kriz; Filip Maly; Tomas Kozel
Journal: Mobile Information Systems
 (2016)

---

## Abstract

The paper describes basic principles of a radio-based indoor localization and focuses on the improvement of its results with the aid of a new Bluetooth Low Energy technology. The advantage of this technology lies in its support by contemporary mobile devices, especially by smartphones and tablets. We have implemented a distributed system for collecting radio fingerprints by mobile devices with the Android operating system. This system enables volunteers to create radio-maps and update them continuously. New Bluetooth Low Energy transmitters (Apple uses its “iBeacon” brand name for these devices) have been installed on the floor of the building in addition to existing WiFi access points. The localization of stationary objects based on WiFi, Bluetooth Low Energy, and their combination has been evaluated using the data measured during the experiment in the building. Several configurations of the transmitters’ arrangement, several ways of combination of the data from both technologies, and other parameters influencing the accuracy of the stationary localization have been tested.


---

## Body

## 1. Introduction

Nowadays, when satellite navigation systems such as GPS, GLONASS, or Galileo are available for everyone, it is usually not a problem to locate a person or a mobile device outside. A situation can get more complicated in high-density urban areas with rare line-of-sight to the satellites of the corresponding system. The situation is most complicated inside buildings with no line-of-sight. In such cases, other solutions are employed, usually those based on radio networks (e.g., IEEE 802.11-WiFi) and fingerprints of signal strengths of individual WiFi devices which transmit their signals inside a building [1]. Localization accuracy is influenced by a number of circumstances, for example, by characteristics of transmitters and receivers and characteristics of the environment which influence the radio signal propagation. Another factor which can be adjusted quite easily is the number of radio transmitters and their positions. A typical situation is that there already are some WiFi access points in the building which more or less cover the building with the radio signal which can be used for localization. To increase the accuracy of the localization, it is possible to install more transmitters which would enrich the individual fingerprints or cover the places which are poorly covered by the existing WiFi network.In this paper, we will deal with the Bluetooth Low Energy (BLE) technology which can be a very good alternative supplementing WiFi access points. Their combination will allow more accurate localization. The key advantage of BLE comprises low energy consumption which allows the transmitters—called beacons—to be powered continuously from batteries from months to years. This also makes it possible to place the beacons in the spots where WiFi access points would be difficult to power.The rest of this paper is organized as follows. We discuss related work in Section2. Section 3 describes the technology of BLE beacons (iBeacons) and deals with support of Bluetooth Low Energy with the Google Android platform. Section 4 summarizes the use of BLE beacons in indoor navigation. Section 5 describes the architecture of our indoor localization system based on BLE beacons and the localization method. Section 6 is focused on the arrangement of BLE beacons inside the building. Section 7 describes the results of the evaluation. In Section 8, we summarize, discuss, and interpret the achieved results. Section 9 concludes the paper.


## 2. Related Work

Methods of indoor localization are usually based on monitoring the radio signal strength, the so-called Received Signal Strength Indicator (RSSI). The radio signals are broadcasted by transmitters (usually WiFi access points, but, e.g., Bluetooth Low Energy beacons are also an option) covering a particular area. With the growing distance from the transmitter, the received signal strength decreases and the travel time from the transmitter to the receiver increases. When we measure these values from more transmitters we are able to estimate a position of the receiver. Two basic approaches are being used—triangulation andfingerprinting.


### 2.1. Triangulation

Methods based on triangulation can be further divided intolateration andangulation [2]. These methods use estimation of the distance from several transmitters based on signal attenuation [3], time characteristics of the signal propagation (TOA: Time Of Arrival [4]; TDOA: Time Difference of Arrival [5]), or the direction of the received signal (AOA: Angle of Arrival [6]) when using directional antennas or antenna arrays. All these methods achieve good performance in an open space with line-of-sight propagation between the transmitter and the receiver. Unfortunately, they have weak results inside buildings where the measured variables are highly influenced by the environment. The radio signal may be reflected and attenuated by several obstacles such as walls making the estimation of distance more difficult.


### 2.2. Fingerprinting

Fingerprinting is a localization method comprising two phases. In the first phase—learning—vectors composed of the RSSI values and optional extra features measured by a measuring device in the known locations are collected [7]. These reference values—thecalibrated dataset—are saved together with the location coordinates into the fingerprint database for the needs of localization. In the second phase—localization itself—the device to be localized measures the RSSI values and compares them with the data in the fingerprint database using a suitable method. The most widely used algorithms or methods of comparison and estimation of the position are [2](i)
probabilistic methods,(ii)
k-Nearest Neighbors,(iii)
neural networks,(iv)
support vector machine,(v)
smallest M-vertex polygon.Concrete solutions based on collection of fingerprints are described by Bahl and Padmanabhan [8] or Azizyan et al. [9] who collect other features during the measurement, such as sound intensity, acceleration, light intensity, or color of the light. Wu et al. [10] bring an interesting approach which assumes similarity between the so-called virtual and physical model of the interior. It automates the initial phase of learning based on clustering of the fingerprints. Then, the virtual rooms are mapped to the physical rooms.Localization accuracy can be increased if the movement of localized objects is considered. Such methods utilise the history of previous measurements and estimate the position based on the known previous trajectory of the object. Other solutions use dead reckoning method based on collection of data from movement and orientation sensors of a mobile device (like accelerometer, gyroscope, and magnetometer). This way, the direction of movement and the distance traveled could be determined and combined with other measurements and/or estimations. Particle filters are often incorporated in the process of gathering such estimations. Particular examples of these methods were published in [11, 12].Another approach is presented by the Ubicarse project [13] where the emulation of a large antenna array is used for localization purposes on a tablet device with two MIMO antennas. Note that there is no public API that could read RSSI from multiple MIMO chains in high speed at the Android platform.


### 2.3. Bluetooth-Based Localization

Bluetooth-based indoor localization is not a novel idea [14, 15]. Due to the limitation of the original Bluetooth specification (now calledBluetooth Classic), this approach has not been widely used. The time required for obtaining a sufficient number of nearby Bluetooth devices was not satisfactory due to the lengthy process of discovery. Likewise, energy and economic demands of Bluetooth infrastructure were high compared to WiFi-based infrastructure, which also served other purposes.The situation changed with the advent of Bluetooth 4.0 (including BLE/Bluetooth Smart) in 2010. Due to low energy consumption and configuration options (regarding the advertising interval and the transmitter output power), the utilisation of this technology is much more promising, not only in comparison with previous versions of Bluetooth, but also in comparison with today’s widespread WiFi-positioning. In [16], the authors focus on proximity estimation based on signal strength. Furthermore, [17] directly compares the BLE-based localization to the WiFi-localization by deploying BLE beacons at the same spots where WiFi access points were originally placed. The results show that BLE is more accurate at identical places than WiFi.In this paper, we focus on an appropriate combination of both technologies rather than on their direct comparison. We deploy additional BLE beacons in order to improve the localization accuracy while utilising both technologies at the same time.


## 2.1. Triangulation

Methods based on triangulation can be further divided intolateration andangulation [2]. These methods use estimation of the distance from several transmitters based on signal attenuation [3], time characteristics of the signal propagation (TOA: Time Of Arrival [4]; TDOA: Time Difference of Arrival [5]), or the direction of the received signal (AOA: Angle of Arrival [6]) when using directional antennas or antenna arrays. All these methods achieve good performance in an open space with line-of-sight propagation between the transmitter and the receiver. Unfortunately, they have weak results inside buildings where the measured variables are highly influenced by the environment. The radio signal may be reflected and attenuated by several obstacles such as walls making the estimation of distance more difficult.


## 2.2. Fingerprinting

Fingerprinting is a localization method comprising two phases. In the first phase—learning—vectors composed of the RSSI values and optional extra features measured by a measuring device in the known locations are collected [7]. These reference values—thecalibrated dataset—are saved together with the location coordinates into the fingerprint database for the needs of localization. In the second phase—localization itself—the device to be localized measures the RSSI values and compares them with the data in the fingerprint database using a suitable method. The most widely used algorithms or methods of comparison and estimation of the position are [2](i)
probabilistic methods,(ii)
k-Nearest Neighbors,(iii)
neural networks,(iv)
support vector machine,(v)
smallest M-vertex polygon.Concrete solutions based on collection of fingerprints are described by Bahl and Padmanabhan [8] or Azizyan et al. [9] who collect other features during the measurement, such as sound intensity, acceleration, light intensity, or color of the light. Wu et al. [10] bring an interesting approach which assumes similarity between the so-called virtual and physical model of the interior. It automates the initial phase of learning based on clustering of the fingerprints. Then, the virtual rooms are mapped to the physical rooms.Localization accuracy can be increased if the movement of localized objects is considered. Such methods utilise the history of previous measurements and estimate the position based on the known previous trajectory of the object. Other solutions use dead reckoning method based on collection of data from movement and orientation sensors of a mobile device (like accelerometer, gyroscope, and magnetometer). This way, the direction of movement and the distance traveled could be determined and combined with other measurements and/or estimations. Particle filters are often incorporated in the process of gathering such estimations. Particular examples of these methods were published in [11, 12].Another approach is presented by the Ubicarse project [13] where the emulation of a large antenna array is used for localization purposes on a tablet device with two MIMO antennas. Note that there is no public API that could read RSSI from multiple MIMO chains in high speed at the Android platform.


## 2.3. Bluetooth-Based Localization

Bluetooth-based indoor localization is not a novel idea [14, 15]. Due to the limitation of the original Bluetooth specification (now calledBluetooth Classic), this approach has not been widely used. The time required for obtaining a sufficient number of nearby Bluetooth devices was not satisfactory due to the lengthy process of discovery. Likewise, energy and economic demands of Bluetooth infrastructure were high compared to WiFi-based infrastructure, which also served other purposes.The situation changed with the advent of Bluetooth 4.0 (including BLE/Bluetooth Smart) in 2010. Due to low energy consumption and configuration options (regarding the advertising interval and the transmitter output power), the utilisation of this technology is much more promising, not only in comparison with previous versions of Bluetooth, but also in comparison with today’s widespread WiFi-positioning. In [16], the authors focus on proximity estimation based on signal strength. Furthermore, [17] directly compares the BLE-based localization to the WiFi-localization by deploying BLE beacons at the same spots where WiFi access points were originally placed. The results show that BLE is more accurate at identical places than WiFi.In this paper, we focus on an appropriate combination of both technologies rather than on their direct comparison. We deploy additional BLE beacons in order to improve the localization accuracy while utilising both technologies at the same time.


## 3. iBeacon Technology

iBeacon is Apple’s brand name of the technology based on the microlocalization and the interaction of a mobile device in the physical world. This technology can be considered to be the next development stage of the QR code technology or, alternatively, the NFC technology. iBeacon uses the Bluetooth Low Energy standard which is a part of a new version of Bluetooth 4.0. Sometimes, the terms Bluetooth Smart, Bluetooth LE, BTLE, and just BLE are used. It is a technology developed by Nokia (originally, the technology was named Wibree; in 2010 BLE was standardized) and in contrast to the previous versions of Bluetooth, dramatically lower consumption is typical for BLE [18, 19]. Also the way how the (peripheral) device announces its existence to the other devices is the opposite from how it is in the original Bluetooth Classic. BLE enables a peripheral device to transmit anadvertisement packet without beingpaged by the master (central) device. Thanks to this communication model, it is possible to construct energy-efficient transmitters—BLE beacons or iBeacons according to Apple.iBeacon is a small device which transmits particular information in a defined radius and in regular intervals. As soon as a mobile device (a smartphone) gets within this radius, it can receive such information and, based on this, it can perform an action. Considering low consumption of BLE, such a device can be powered by a coin battery for up to two years. Of course, the battery life depends on the transmitter output power (TX power) and advertising interval settings.The iBeacon technology is going to be adopted by shop marketers. A visitor with a BLE-enabled smartphone may be notified of special offers, discounts, information, and so forth based on his/her position or proximity to a beacon. It finds similar use in museums and exhibition halls.


### 3.1. Hardware Solution

BLE beacons are devices made by Estimote, Kontakt, Gimbal, and other manufacturers [20]. A beacon consists of a Bluetooth chipset (including its firmware), a battery providing power supply, and an antenna. Texas Instruments, Nordic Semiconductor, Bluegiga, and Qualcomm are the main current producers of the BLE chips.We have used beacons made by Estimote in our project. Estimote beacons can be attached to any location or object. They broadcast BLE radio signals which can be received and interpreted by a smartphone, unlocking microlocation and contextual awareness. To be able to listen to these beacons, it is necessary to have a device that supports Bluetooth 4.0 or higher. The Estimote beacon contains an nRF51822 chip, a powerful, highly flexible multiprotocol System-on-a-Chip (SoC). The nRF51822 is built around a 32-bit ARM® Cortex™ M0 CPU with 256 kB/128 kB flash + 32 kB/16 kB RAM [21]. The whole SoC is highly optimized to be energy-efficient. Thus the stable TX power of the beacon is ensured while the battery voltage may drop. When the voltage finally drops from 3 V to 1.7 V, a brown-out reset is generated and the device stops broadcasting [21]. In its basic mode, a beacon simply transmits Bluetooth packets with identification data—so-called advertisements—in regular intervals. It does not communicate with the surrounding devices by any other sophisticated way. Advertisements contain the following data:(i)
MAC address.(ii)
Universally unique identifier (UUID)—common for a single deployment at a venue.(iii)
Major number—designated for dividing the beacon sets into smaller segments.(iv)
Minor number—designated for dividing the segments into smaller subsegments.In the configuration mode, beacon’s broadcasting parameters (which include the above stated data transmitted in a packet and other parameters such as the TX power or the advertising interval) can be configured. In the configuration mode, beacons use advanced bidirectional communication with a master device (e.g., a smartphone) with the aid of which they are configured.At a physical layer, BLE transmits in the 2.4 GHz industrial, scientific, and medical (ISM) band with 40 channels each 2.0 MHz wide. 37 channels are used to exchange the data among paired devices and 3 channels are designated for broadcasting advertisements. These 3 channels are thus primarily used by beacons and are chosen deliberately so that they collide with the WiFi channels as little as possible. The beacon broadcasts its advertisement packet repetitively based on the selected advertising interval while hopping over the 3 designated channels [18].


### 3.2. Android Support for BLE

Android platform was chosen for testing the whole solution because it is the most widely used operating system for smartphones.Android offers BLE support from version 4.3 (API level 18). From version 5.0 (API level 21) the BLE-related API had been revised and extracted to a separateandroid.bluetooth.le package. The applications have to be granted both BLUETOOTH and BLUETOOTH_ADMIN system permissions to use BLE API. API level 18 supports communication with BLE peripheral devices only—that is, scanning devices, enumerating device’s services, and sending or receiving the data to or from such devices. API level 21 further opens the possibility for a smartphone or a tablet (depending on hardware support) to act as a Bluetooth Low Energy peripheral device, that is, to advertise itself as a BLE device and to offer services to other devices.The most important function for BLE indoor localization is scanning of the available BLE devices in the neighborhood. For this purpose, API level 18 offersstartLeScan() and stopLeScan() methods of the BluetoothManager class. The scanning process is asynchronous and every device found is reported to an instance of the LeScanCallback callback class. The scanned device is represented by the BluetoothDevice class which includes its MAC address, byte-array scan record (containing UUID, etc.), and RSSI. API level 21 moves the process of low energy scanning into the separate BluetoothLeScanner class. Its instance is obtained by calling the getBluetoothLeScanner() method of the BluetoothAdapter class. In contrast to API level 18, it is possible to specify even more detailed parameters of scanning. Unfortunately, implementation of the above mentioned classes and underlying system libraries can vary across different vendors. The most common issue is that BLE devices are not reported repeatedly during the scanning process which is a condition necessary for localization. For this reason it is necessary to implement a mechanism which starts and stops scanning repeatedly in a given time interval. It is also possible to use available libraries, for example, Android Beacon Library (https://github.com/AltBeacon/android-beacon-library/), which provides CycledLeScanner class that encapsulates this mechanism.


## 3.1. Hardware Solution

BLE beacons are devices made by Estimote, Kontakt, Gimbal, and other manufacturers [20]. A beacon consists of a Bluetooth chipset (including its firmware), a battery providing power supply, and an antenna. Texas Instruments, Nordic Semiconductor, Bluegiga, and Qualcomm are the main current producers of the BLE chips.We have used beacons made by Estimote in our project. Estimote beacons can be attached to any location or object. They broadcast BLE radio signals which can be received and interpreted by a smartphone, unlocking microlocation and contextual awareness. To be able to listen to these beacons, it is necessary to have a device that supports Bluetooth 4.0 or higher. The Estimote beacon contains an nRF51822 chip, a powerful, highly flexible multiprotocol System-on-a-Chip (SoC). The nRF51822 is built around a 32-bit ARM® Cortex™ M0 CPU with 256 kB/128 kB flash + 32 kB/16 kB RAM [21]. The whole SoC is highly optimized to be energy-efficient. Thus the stable TX power of the beacon is ensured while the battery voltage may drop. When the voltage finally drops from 3 V to 1.7 V, a brown-out reset is generated and the device stops broadcasting [21]. In its basic mode, a beacon simply transmits Bluetooth packets with identification data—so-called advertisements—in regular intervals. It does not communicate with the surrounding devices by any other sophisticated way. Advertisements contain the following data:(i)
MAC address.(ii)
Universally unique identifier (UUID)—common for a single deployment at a venue.(iii)
Major number—designated for dividing the beacon sets into smaller segments.(iv)
Minor number—designated for dividing the segments into smaller subsegments.In the configuration mode, beacon’s broadcasting parameters (which include the above stated data transmitted in a packet and other parameters such as the TX power or the advertising interval) can be configured. In the configuration mode, beacons use advanced bidirectional communication with a master device (e.g., a smartphone) with the aid of which they are configured.At a physical layer, BLE transmits in the 2.4 GHz industrial, scientific, and medical (ISM) band with 40 channels each 2.0 MHz wide. 37 channels are used to exchange the data among paired devices and 3 channels are designated for broadcasting advertisements. These 3 channels are thus primarily used by beacons and are chosen deliberately so that they collide with the WiFi channels as little as possible. The beacon broadcasts its advertisement packet repetitively based on the selected advertising interval while hopping over the 3 designated channels [18].


## 3.2. Android Support for BLE

Android platform was chosen for testing the whole solution because it is the most widely used operating system for smartphones.Android offers BLE support from version 4.3 (API level 18). From version 5.0 (API level 21) the BLE-related API had been revised and extracted to a separateandroid.bluetooth.le package. The applications have to be granted both BLUETOOTH and BLUETOOTH_ADMIN system permissions to use BLE API. API level 18 supports communication with BLE peripheral devices only—that is, scanning devices, enumerating device’s services, and sending or receiving the data to or from such devices. API level 21 further opens the possibility for a smartphone or a tablet (depending on hardware support) to act as a Bluetooth Low Energy peripheral device, that is, to advertise itself as a BLE device and to offer services to other devices.The most important function for BLE indoor localization is scanning of the available BLE devices in the neighborhood. For this purpose, API level 18 offersstartLeScan() and stopLeScan() methods of the BluetoothManager class. The scanning process is asynchronous and every device found is reported to an instance of the LeScanCallback callback class. The scanned device is represented by the BluetoothDevice class which includes its MAC address, byte-array scan record (containing UUID, etc.), and RSSI. API level 21 moves the process of low energy scanning into the separate BluetoothLeScanner class. Its instance is obtained by calling the getBluetoothLeScanner() method of the BluetoothAdapter class. In contrast to API level 18, it is possible to specify even more detailed parameters of scanning. Unfortunately, implementation of the above mentioned classes and underlying system libraries can vary across different vendors. The most common issue is that BLE devices are not reported repeatedly during the scanning process which is a condition necessary for localization. For this reason it is necessary to implement a mechanism which starts and stops scanning repeatedly in a given time interval. It is also possible to use available libraries, for example, Android Beacon Library (https://github.com/AltBeacon/android-beacon-library/), which provides CycledLeScanner class that encapsulates this mechanism.


## 4. Utilising BLE in Indoor Localization

WiFi networks are commonly being used for localization inside buildings. A building is usually a complicated system regarding WiFi signal propagation due to the materials used. That is why areas with no WiFi signal may appear in the buildings despite high concentration of efficient WiFi access points. In such areas it is not possible to collect fingerprints because they would contain no signals measured from the surrounding WiFi networks. These areas can additionally be covered by other transmitters. For this purpose, BLE beacons can be used. They transmit a Bluetooth signal instead of a WiFi signal. While powered by batteries, they can be placed in less accessible places where there are no power sockets or other forms of supply, such as ethernet cables, allowing to use power-over-ethernet. When placing the beacons it is necessary to care about the radiation pattern of a given device and also about possible attenuation elements in the environment. Reference [22] deals with this topic in detail.Due to the low price of beacons, their small size, and independence of an external power supply (no additional cables required), they seem to be suitable supplements to an existing WiFi network in a building. Areas covered with weak WiFi signal or with a small number of WiFi transmitters contained in one fingerprint can thus be enriched by new BLE transmitters. Then, the fingerprint can also contain the measured RSSIs of these BLE devices in addition to the RSSIs of WiFi signals.Beacons have another advantage: thanks to support by mobile operating systems, they can be used for energy-efficient geofencing enabling a mobile application to be activated based on approaching an iBeacon by a smartphone. The whole process at the iOS platform does not require the application to be active and thanks to this it is possible to optimize it so the energy consumption of the mobile device is minimized and the endurance of the battery is maximized. Estimote has also established a new term in this field—nearables—for their BLE beacons equipped with additional sensors.


## 5. Methods and Architecture

Our goal is to evaluate an improvement in the localization using BLE beacons. In this paper, we are going to compare WiFi-based stationary localization with a stationary localization using combination of BLE and WiFi. We suggested and performed an experiment where the original WiFi access points and additionally deployed BLE beacons were used for localization of a stationary device. As a suitable localization method, we used a method based on collecting fingerprints composed of measured signals of WiFi access points and BLE transmitters.


### 5.1. Learning Data Acquisition

Smartphones were used to acquire the learning data and the state of their sensors (accelerometer, compass, and gyroscope) was also recorded for future processing. Volunteers used their smartphones with a digitized map of a building to acquire the learning dataset. A smartphone scans signals of all available networks and beacons around and the user creates the fingerprint of the given place with the aid of our application. The application records strengths of individual signals in a given place for 10 seconds (which should be a sufficient time [23]). A fingerprint created in this way is recorded into the fingerprint database. The rest of the system is described in Section 5.3.


### 5.2. Positioning Method

The localization inside a building is done using collection of more fingerprints but these are not necessarily recorded in a database. The user who wishes to be localized measures a fingerprint of a place where he/she is using an application in his/her smartphone. This fingerprint is then compared with all fingerprints in the database and one or more fingerprints withthe highest similarity are searched. The fingerprints in the database are tagged with corresponding positions inside the building. The accuracy of the localization depends on factors such as the quality of fingerprints saved in the database (especially radio interference and the accuracy of the determination of the place where the tagged fingerprint was acquired) and the algorithms used for calculation of a similarity of the tagged fingerprint in the database with the measured untagged fingerprint.To compare the measured fingerprint with the database, thek-Nearest Neighbors (k-NN) in Signal Space method was used. This method tries to find k of the nearest fingerprints from the database by means of, for example, Euclidean distance. In this way we get k locations and by their combinations we estimate the position of the device to be localized. The Euclidean distance of the measured vector of the fingerprint m=(m1,m2,…,mn) from the ith fingerprint Si=(si1,si2,…,sin) in the database can be expressed by the following formula:(1)Di=∑j=1Nmj-sij2,where N is a number of unique transmitters in the measurement.After sorting the tagged fingerprints according to the distancesDi from the measured fingerprint, the first k fingerprints are chosen. From their known positions Pi[xi,yi] the weighted estimate of a position P of the measured fingerprint is calculated according to the following formula:(2)P=∑i=1kPiQi∑i=1kQi,whereQi=1Di.The Weightedk-Nearest Neighbors (WkNN) in Signal Space method was chosen especially because of its easy implementation and the fact that its results are not difficult to interpret. If unexpected results occur, they are easy to analyze.The measurement itself takes several seconds. During the measurement, the measuring device can receive the signal of the same WiFi access points or BLE beacon several times with different signal strength. This set of signals from one transmitter (identified by an ID Tx, e.g., a unique MAC address) within one measurement will be markedXTx; see the following definition:(3)XTx=x1Tx,x2Tx,…,xMTx.For further processing only one value is chosen from this set of different values—the median valuem~Tx which is further marked as s or m values according to its meaning in formula (1).


### 5.3. System Architecture

The system for acquisition of the data obtained during the measurements on mobile devices is based on the Couchbase database. It is a NoSQL database which has no fixed schema and enables saving of records constituted by objects in a JSON format under unique keys. Then, it supports searching primarily according to the keys and secondarily with the aid of the so-called views (they correspond to indexes in relational databases) which can be based on any data from the records.One of the advantages of schemaless databases is a high flexibility when addition of more attributes in newly acquired records does not require any modifications of the schema or a major restructuring of the database. This flexibility is especially useful in research projects when a detailed analysis of all requirements at the very beginning of the project cannot be expected.Support of replication across several servers is another advantage of Couchbase. Besides the server environment, this database can be operated on mobile devices using the Couchbase Lite edition. Couchbase Sync Gateway allows the database to be replicated among the server and mobile devices including selective replication of selected records only. This feature was used for replication of the measured data from mobile devices to the server where they were further processed and the evaluation described below was performed.Direct access to Couchbase or Couchbase Sync Gateway from the Internet is not recommended due to security reasons [24]. That is why the Apache reverse proxy is put in front of the Sync Gateway. The Apache reverse proxy mediates communication among clients (mobile devices) and server components. The whole system at the server is described in Figure 1. The small JavaScript application deployed to the NodeJS server provides external authentication of users for Couchbase Sync Gateway using Google accounts. It facilitates the authentication based on user’s Google account when using his/her smartphone or tablet with the Android operating system. A session token is the result of the authentication process.Figure 1
System architecture (based on [25]).


## 5.1. Learning Data Acquisition

Smartphones were used to acquire the learning data and the state of their sensors (accelerometer, compass, and gyroscope) was also recorded for future processing. Volunteers used their smartphones with a digitized map of a building to acquire the learning dataset. A smartphone scans signals of all available networks and beacons around and the user creates the fingerprint of the given place with the aid of our application. The application records strengths of individual signals in a given place for 10 seconds (which should be a sufficient time [23]). A fingerprint created in this way is recorded into the fingerprint database. The rest of the system is described in Section 5.3.


## 5.2. Positioning Method

The localization inside a building is done using collection of more fingerprints but these are not necessarily recorded in a database. The user who wishes to be localized measures a fingerprint of a place where he/she is using an application in his/her smartphone. This fingerprint is then compared with all fingerprints in the database and one or more fingerprints withthe highest similarity are searched. The fingerprints in the database are tagged with corresponding positions inside the building. The accuracy of the localization depends on factors such as the quality of fingerprints saved in the database (especially radio interference and the accuracy of the determination of the place where the tagged fingerprint was acquired) and the algorithms used for calculation of a similarity of the tagged fingerprint in the database with the measured untagged fingerprint.To compare the measured fingerprint with the database, thek-Nearest Neighbors (k-NN) in Signal Space method was used. This method tries to find k of the nearest fingerprints from the database by means of, for example, Euclidean distance. In this way we get k locations and by their combinations we estimate the position of the device to be localized. The Euclidean distance of the measured vector of the fingerprint m=(m1,m2,…,mn) from the ith fingerprint Si=(si1,si2,…,sin) in the database can be expressed by the following formula:(1)Di=∑j=1Nmj-sij2,where N is a number of unique transmitters in the measurement.After sorting the tagged fingerprints according to the distancesDi from the measured fingerprint, the first k fingerprints are chosen. From their known positions Pi[xi,yi] the weighted estimate of a position P of the measured fingerprint is calculated according to the following formula:(2)P=∑i=1kPiQi∑i=1kQi,whereQi=1Di.The Weightedk-Nearest Neighbors (WkNN) in Signal Space method was chosen especially because of its easy implementation and the fact that its results are not difficult to interpret. If unexpected results occur, they are easy to analyze.The measurement itself takes several seconds. During the measurement, the measuring device can receive the signal of the same WiFi access points or BLE beacon several times with different signal strength. This set of signals from one transmitter (identified by an ID Tx, e.g., a unique MAC address) within one measurement will be markedXTx; see the following definition:(3)XTx=x1Tx,x2Tx,…,xMTx.For further processing only one value is chosen from this set of different values—the median valuem~Tx which is further marked as s or m values according to its meaning in formula (1).


## 5.3. System Architecture

The system for acquisition of the data obtained during the measurements on mobile devices is based on the Couchbase database. It is a NoSQL database which has no fixed schema and enables saving of records constituted by objects in a JSON format under unique keys. Then, it supports searching primarily according to the keys and secondarily with the aid of the so-called views (they correspond to indexes in relational databases) which can be based on any data from the records.One of the advantages of schemaless databases is a high flexibility when addition of more attributes in newly acquired records does not require any modifications of the schema or a major restructuring of the database. This flexibility is especially useful in research projects when a detailed analysis of all requirements at the very beginning of the project cannot be expected.Support of replication across several servers is another advantage of Couchbase. Besides the server environment, this database can be operated on mobile devices using the Couchbase Lite edition. Couchbase Sync Gateway allows the database to be replicated among the server and mobile devices including selective replication of selected records only. This feature was used for replication of the measured data from mobile devices to the server where they were further processed and the evaluation described below was performed.Direct access to Couchbase or Couchbase Sync Gateway from the Internet is not recommended due to security reasons [24]. That is why the Apache reverse proxy is put in front of the Sync Gateway. The Apache reverse proxy mediates communication among clients (mobile devices) and server components. The whole system at the server is described in Figure 1. The small JavaScript application deployed to the NodeJS server provides external authentication of users for Couchbase Sync Gateway using Google accounts. It facilitates the authentication based on user’s Google account when using his/her smartphone or tablet with the Android operating system. A session token is the result of the authentication process.Figure 1
System architecture (based on [25]).


## 6. Test Site: The Campus Building

As a test site, one floor of the building of the Faculty of Informatics and Management, University of Hradec Kralove (FIM UHK), was chosen. The main walk-through corridors are in a rectangular arrangement. Classrooms and offices are situated inwards and outwards in relation to the corridors. There is a roofed atrium in the center of the building. Experiments have been conducted in a 52 m × 43 m area.Several WiFi transmitters of theeduroam network made by Cisco are permanently deployed on every floor. Their locations are marked with letters Ⓦ in Figure 2.Figure 2
Floor plan with WiFi access points and BLE beacons.In every place marked there are more radio units, typically at least two of them—one in a 2.4 GHz and the other one in a 5 GHz band. Their TX power is automatically adjusted by the central radio resource management unit to help mitigate cochannel interference and signal coverage problems.Then, 17 new Bluetooth Low Energy beacons made by Estimote were evenly placed in the corridors and classrooms on the floor. Beacons were originally put behind the dropped ceiling (see Figure3) in a similar way as WiFi access points but the performance was not sufficient. Later on, we moved them from behind the ceiling and attached them to the bottom side of the mineral fiber ceiling tile. It improved the performance and enabled the line-of-sight propagation. Beacon broadcasting parameters were set to the advertising interval of 100 ms and the TX power of 0 dBm. Locations of beacons are marked with numbers ① to ⑰ in Figure 2. Individual beacons in the corridor are about 10 m apart.Figure 3
Physical deployment of the BLE beacon.


## 7. Evaluation

The dataset of calibrated points was acquired by volunteers during several weeks. In total, 680 measurements were performed consisting of 115,511 individual RSSI samples (signal strength + transmitter-id pairs). The exact position on the floor was known for every measurement. Two devices were used for measurement: Sony Xperia Z3 Compact and Motorola Nexus 6. Each measurement took 10 seconds.A chart in Figure4 shows numbers of different (unique) transmitters received within one fingerprint for both technologies—WiFi and BLE. To be complete, we also show the sum of both technologies because in the following evaluation we will consider combination of signals from both types of transmitters. The median of the number of unique transmitters is 5 for WiFi and 4 for BLE.Figure 4
Number of unique transmitters in a single measurement.To evaluate the localization using WiFi, BLE, and a combination of both technologies, the leave-one-out cross-validation technique was applied. From the set of 680 calibrated points, one of them was chosen in each iteration and its position was estimated based on the other calibrated points. This procedure was then repeated for all points. The accuracy (estimated position compared to the real position) was then calculated for every estimation of the position.A Weightedk-Nearest Neighbors in Signal Space algorithm was used for estimation of the position. We tested k∈1,2,…,5. Several authors recommend k to be chosen as 3 or 4 [23]. Our results of k∈2,3,4 were similar but we achieved the highest accuracy using k=2. This value is used in our experiments.Figure5 shows the results of the cross-validation—on the y axis there is an accuracy of the estimation of the position (an error in meters) when using WiFi networks only, BLE transmitters only, and finally both technologies combined together. The median accuracy improved from 1 m when using WiFi to 0.77 m when combining both technologies. However, the elimination of the accuracy variance and the reduction of outliers is more interesting. The maximum error of the localization (excluding outliers) in a given sample was lowered from 4.27 m when using WiFi to 2.82 m in a combined method.Figure 5
Comparison of localization accuracy.We analyzed estimations with the highest errors in detail to be able to discuss the possible causes. Most of the incorrectly localized points were situated at the dead ends of the corridors where there was no beacon at the very end of the corridor. Localization algorithm obviously estimates the position better when it can approximate the position between two beacons. Longer corridors also allow good propagation of the signal causing less significant differences among signals, especially at the dead ends.


### 7.1. Weight of BLE Signals versus WiFi Signals

Several tests verifying a suitable way to combine signals of WiFi and BLE transmitters in Signal Space have been performed. Both WiFi and BLE signals were put into common Signal Space. The strengths of BLE signals in individual tests were multiplied by different coefficientsc∈0.2,1.8. The total distance in Signal Space containing both WiFi and BLE signals was then calculated according to the formula(4)Di=∑j=1Nmj-sij2+∑j′=1N′c·mj′′-sij′′2,where m=(m1,m2,…,mN) is the measured vector of the fingerprint of WiFi signals and Si=(si1,si2,…,siN) is the calibrated vector of the fingerprint of WiFi signals from the database. Analogously, m′=(m1′,m2′,…,mN′′) is the measured vector of the fingerprint of BLE signals and Si′=(si1′,si2′,…,siN′′) is the calibrated vector of the fingerprint of BLE signals from the database. N is the number of unique WiFi transmitters in a measurement and N′ is the number of unique BLE beacons in a measurement.These tests revealed that the best results in the given set of measurements were achieved by a ratio of 1 : 1 (thus a coefficientc=1). There is no reason to give more weight to one technology or the other.


### 7.2. Scanning Duration

Signal scanning (measuring) duration in a given place is another important parameter. During our experiment, every measurement always took 10 seconds. Our goal was to find out how many seconds the measurement should last to provide good results.Because all the data acquired about individual measured signals were time-stamped, even shorter scanning duration can be considered. For example, the results of measurement taking 2 seconds can be achieved by ignoring signals measured after a lapse of 2 seconds (thus ignoring the remaining 8 seconds from the total scanning interval). Due to the fact that we calculate the median valuex~ (m or s values in formula (4)) from several signal strengths acquired from the same transmitter within one measurement, shortening of the considered scanning duration does not have to necessarily mean reduction of the number of N or N′ due to complete “loss” of signals of some transmitters. After longer time of measurement, the X sets from which the median values X~Tx are calculated for each transmitter are rather smaller because of a reduction of the duration.We evaluated the localization again with different scanning duration considered from 1 second to 10 seconds. Figure6 shows the influence of the scanning duration on the accuracy of the estimation of the position. Only median and maximum (excluding outliers) values are displayed for clarity. Two factors probably affect the accuracy: first, the speed of delivery of the measured signal strengths of transmitters to the Android application and, second, the significance of the particular technology in the localization process. We noticed faster delivery of signal strengths of the BLE transmitters in contrast to WiFi access points. Thus, BLE promises faster initial localization than WiFi does. This effect becomes even stronger in combination with WiFi. For example, in the 2nd second of the scanning, we were unable to localize the mobile device in 168 positions using WiFi, in 36 positions using BLE, and in 20 positions using combination of BLE and WiFi. It is because the Android operating system may delay delivery of the WiFi scanning results until the first scan cycle is done. Our stationary localization may significantly help in the initial phase of other methods based on distance estimation and pedestrian dead reckoning [12].Figure 6
Localization accuracy depending on scanning duration (scanning started at time 0).We have also investigated a situation when we estimate the location using particular scanning duration while the scanning was started 4 seconds in advance. We have chosen 4 seconds because we observed a “warm-up” period of approximately 4 seconds before the scanning results were continuously delivered to the Android application after the scanning had been initially started. The results have improved enabling the localization algorithm to be applicable to moving object localization while doing continuous scanning that was started at least 4 seconds in advance; see Figure7.Figure 7
Localization accuracy depending on scanning duration (scanning started 4 s before time 0).


### 7.3. BLE Beacons Density

Density of BLE beacons will also influence the quality of the localization. Due to the fact that beacons were firmly attached, the experiment verifying the impact of beacons’ density was performed using existing data. Some beacons were not considered when processed by the localization algorithm (i.e., they were ignored) in order to simulate lower density. This experiment was performed twice. For the first time, only 6 beacons in the corridors marked by numbers ①, ③, ⑤, ⑦, ⑨, and ⑪ in Figure2 were considered—this experiment was marked as an A option. For the second time, only 12 beacons marked ① to ⑫ were considered—this experiment was marked as a B option.A boxplot in Figure8 shows the final accuracy of the estimated position in individual cases A and B. The results of configuration A reveal a substantial deterioration of the accuracy of the localization in the test set when using BLE beacons only. This is understandable due to a reduction in the number of the unique BLE beacons scanned within one measurement to less than 50% (in average from 4.4 to 1.9). The number of nonlocalized points thus increases.Figure 8
Comparison of localization accuracy among different BLE deployment configurations.


## 7.1. Weight of BLE Signals versus WiFi Signals

Several tests verifying a suitable way to combine signals of WiFi and BLE transmitters in Signal Space have been performed. Both WiFi and BLE signals were put into common Signal Space. The strengths of BLE signals in individual tests were multiplied by different coefficientsc∈0.2,1.8. The total distance in Signal Space containing both WiFi and BLE signals was then calculated according to the formula(4)Di=∑j=1Nmj-sij2+∑j′=1N′c·mj′′-sij′′2,where m=(m1,m2,…,mN) is the measured vector of the fingerprint of WiFi signals and Si=(si1,si2,…,siN) is the calibrated vector of the fingerprint of WiFi signals from the database. Analogously, m′=(m1′,m2′,…,mN′′) is the measured vector of the fingerprint of BLE signals and Si′=(si1′,si2′,…,siN′′) is the calibrated vector of the fingerprint of BLE signals from the database. N is the number of unique WiFi transmitters in a measurement and N′ is the number of unique BLE beacons in a measurement.These tests revealed that the best results in the given set of measurements were achieved by a ratio of 1 : 1 (thus a coefficientc=1). There is no reason to give more weight to one technology or the other.


## 7.2. Scanning Duration

Signal scanning (measuring) duration in a given place is another important parameter. During our experiment, every measurement always took 10 seconds. Our goal was to find out how many seconds the measurement should last to provide good results.Because all the data acquired about individual measured signals were time-stamped, even shorter scanning duration can be considered. For example, the results of measurement taking 2 seconds can be achieved by ignoring signals measured after a lapse of 2 seconds (thus ignoring the remaining 8 seconds from the total scanning interval). Due to the fact that we calculate the median valuex~ (m or s values in formula (4)) from several signal strengths acquired from the same transmitter within one measurement, shortening of the considered scanning duration does not have to necessarily mean reduction of the number of N or N′ due to complete “loss” of signals of some transmitters. After longer time of measurement, the X sets from which the median values X~Tx are calculated for each transmitter are rather smaller because of a reduction of the duration.We evaluated the localization again with different scanning duration considered from 1 second to 10 seconds. Figure6 shows the influence of the scanning duration on the accuracy of the estimation of the position. Only median and maximum (excluding outliers) values are displayed for clarity. Two factors probably affect the accuracy: first, the speed of delivery of the measured signal strengths of transmitters to the Android application and, second, the significance of the particular technology in the localization process. We noticed faster delivery of signal strengths of the BLE transmitters in contrast to WiFi access points. Thus, BLE promises faster initial localization than WiFi does. This effect becomes even stronger in combination with WiFi. For example, in the 2nd second of the scanning, we were unable to localize the mobile device in 168 positions using WiFi, in 36 positions using BLE, and in 20 positions using combination of BLE and WiFi. It is because the Android operating system may delay delivery of the WiFi scanning results until the first scan cycle is done. Our stationary localization may significantly help in the initial phase of other methods based on distance estimation and pedestrian dead reckoning [12].Figure 6
Localization accuracy depending on scanning duration (scanning started at time 0).We have also investigated a situation when we estimate the location using particular scanning duration while the scanning was started 4 seconds in advance. We have chosen 4 seconds because we observed a “warm-up” period of approximately 4 seconds before the scanning results were continuously delivered to the Android application after the scanning had been initially started. The results have improved enabling the localization algorithm to be applicable to moving object localization while doing continuous scanning that was started at least 4 seconds in advance; see Figure7.Figure 7
Localization accuracy depending on scanning duration (scanning started 4 s before time 0).


## 7.3. BLE Beacons Density

Density of BLE beacons will also influence the quality of the localization. Due to the fact that beacons were firmly attached, the experiment verifying the impact of beacons’ density was performed using existing data. Some beacons were not considered when processed by the localization algorithm (i.e., they were ignored) in order to simulate lower density. This experiment was performed twice. For the first time, only 6 beacons in the corridors marked by numbers ①, ③, ⑤, ⑦, ⑨, and ⑪ in Figure2 were considered—this experiment was marked as an A option. For the second time, only 12 beacons marked ① to ⑫ were considered—this experiment was marked as a B option.A boxplot in Figure8 shows the final accuracy of the estimated position in individual cases A and B. The results of configuration A reveal a substantial deterioration of the accuracy of the localization in the test set when using BLE beacons only. This is understandable due to a reduction in the number of the unique BLE beacons scanned within one measurement to less than 50% (in average from 4.4 to 1.9). The number of nonlocalized points thus increases.Figure 8
Comparison of localization accuracy among different BLE deployment configurations.


## 8. Discussion

Figure8 also shows the results of the combined localization using WiFi and BLE beacons. In this method in configurations A and B the median accuracy worsened from 0.77 m to 0.99 m (A configuration) and to 0.87 m (B configuration), respectively. Let us remember that the median accuracy of the WiFi-based localization is 1 m in our experiment. These results are also summarized in Table 1. Improvement in accuracy is relative to the accuracy of the WiFi-based localization in the table.Table 1
Localization results summary.
Median accuracy
Improvement
Improvement pct.
WiFi
1.00 m
N/A
N/A
Combined WiFi + 6 BLE beacons, conf. A
0.99 m
0.01 m
1%
Combined WiFi + 12 BLE beacons, conf. B
0.87 m
0.13 m
13%
Combined WiFi + 17 BLE beacons (all)
0.77 m
0.23 m
23%Thanks to addition of 17 BLE beacons, the accuracy of the localization in a given dataset improved by 23%. Besides the median value of the localization error, the maximum error (outliers not considered) also improved from 4.27 m to 2.82 m. The average error improved from 1.81 m to 1.08 m. We assume that the number of BLE beacons scanned in one measurement (which was 4.4 on average) has the main impact on the resulting improvement in the localization accuracy. We also assume that by increasing the number of beacons it will be possible to achieve more substantial improvement considering the observed impact of further reduction of BLE beacons. Increase of the TX power of the BLE beacons should also increase the number of beacons detected during measurement thanks to the extended coverage and overlap of areas covered by individual beacons. But this option is less efficient for two reasons. First, the higher TX power will result in substantially faster discharge of batteries in the beacons. Second, a denser network of less performing beacons will increase significant differences among individual places compared to a sparser network of more performing beacons.Several experiments were also performed with different ways of beacons’ placement. Despite the fact that placement of beacons behind a dropped ceiling is the technically easiest solution, its disadvantage is the fact that the beacons are completely covered by the ceiling tiles. We have also put some BLE beacons inside teachers’ tables in computer laboratories (marked by ⑬ to⑰ in Figure 2). These tables are situated in the front part of the laboratory and they are wooden with metal sides. Compared to the beacons with the same settings in the dropped ceilings, these beacons in the tables covered a wider area while also completely hidden inside the table. But our original expectation was the opposite because the ceilings were composed of mineral fiber tiles which promised lower attenuation than metal sides of the tables. It was expected that these metal components of the tables would be a substantial obstacle for BLE signal propagation. Based on this observation, we moved beacons from behind the ceiling and attached them to the bottom side of the mineral fiber ceiling tile, which improved their performance. In the future we plan to conduct more experiments with placement of individual beacons and to verify the results of the subsequent localization.Note that, besides the improvement in the accuracy, BLE beacons bring another advantage—energy-efficient geofencing. Thanks to BLE it is possible to develop applications which react to approach of a mobile phone towards a beacon and which can bring new user’s experience. In contrast to the Android operating system, the iOS operating system by Apple is more advanced in this field; it has direct support of detection ofbeacon regions while the device is in a standby mode.


## 9. Conclusion

In this paper, we have introduced a way to improve the accuracy of the radio-based indoor stationary localization originally based on WiFi signals. We have designed and implemented a distributed system for acquisition of radio fingerprints. The system consists of server(s) and mobile devices with the Android operating system which support Bluetooth Low Energy. The system is designed to enable volunteers to create a radio-map and update it continuously. Evaluation of the solution was based on the Weightedk-Nearest Neighbors in Signal Space algorithm. New Bluetooth Low Energy transmitters by Estimote were installed on the floor of the building where WiFi access points used by theeduroam network had been installed before. Based on the data acquired in this real world scenario, the results of the localization using WiFi, Bluetooth Low Energy, and their combination were evaluated. We have tested several configurations of positions of transmitters or their density. We have also made experiments with how to combine signals from both technologies within one Signal Space. Further, we have tested the influence of the scanning duration on the accuracy of the localization. The resulting data have shown that it is possible to improve the median accuracy by 23% and to reduce the variance.In the future we will deal with testing the influence of broadcasting parameters of beacons such as the advertising interval and the TX power. It will also be suitable to test even higher density of beacons. We will also focus on testing the influence of other features associated with particular measurements, such as the orientation of the mobile device, and the difference of their impact in both technologies. Further attention will also be paid to the incorporation of device movement aspects (using particle filters, according to [11, 12]) and to their potential use in the fingerprinting approach.



---

*Source: 2083094-2016-04-18.xml*