Full Text 01
Full Text 01
Computer Engineering
Bachelor Thesis
by
Ali Hassan
Anna Ahlquist
In this thesis we developed an indoor tracking system based on Bluetooth Low Energy
technology and mesh topology. The system is developed to track Bluetooth beacon in
an indoor office environment. Received Signal Strength is used to calculate distance to
the beacon, while the position of the beacon is calculated using Extended Min-Max and
Trilateration algorithms. Calculations are performed on server. The results are analyzed
through comparison of Root Mean Square Error of both algorithms. In this thesis, indoor
tracking is evaluated as part of an assignment given by u-blox.
i
Sammanfattning
Internet of Things ger människor möjligheter att genom tjänster dra nytta av sensorer
och andra enheter som tillsammans skapar ett brett utbud av lösningar som smart hem,
smart transport, äldreomsorg och mycket mer. Den senaste innovationen av Bluetooth
SIG är Bluetooth mesh topologi som tillåter att ansluta trådlösa enheter i ett många till
många förhållanden. För att undersöka de potentiella fördelar som Bluetooth Low Energy
nätverk har att erbjuda för inomhusspårningssystemet.
ii
Acknowledgements
Firstly, we would like to thank u-blox for giving us the opportunity to carry out this
thesis. We would like to thank Mats Anderson and Per-Olof Håkansson for all the help
during the thesis. We would also thank our supervisor Yuji Dong and Magnus Krampell
for their advice and feedback during the thesis work.
iii
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Research questions . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Theoretical Background . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1 Bluetooth Low Energy . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.1 Bluetooth LE protocol stack . . . . . . . . . . . . . . . . . 4
2.1.2 Generic Access Profile (GAP) . . . . . . . . . . . . . . . . 5
2.1.3 Attribute Protocol (ATT) and Generic Attribute Profile
(GATT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Bluetooth Mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Received Signal Strength (RSS) . . . . . . . . . . . . . . . . . . . . 7
2.4 Discrete Kalman Filter . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.5 Trilateration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.6 Bluetooth Localization Services . . . . . . . . . . . . . . . . . . . . 8
2.6.1 Real-Time Location Systems (RTLS) . . . . . . . . . . . . 9
2.6.2 Indoor Positioning Systems (IPS) . . . . . . . . . . . . . . 10
2.7 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3 Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.1 The Smart Doorbell: A proof-of-concept Implementation of a Blue-
tooth Mesh Network . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2 Smart indoor positioning using BLE technology . . . . . . . . . . . 11
3.3 A Bluetooth Low Energy Indoor Positioning System with Channel
Diversity, Weighted Trilateration and
Kalman Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.1 Method Description . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.1.1 Construct a conceptual framework . . . . . . . . . . . . . 14
4.1.2 Develop a system architecture . . . . . . . . . . . . . . . . 15
4.1.3 Analyze and design the system . . . . . . . . . . . . . . . 15
4.1.4 Build the system (prototype) . . . . . . . . . . . . . . . . 15
4.1.5 Observe and Evaluate the System . . . . . . . . . . . . . . 15
5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.1 Construct a conceptual framework . . . . . . . . . . . . . . . . . . 16
5.1.1 Problem tree . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.1.2 Literature study . . . . . . . . . . . . . . . . . . . . . . . 17
5.1.3 Indoor Positioning System (BLE) . . . . . . . . . . . . . . 17
5.1.4 Positioning algorithms . . . . . . . . . . . . . . . . . . . . 17
5.2 Develop a system architecture . . . . . . . . . . . . . . . . . . . . . 20
iv
5.2.1 Beacon Device . . . . . . . . . . . . . . . . . . . . . . . . 20
5.2.2 Node Device . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.2.3 Gateway Device . . . . . . . . . . . . . . . . . . . . . . . 20
5.2.4 Server Device . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.3 Analyze and design the system . . . . . . . . . . . . . . . . . . . . 21
5.3.1 Requirements Specification . . . . . . . . . . . . . . . . . 21
5.3.2 System Design . . . . . . . . . . . . . . . . . . . . . . . . 21
5.4 Build the system (prototype) . . . . . . . . . . . . . . . . . . . . . 22
5.4.1 Beacon implementation . . . . . . . . . . . . . . . . . . . 22
5.4.2 Node implementation . . . . . . . . . . . . . . . . . . . . 22
5.4.3 Gateway implementation . . . . . . . . . . . . . . . . . . . 22
5.4.4 Server implementation . . . . . . . . . . . . . . . . . . . . 23
5.5 Observe and Evaluate the System . . . . . . . . . . . . . . . . . . . 24
5.5.1 RSSI Filtering . . . . . . . . . . . . . . . . . . . . . . . . 24
5.5.2 First test scenario in office environment . . . . . . . . . . 25
5.5.3 Results of the first test scenario . . . . . . . . . . . . . . . 25
5.5.4 Second test scenario in office environment . . . . . . . . . 28
5.5.5 Results of the second test scenario . . . . . . . . . . . . . 29
5.5.6 Different cases of circles arrangements . . . . . . . . . . . 31
5.5.7 Comparison of Trilateration and Extended Min-Max algo-
rithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5.5.8 Calculation time of algorithms . . . . . . . . . . . . . . . 33
6 Analysis and Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.1 RSSI Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.2 Analysis of result . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.1 Further Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
References 38
1 Introduction
This section gives the reader an introduction to the background of the thesis, motivation
of the work and the problem statement along with research questions, limitations and
requirements specifications.
1.1 Background
Phones, tablets and PCs have become portals, which help people experience the surround-
ing world and Bluetooth can be found on each of them. Billions of Bluetooth devices are
shipping every year, and these devices accommodate us in our everyday needs. Bluetooth
is a radio technology that aims to address specific connectivity needs. Recent advance-
ments in the technology give Bluetooth opportunity to grow beyond consumer-facing
applications into new environments, such as smart buildings, smart industry and smart
cities [1].
Bluetooth technology has been in the business of connecting things for a long time, starting
with pairing phones and headsets for audio and data streaming. More recently, Bluetooth
Low Energy has been developed, aimed to provide high data transfer speed but at the
same time considerably reduce power consumption while maintaining appropriate commu-
nication range. Bluetooth Low Energy is a base communication technology for different
topologies, point-to-point (1:1) that enables data transfer, broadcast (1:M) that enables
local services and mesh (M:M) that supports device networks. The connection capability
of these topologies has become even more powerful with new Bluetooth 5, which delivers
higher speed, bigger capacity for data transfer, longer range and less power consumption
[2].
The latest innovation of Bluetooth SIG is the Bluetooth mesh topology that changes
how people interact with the environment. The Bluetooth mesh allows us to connect
wireless devices in a many-to-many relationship. Every device can receive and broad-
cast messages and can relay them further to other devices that are not in direct radio
range of the originating device. This functionality makes it possible to create large-scale
device networks, such as control systems, monitoring systems and automation systems.
Smartphones cannot be part of a mesh network yet, but they can communicate with the
network and link it to the internet [3].
1
1.2 Motivation
The Internet of Things brings connectivity of people, services, sensors and other devices
enabling a wide range of applications like smart home and buildings, smart transport, el-
der care and much more. With the introduction of Bluetooth mesh, Bluetooth technology
surely will become a big part of IoT. Since many IoT systems involve many small devices
and sensors that need to send short bursts of data, Bluetooth LE is a suitable protocol
as it provides hassle-free and easy setup [1].
With the growth of the IoT domain and expansion of Bluetooth mesh, there will be more
networks of connected devices with a many-to-many topology. These networks create an
opportunity to implement functions like position tracking.
The purpose of this thesis is to make a prototype of a tracking system and investigate if it
can be used to track stationary assets within a building. The investigation shall propose
a system architecture for such a system and identify the risks and limitations.
• RQ1: Which algorithm should be used to calculate position based on RSSI mea-
surements in this project?
• RQ2: How does the amount and placement of the nodes impact the system?
• RQ3: What accuracy can be achieved in a mesh-based tracking system? How can
the accuracy be improved?
1.4 Limitations
EVK-NINA-B3 evaluation kits were provided by u-blox to build the prototype of the
tracking system. The module build in the EVK is a NINA-B3 series standalone Blue-
tooth 5 low energy module.
NINA-B3 modules have a built-in Arm Cortex-M4. When considering Time of Flight
the signal travels 20 meters in one processor tick, this makes it impossible to detect dis-
tances lower than 20 meters.
NINA-B3 modules have a built-in internal PIFA antenna that does not support Angle
of Arrival.
Based on the previous points this thesis will be limited to use Bluetooth technology as
a communication technology and RSSI measurements to calculate the distance between
2
receiver and transmitter devices.
For this thesis, we assume the node devices are stationary and their positions are known
and stored in a database(text file in this project). The work in this thesis only considers
two-dimension localization. The height above ground is not considered when determining
the position of a target object.
The server is implemented using Node-red programming tool and Java-script program-
ming language.
3
2 Theoretical Background
This section introduces the basic concepts of the wireless standard known as Bluetooth
Low Energy, explaining how data is organized and what its key limitations are. We
also introduce and explain elementary concepts fundamental to BLE, such as protocol
stack, broadcasting, and the different roles that devices can assume. This section also
presents other relevant concepts like RSSI and positioning algorithms that you are likely
to encounter in this thesis.
The primary design goal of Bluetooth Low Energy is to optimize energy consumption.
This brings forward key limitations that are defined in the Bluetooth 4.0 specification and
later.
• Data throughput
The data throughput of BLE devices is limited by the physical radio layer (PHY)
and differs depending on the Bluetooth version used. The specification provides the
theoretical upper limit of throughput. In the real world, the throughput is typically
lowered by a variety of factors like bidirectional traffic, protocol overhead, CPU,
radio limitations and many other.
• Operating range
As well as data throughput the actual range of a BLE device depends on different
factors like output power of the transmitter, sensitivity of the receiver, operating
environment, antenna design and device orientation. That is why the range specified
in the BLE specification can be less in practice.
4
parts: controller, host, and application, each split into several layers that provide the
functionality required for a device to operate. The host can communicate with the con-
troller through the Host Controller Interface (HCI) [6].
Bluetooth 5 update brought some major changes in how advertising may be performed.
5
There are now two sets of advertising channels: primary and secondary. The primary ad-
vertising channels are the original advertising channels 37, 38, and 39, while the secondary
are the rest 37 channels previously used for data transfer. The new added extended ad-
vertising PDUs are broadcast only events. Bluetooth 5 allows packets to be up to 255
bytes long. Header data, including a new field called AuxPtr, is transmitted on the pri-
mary channels in the context of Bluetooth 5 advertising. The AuxPtr field includes the
channel number that the payload will be transmitted on so that receivers know where to
find it. The payload is sent to one of the secondary channels allowing larger packets in
connection-less scenarios [7].
• UUID (universally unique identifier) which defines type and nature of the data
contained in the value
The Generic Attribute Profile (GATT) builds on the Attribute Protocol (ATT) and use it
as a transport protocol to exchange data between devices. GATT deals only with actual
data transfer procedures and formats, how a unit of data is formatted, packed, and sent.
GATT maintains the same client-server architecture present in ATT and defines how ATT
attributes are grouped into meaningful services. A collection of Services is called a profile.
There are some predefined profiles like Heart Rate Profile (HRP) that combines the Heart
Rate Service and the Device Information Service. Each service has many characteristics
that store useful values for the services and permissions. GATT roles(client, server) are
independent of GAP roles (central, peripheral) and are compatible with each other [6].
Devices which are part of a mesh network are called nodes and those who are not are
called “unprovisioned devices”. All nodes can transmit and receive mesh messages in the
network, but they are not limited to this functionality. There are several optional features
with special capabilities which a node may have implemented. Those optional features
are Relay, Proxy, Friend, and the Low Power (see figure 2). Mesh node can support zero
or more of these optional features, and supported feature may be enabled or disabled.
6
Figure 2: Bluetooth mesh network (figure source: Bluetooth SIG)
For a device to become a part of the network, it must first go through the provisioning
process. The device used for provisioning is called a Provisioner. The provisioning process
consists of several steps to generate different security keys. One of which is network key
also called NetKey. Devices that possess a NetKey are members of the corresponding
network and can communicate with each node in the network. Every node in the network
must possess at least one NetKey.
Communication in the mesh network is accomplished through messages. There are many
different message types, and every type has one unique opcode. Every message has a
sender address and a receiver address. There are three types of addresses defined by the
Bluetooth mesh:
• Virtual address can be assigned to one or more elements, on the same or different
nodes.
The act of sending a message is known as publishing. Messages are usually addressed to
the group or virtual addresses. Nodes process only messages sent to them, and this is
known as subscribing [3].
When the RSSI is measured and transmitted power is know it is possible to calculate
the distance between transmitter and receiver. There are three propagation models, Log-
Distance Path Loss model, International Telecommunication Union model and empirical
model[15]. The difference between them are complexity and the strength of characteriza-
tion. The empirical model represented by equation (1) is less complex than other models
7
and do not have strong characterization.
Here n is the path loss exponent, d is the distance between transmitter and receiver, A is
RSSI measured with 1 meter distance between transmitter and receiver in Line-of-Sight.
Prediction phase:
Update phase:
P (t − 1)
K(t) = (4)
P (t − 1) + R
x(t) = x(t − 1) + K ∗ (z(t) − x(t − 1)) (5)
P (t) = (1 − K(t)) ∗ P (t − 1) (6)
where x(t-1) corresponds to initial state of t-1, Bu(t) corresponds input controll of the
system, P(t-1) corresponds to the system error covariance, K(t) is a Kalman gain, Q is
state noise, R is the measurement noise covariance.
2.5 Trilateration
Trilateration is a method used to calculate the intersection of three fixed reference points.
Assuming that the distance between the intersection and the reference points is known.
On this thesis, the nodes correspond to reference points and the BLE beacon is assumed
to be at the intersection. The distance between the reference points and the intersection
is estimated by RSSI.
8
Figure 3: Triletaration
9
2.6.2 Indoor Positioning Systems (IPS)
Indoor position systems (IPS) is often used as a wayfinding solution for visitors at airports,
shopping malls and the like. Bluetooth IPS are often BLE beacon devices attached to
fixed locations, which broadcasts advertising messages (AD) instead of receiving and
retransmitting messages. The visitors enable Bluetooth radio on the phone so that the
BLE beacons can detect it. Application on the phone can determine its position based on
received information from the BLE beacon using the Trilateration. Information consists
of BLE beacon position along with the received signal strength (RSS).
2.7 Hardware
EVK-NINA-B3 series are stand-alone Bluetooth low energy modules and is built on the
Nordic nRF52832 SoC with Bluetooth low energy v5.0 radio, Bluetooth mesh, Arm R
Cortex R -M4 with FPU processor and NFC tag. These modules have low power con-
sumption and multiple antenna options [11].
10
3 Related work
This section summarizes some articles written by researchers in an area of Bluetooth tech-
nology and indoor positioning technology. Articles describe experimentation performed
in the area of Bluetooth mesh network and how Bluetooth mesh features can be utilized
to track people and objects in a smart building.
The result showed that the size and the internal layout of the building was an essen-
tial factor in designing a mesh network inside the building. Moreover, the result showed
that the package loss increased when distance exceeded 10 meters and the latency was
300 ms for packets that travelled a distance of 10 meters.
This paper gives a reasonable explanation about the recently released Bluetooth net-
work topology, namely Bluetooth Mesh, and describes some relevant terminologies. This
paper also makes an excellent contribution knowledge about some Bluetooth devices that
support mesh concept and also gives a good idea of how to build a simple mesh network.
The article describes that BLE beacons were placed at the doors to laboratories in a
department and the RSSI values were measured regarding different obstacles. An android
application was developed with functionality to scann for all available BLE beacons and
collect RSSI values. The application would then choose a beacon with highest RSSI value
11
and then, beacons number along with the user’s name would be sent to a server in order
to monitor that user’s position. To improve the accuracy of the system the laborato-
ries were divided into small blocks, while standing within each block, 25 beacon readings
were taken. With 1000 ms advertising interval, the result showed 96% accuracy of the
estimated user location, and 100% accurate with 500ms advertising interval.
In the second section, the authors presented different related works with similar tech-
niques and compared those with their proposal. First was the Fingerprinting approach
compared to Non-Fingerprinting approach. The comparison makes it clear that even so
the Fingerprinting gives a better result, it requires much offline work, a significant amount
of measurements taken, which also must be updated if the environment changes. Another
critical information here is a table that shows a comparison of some studies discussed in
the section. It compares scenarios, the number of beacons, achieved precision and tech-
nology, methodology or algorithm used. These tables give a good overview of what can
be expected from different approaches. The main goal of the implemented system is to
track the position of a device in different indoor environments. The system consists of
one or more beacons that send advertisements and at least three receivers that scan for
advertisements, with three sniffers each. The sniffers are used to make it possible to listen
for three advertisement channels 37, 38 and 39 at the same time, as BLE transmits on
every one of three channels. The server is used to calculate the estimated position using
distance values received from transmitters.
To improve the performance channel diversity is used in three different ways: choose
the channel that provides the most significant RSSI value, calculate the mean of all the
channels and weighted calculation where the channel with biggest RSSI have a more sig-
nificant weight in the calculation. When the RSSI is calculated, it is used to calculate the
corresponding distance. There are three different propagation models used to calculate
distance: Log-Distance Path Loss, International Telecommunication Union and Empiri-
cal model. The next step is to use trilateration to calculate the estimated position using
distances from receivers to the sender. However, the mathematical trilateration cannot
be used most of the time because of RSSI values are not ideal, and it is impossible to
12
get a single intersection point of three circles. The circles can be grouped in different
ways: circles intersect in an area, two circles intersect in an area, but the third one is
separated, circles do not intersect. The approach for this problem is to use weighted
trilateration, where the receiver with the smallest distance to the sender is the one to be
trusted more than others. At last, the second order Kalman filtering is used to improve
estimated position by smoothing results of weighted trilateration. The system was tested
in three different scenarios: Indoors medium sized room environment, laboratory room
and conference room. The tests were performed in a realistic situation, in the presence of
people, with other 2.4 GHz signals around and different directions of the sender device.
The results show that there is not one ideal propagation model that would work best in
every scenario, but every scene has one or more propagation model that are giving good
results. The authors stated that their approach improves the estimation error compared
to other approaches. For example, in the laboratory, the error was below 1.82 m during
90% of the time, but in the conference room, the error was up to 4.6 m 90% of the time.
The error is much more in the conference room because of the distance between receivers.
The accuracy of RSSI measurement gets worse as the distance between transmitter and
receiver increases 5 meters. The articles provide us with a deeper understanding of how
IPS are built, function, and what complications can be expected. We get to know about
different solutions to problems get essential information on a different aspect of our work.
There are also many related works mentioned, that can be useful.
13
4 Method
This section presents the research method used to solve the research problem stated in
section 1.3. The result of the research method is a prototype that is used to investigate
and answer questions stated in section 1.3.
Figure 6: Five stages of system development process described by Nunamaker and Chen
[16]
14
4.1.2 Develop a system architecture
This step is about developing a system architecture that gives insight into system buildup,
defining the components of the system and describing their functionalities. Requirements
specifications (see 5.3) are defined based on the components of the system and what
functionality each component should have in order to evaluate the entire system.
15
5 Results
In this section, we present the results achieved during the thesis work following the method
steps in chapter 4.
The problem tree was designed to get a better overview of the system. This way, it is
easier to determine problems to be solved to make a prototype. The prototype is a track-
ing system based on Bluetooth mesh technology and RSSI measurements. The tracking
system consists of a Beacon device(transmitter), Node device(receiver) and Server de-
vice(computer).
The Beacon device broadcasts advertising messages, notifying listening devices about
its presence. The Node devices listen for broadcasted advertising messages and collect
them for processing. After the message is processed, the information from the message is
sent to the Server device through the mesh network. The Server device is a computer and
can not be a part of the mesh network. Thus there is a need for a medium between the
computer and a mesh network. The medium is a Node device with special features, and
we call it a Gateway device. The Gateway device listens for mesh messages, and when
such a message is received, the Gateway sent it to the Server device. The Server device
process received messages, choose the strongest RSSI values, calculate distance based on
RSSI and calculate the position of the Beacon device.
16
5.1.2 Literature study
A preliminary literature study that was carried out to gain knowledge about different
problems presented in the problem tree (see figure 7). The result of the literature study
is discussed further in the sections 5.1.3, 5.1.4, 5.1.5.
• Multipath and fading caused by reflection and diffraction around objects, walls,
furniture and floors within the room.
The RSSI can be used for localization in two ways: to calculate distance using radio
propagation loss model or by fingerprinting technique. The Fingerprinting method in-
volves mapping taken RSSI measurements to different positions. This approach provides
greater accuracy, but requires a big amount of pre-work and is vulnerable to any change
in the environment. Measured RSSI together with a propagation loss model can be used
to calculate the distance between the sender and the receiver.
There are a few different algorithms that can be used to calculate the position based
on the distance: Min-Max and Trilateration.
17
Min-Max algorithm
The Min-Max algorithm [17] represented by equations (7), (8), (9), (10) is a simple local-
ization algorithm that builds a square around each Node, as shown in Fig.8. Each side of
the square is two times the measured distance di, dj, dk, between the Beacon and Node.
The intersections of these squares are used to determine an intersection region where the
position of the Beacon will be estimated. The intersection region has four vertices p1, p2,
p3 and p4. The position of the Beacon is estimated by calculating the middle point of
the intersection region. Even in a scenario where there is no intersection region between
squares, Min-Max localization algorithm can calculate a coarse position of the Beacon.
Min-max algorithm can produce high localization error even if the distance measure-
ments errors are small. However, it can be improved by adding a weight to each vertex
of the definition zone. The weighted Min-Max does not locate the position of the Beacon
at the centre of the definition zone, it locates the position of the Beacon anywhere inside
the defined zone with respect to weights of the vertices. Weights are calculated using
equation (11).
18
Trilateration algorithm
Trilateration algorithm [20] is a simple localization algorithm that uses distances between
a point and three known locations to calculate the position of the point. In case of Indoor
Positioning System, it calculates Beacon location at an intersection point of three circles.
Circles are formed using Node position as the center and the distance between Node and
Beacon as the radius.
The classic Trilateration algorithm is a system of linear equations:
x 2 + y 2 + a1 x + b 1 y + c 1 = 0 (12)
x 2 + y 2 + a2 x + b 2 y + c 2 = 0 (13)
x 2 + y 2 + a3 x + b 3 y + c 3 = 0 (14)
Using equations (15) and (16) we can calculate position of the beacon. It is worth to
mention that the distance calculated using RSSI measurements is not very accurate and
the three circles may not intersect at a single point. Circles can be grouped in many
different ways, where the classic Trilateration algorithm can produce high localization
error. This makes the implementation of Trilateration algorithm a challenging problem.
There are many different scenarios and every one of them needs an optimized algorithm
that solves a specific problem.
19
5.2 Develop a system architecture
In this section are described different parts of the system and their functionality. The
system consists of four parts, beacon device, node device, gateway device and server
device. Figure 10 shows different parts of the system and the role of each device.
20
Server calculates the distance between each node and the beacon based on the filtered
RSSI values. When the distance is calculated, the Server unit calculates the estimated
position of the beacon based on Trilateration algorithms.
• The moving device (BLE beacon) should be able to send advertising messages at
regular intervals.
• The fixed devices (BLE mesh nodes) should be able to pick up advertising messages
and transmit the messages through the BLE mesh network to the Server.
• The Server should be able to estimate the position of the moving devices and present
visually where the tracked devices are positioned.
As the sequence diagram in figur 11 shows, the beacon device transmitting advertising
packages at regular intervals. The callback function is called whenever the beacon event
happens. The node device communicate with all other nodes in the system through
the Bluetooth mesh network and relays packages to a particular address. The gateway
21
device subscribes to that address and forwards all incoming messages to the Server via
serial communication. Bluetooth mesh packages contain the local address of which node
has sent the package, RSSI, beacon ID and transmission power. Server sorts nodes and
chooses those with best RSSI values to calculates the distance between the node and the
beacon. Three distances is than used and calculate beacons position.
The application has two features Simulator and Scanner. The Simulator feature is used
to simulate a Beacon and EddystoneUID as the type of Beacon. The EddystoneUID have
a two fields Namespace ID and Instance ID, these specify what information is send inside
broadcasted advertising message. We use Instance ID and Namespace ID to specify which
Beacon is sending the message. Information consists of 16 bytes coded as hexadecimal
values.
A node must go through provisioning and configuration to become a part of the mesh
network. It must have a NetKey, publish address, ID and role to be able to send mesh
messages and to relay mesh messages. The provisioning and configuration is done with
AT-commands using s-center tool developed by u-blox.
22
The Gateway must go through provisioning and configuration to become a part of the
mesh network. It must have a NetKey, subscription address, ID and role to be able to
receive mesh messages and to forward them through a serial connection. The provisioning
and configuration are done with AT-commands using s-center tool developed by u-blox.
Positions of all the Nodes are stored in the text file. The text file is read when the
Node-Red starts. When data comes through the serial port, the RSSI value and Node ID
is retrieved from the payload and stored in the array, this process is repeated for every
incoming data message for 2 seconds time period. The array is then sorted based on RSSI
and three different Nodes with best RSSI values are chosen for positioning. The distance
between each of three Nodes and Beacon is calculated using empirical radio signal prop-
agation model.
When all information, three distances and Nodes position i available, the position of
the Beacon can be calculated. The information is processed by two algorithms, Extended
Min-Max and trilateration separately, this provides two estimations of the position that
are shown in Node-Red GUI. In case of trilateration algorithm the process of calculating
the position consist of two steps. The first step is to determine what case it is, what kind
of relationship the circles have to each other. The second step is to use the positioning
algorithm suited for that case.
In every test, the three distances and Nodes position is stored in the text file. It is
then used in Matlab for visualization purpose.
23
5.5 Observe and Evaluate the System
5.5.1 RSSI Filtering
Kalman filter is applied to system to reduce the noise. The Kalman filter is implemented
using equations described in section 2.4. The system has no input control so Bu(x) is set
to 0, Process noise is a constant and set to Q = 0.001, Measurement noise covariance is
a constant and set to R = 1, initial state estimate x(t-1) is set 0 and initial state error is
set to 0.
Table 1 shows the comparison between Kalman filtered RSSI and unfiltered RSSI. The
beacon is located at 1 meter, 3 meters and 5 meters away from the node. Tested is made
between a node and a beacon. The table shows difference distance ∆d using equation
(17), environment constant n = 2.5 and one meter RSSI A0 = −58 dBm. For example
RSSI1 = -62 dBm and RSSI2 = -53 dBm, d1 = 1.45, d2 = 0.63 which gives at ∆d = d1
- d2 = 0.82 m.
A0 −RSSI
d = 10 10n (17)
24
5.5.2 First test scenario in office environment
Scenario in figure 12 shows the environment for two sets of tests with unfiltered RSSI
and filtered RSSI, each set consists of four tests. Beacon was placed at four different
locations, one at a time and at least 20 measurements were taken. The room has obstacles
like furniture, computers, table panels and also Wi-Fi signals. Nodes were placed 0.5-1.5
meters above ground, antennas orientation were upwards.
Figure 13: The result of trilateration using filtered RSSI and unfiltered RSSI when beacon
was placed at location (1, 3).
Figure 13 shows the result of the first test. Beacon was placed at position (1, 3) and
20 measurements were taken and plotted in Matlab. The plot on the left side shows the
result of trilateration with unfiltered RSSI was most of the time the error is more than
1 meter. The plot on the left side shows the result of trilateration with filtered RSSI all
the estimated positions have less than 1 meter error. We consider the result in the right
25
plot to show better accuracy than the one on the left. In this test, the LOS was between
Node 1 and the beacon, Node 2 and the beacon and there were obstacles between the rest
of the nodes and the beacon.
Figure 14: The result of trilateration using filtered RSSI and unfiltered RSSI when beacon
was placed at location (3, 5).
Figure 14 shows the result of the second test. Beacon was placed at position (3, 5) and
20 measurements were taken and plotted in Matlab. The plot on the left side shows the
result of trilateration with unfiltered RSSI were most of the time the error is more than 1
meter. The plot on the left side shows the result of trilateration with filtered RSSI where
most of the estimated positions has less than 1 meter error. We consider the result in
the right plot to show better accuracy than the one on the left. In this test the LOS was
between Node 1 and the beacon, Node 2 and the beacon and there were obstacles between
the rest of the nodes and the beacon.
Figure 15: The result of trilateration using filtered RSSI and unfiltered RSSI when beacon
was placed at location (4, 3).
Figure 15 shows the result of the second test. Beacon was placed at position (4, 3) and
26
20 measurements were taken and plotted in Matlab. The plot on the left side shows the
result of trilateration with unfiltered RSSI was the estimated position is widely spread
out with the error varying from less than 1 meter to more than 2 meters. The plot on the
left side shows the result of trilateration with filtered RSSI where most of the estimated
positions have 2 meter error. Filtering made the estimated position more stable but the
error was still large. In this test, the LOS was between only Node 1 and the beacon, and
there were obstacles between the rest of the nodes and the beacon.
Figure 16: The result of trilateration using filtered RSSI and unfiltered RSSI when beacon
was placed at location (2.5, 1.6).
Figure 16 shows the result of the second test. Beacon was placed at position (2.5, 1.6)
and 20 measurements were taken and plotted in Matlab. The plot on the left side shows
the result of trilateration with unfiltered RSSI was the estimated position is widely spread
out with the error varying from less than 1 meter to more than 2 meters. The plot on the
left side shows the result of trilateration with filtered RSSI where most of the estimated
positions have 2 meter error. Filtering made the estimated position more stable but the
error was still large. In this test, there were obstacles between all of the nodes and the
beacon.
27
5.5.4 Second test scenario in office environment
Scenario in figure 17 shows the environment for two sets of tests. In the first set, a beacon
was placed at five different locations, one at a time and at least 20 measurements were
taken. In the second set, all doors were locked and the beacon was placed at two different
locations, one at a time and at least 20 measurements were taken. Nodes were placed
1-1.7 meters above ground, antennas orientation were towards the centre of the room
nodes were placed in. Every room has obstacles like furniture, computers, table panels
and also Wi-Fi signals.
28
5.5.5 Results of the second test scenario
Figure 18: The result of trilateration using filtered RSSI. Beacon at locations (3, 8.5) and
(11, 8).
Figure 18 shows the result of the second test scenario when the beacon was placed at
locations (3, 8.5) and (11, 8). Test measurements were plotted in Matlab. In the plot on
the left there was LOS between the beacon and the node. In the plot on the right there
were two nodes in the room but there were no LOS between the beacon and the nodes.
Figure 19: The result of trilateration using filtered RSSI. Beacon at locations (2, 4.2) and
(9.2, 3).
Figure 19 shows the result of the second test scenario when the beacon was placed at
locations (2, 4.2) and (9.2, 3). Test measurements were plotted in Matlab. In the plot on
the left there was LOS between the beacon and the node. In the plot on the left there
was LOS between the beacon and Node 2 and NLOS between the beacon and Node 6. In
the plot on the right there was LOS between Node 5, Node 4 and the beacon.
29
Figure 20: The result of trilateration in a NLOS environment using filtered RSSI. Beacon
is at locations (5, 6) and (5, 10).
Figure 20 shows the result of the second set of tests where the beacon was placed at
locations (5, 6) and (5, 10) in a hallway. Test measurements were plotted in Matlab.
Both plots shows result of distance estimation in NLOS environment.
30
5.5.6 Different cases of circles arrangements
While analyzing the results, we came across different possible cases of circles arrangement
shown in figure 21. On the left side of the picture are cases that can be handled by some
approach or algorithm, while on the right side are cases that can not be handled by any
approach or algorithm.
31
5.5.7 Comparison of Trilateration and Extended Min-Max algorithms
32
5.5.8 Calculation time of algorithms
Figure 22 shows an example of how long it takes for the server to calculate location after
data is received. Extended Min-Max is most of the time faster than Trilateration, but
it is worth to mention that E-Min-Max is a simple algorithm while Trilateration uses
recursion in some cases to calculate position. The longest time in this set of tests is 10
milliseconds and the lowest is less than 1 millisecond. Amount of nodes does not impact
the calculation time, but the server will not do any calculation if there are less than three
nodes that detect a beacon. Because both E-Min-Max and Trilateration implemented
uses data from three nodes to calculate location.
33
6 Analysis and Discussion
6.1 RSSI Filtering
The result presented in table 1 in section 5.5.1 shows that the RSSI measurements are
unstable and noisy. Unfiltered RSSI at 1 meter takes the values between -62 dBm and -53
dBm and with distance difference ∆d = 0.81 meter. This means that the environment is
very noisy which makes difficult to use RSSI to estimate the beacon position. The figure
23 shows unfiltered RSSI samples at a 1 meter distance within 60 seconds.
The RSSI measurements at 1 meter distance using the Kalman filter takes values between
-60 dBm and -59 dBm and with distance difference ∆d = 0.11 meter as shown in table
1 in section 5.5.1. The Kalman filter removes a lot of noise compared to unfiltered RSSI
and reduces the distance estimation error which gives a much better position estimation.
The figure 24 shows Kalman RSSI samples at 1 meter distance within 60 seconds.
34
The antenna of the Bluetooth device used in this thesis is very sensitive. Changing
the antenna orientation can cause differences in RSSI measurements and even human
interference can drop the RSSI values. Furniture and other devices running on the same
frequency can affect RSSI. All tests are made with the presence of all these obstacles.
The conclusion is that the use of RSSI for distance estimation is unreliable which makes
difficult to get good localization accuracy.
The results shows that LOS and NLOS have a big impact on the accuracy of the system.
When there was LOS between two nodes and the beacon the estimated the position was
very accurate with less than 1 meter error. When there was LOS between one node and
the beacon, the error was less than 2 meters and when there was NLOS the error was
varying from less than 1 meter up to 5 meters. Based on the previous information it is
clear that orientation, location and number of nodes have an impact on the system. If
the node is placed high on the wall with an antenna looking towards the centre of the
room, the probability of having LOS between the node and the beacon become higher. If
nodes are densely placed the probability of having LOS between two or more nodes and
the beacon become higher.
In this thesis we were limited to use RSS measurements to calculate the position of
the beacon, but there are other techniques that can be used. Apart from RSS there are
two widely used techniques for positioning, Angle of Arrival and Time of Flight.
Angle of Arrival technique requires complex hardware, special antennas that can detect
angle of the incoming signal, while the calculation of the position involve simple geometry.
35
It is possible to calculate position with only two nodes. According to [18], the average
error in a 6x3 meters room is around 0.14 meter. But it is unclear how NLOS impact the
AoA.
For indoor environment with high NLOS factor the best approach is to fuse ToF and
RSS for best result.
36
7 Conclusion
In section 1.3 we formulated problem and defined research questions for this thesis. Here
we will answer the questions.
• RQ1: Which algorithm should be used to calculate position based on RSSI mea-
surements in this project?
We tested both Trilateration and Extended Min-Max based on the data from the
tests in scenarios one and two. It is hard to say which algorithm is better in terms of
positioning accuracy. In some cases Extended Min-Max algorithm provides better
accuracy then Trilateration and in some cases Trilateration provides better accuracy
then Extended Min-Max. Best solution would be to use Extended Min-Max for the
cases handled best by Extended Min-Max and Trilateration for cases handled best
by Trilateration.
• RQ2: How does the amount and placement of the nodes impact the system?
• RQ3: What accuracy can be achieved in a mesh-based tracking system? How can
the accuracy be improved?
We used only RSS in our project to determine distance to the beacon and cal-
culate position based on these distances. In NLOS tests, the error was less then 2
meters 70% of time. In all other tests, the error was less than 2 meters in 83% of
time. The accuracy can be improved by adding Time of Flight to provide support
to RSS when RSS is noisy, while RSS provide support to Time of Flight in NLOS
situations.
37
References
38
[13] Rigado, BMD-300 Series Module for Bluetooth
https://www.rigado.com/products/modules/bmd-300/
[15] Cantón Paterna, Vicente et al. “A Bluetooth Low Energy Indoor Positioning Sys-
tem with Channel Diversity, Weighted Trilateration and Kalman Filtering.” Sensors
(Basel, Switzerland) vol. 17,12 2927. 16 Dec. 2017, doi:10.3390/s17122927
[16] Nunamaker, Jay F., et al. “Systems Development in Information Systems Research.”
Journal of Management Information Systems, vol. 7, no. 3, 1990, pp. 89–106. JSTOR,
www.jstor.org/stable/40397957.
[17] J. J. Robles, J. S. Pola and R. Lehnert, ”Extended Min-Max algorithm for position
estimation in sensor networks,” 2012 9th Workshop on Positioning, Navigation and
Communication, Dresden, 2012, pp. 47-52. doi: 10.1109/WPNC.2012.6268737
[20] S. Pradhan, S. Shin, G. Kwon, J. Pyun and S. Hwang, ”The advanced TOA tri-
lateration algorithms with performance analysis,” 2016 50th Asilomar Conference
on Signals, Systems and Computers, Pacific Grove, CA, 2016, pp. 923-928. doi:
10.1109/ACSSC.2016.7869184
[21] S. Hwang and S. Shin, ”Advanced TOA Trilateration Algorithm for Mobile Localiza-
tion,” 2018 IEEE Asia-Pacific Conference on Antennas and Propagation (APCAP),
Auckland, 2018, pp. 543-544. doi: 10.1109/APCAP.2018.8538295
[22] Li, J., Yue, X., Chen, J., & Deng, F. (2017). A novel robust trilateration method
applied to ultra-wide bandwidth location systems. Sensors (Switzerland), 17(4)
doi:10.3390/s17040795
39