• No results found

Demonstrator Development for Phone as a Key Based on Bluetooth Low Energy

N/A
N/A
Protected

Academic year: 2021

Share "Demonstrator Development for Phone as a Key Based on Bluetooth Low Energy"

Copied!
61
0
0

Loading.... (view fulltext now)

Full text

(1)

Department of Science and Technology

Institutionen för teknik och naturvetenskap

Linköping University

Linköpings universitet

g

n

i

p

ö

k

r

r

o

N

4

7

1

0

6

n

e

d

e

w

S

,

g

n

i

p

ö

k

r

r

o

N

4

7

1

0

6

-E

S

LiU-ITN-TEK-A--17/023--SE

Demonstrator Development for

Phone as a Key Based on Bluetooth

Low Energy

Eric Karlsson

Alexander Lagerbielke

(2)

LiU-ITN-TEK-A--17/023--SE

Demonstrator Development for

Phone as a Key Based on Bluetooth

Low Energy

Examensarbete utfört i Elektroteknik

vid Tekniska högskolan vid

Linköpings universitet

Eric Karlsson

Alexander Lagerbielke

Handledare Qin-Zhong Ye

Examinator Adriana Serban

(3)

Upphovsrätt

Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare –

under en längre tid från publiceringsdatum under förutsättning att inga

extra-ordinära omständigheter uppstår.

Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner,

skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för

ickekommersiell forskning och för undervisning. Överföring av upphovsrätten

vid en senare tidpunkt kan inte upphäva detta tillstånd. All annan användning av

dokumentet kräver upphovsmannens medgivande. För att garantera äktheten,

säkerheten och tillgängligheten finns det lösningar av teknisk och administrativ

art.

Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman i

den omfattning som god sed kräver vid användning av dokumentet på ovan

beskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådan

form eller i sådant sammanhang som är kränkande för upphovsmannens litterära

eller konstnärliga anseende eller egenart.

För ytterligare information om Linköping University Electronic Press se

förlagets hemsida

http://www.ep.liu.se/

Copyright

The publishers will keep this document online on the Internet - or its possible

replacement - for a considerable time from the date of publication barring

exceptional circumstances.

The online availability of the document implies a permanent permission for

anyone to read, to download, to print out single copies for your own use and to

use it unchanged for any non-commercial research and educational purpose.

Subsequent transfers of copyright cannot revoke this permission. All other uses

of the document are conditional on the consent of the copyright owner. The

publisher has taken technical and administrative measures to assure authenticity,

security and accessibility.

According to intellectual property law the author has the right to be

mentioned when his/her work is accessed as described above and to be protected

against infringement.

For additional information about the Linköping University Electronic Press

and its procedures for publication and for assurance of document integrity,

please refer to its WWW home page:

http://www.ep.liu.se/

(4)

Abstract

In this work a demonstrator for phone as a key has been developed. This demonstrator estimates the position of a mobile device in and around a test vehicle.

Trilateration, ROCRSSI and fingerprinting with neural networks have been investigated for the localization of the mobile device. To filter the input data Kalman filter and average mean filter have been investigated. The best performing technique was determined to be the use of neural networks with a Kalman filter.

The resulting demonstrator can determine if the mobile device is within the ranges of three prede-fined zones for the technology and three zones deprede-fined in the thesis. The demonstrator can estimate the location of the mobile device in real-time for these zones.

(5)

Acknowledgment

From the university, we would like to thank our supervisor Qin-Zhong Ye and our examiner Adriana Serban.

We would like to express great appreciation to ACTIA for the opportunity and for an interesting task, thanks to Oscar Holm, Lennart Strandberg and Inge Wallin at ACTIA for their support and guidance during the thesis work. Finally, we would like to express a special thanks to Henrik Carlgren at ACTIA for his guidance and technical expertise.

(6)

Contents

1 Introduction 1 1.1 Background . . . 1 1.2 Purpose . . . 1 1.3 Aim . . . 1 1.4 Research Questions . . . 1 1.5 Limitations . . . 1 1.6 Outline . . . 2 2 Theoretical Background 3 2.1 Passive Entry and Start Systems . . . 3

2.2 Phone as a Key . . . 3

2.3 Bluetooth Low Energy . . . 3

2.3.1 Introduction to BLE . . . 4

2.3.2 BLE Protocol Stack . . . 4

2.4 Received Signal Strength Indicator . . . 6

2.5 Filtering Methods . . . 7

2.5.1 Discrete Kalman Filter . . . 7

2.5.2 Moving Average Filter . . . 8

2.6 Localization Techniques . . . 9

2.6.1 Ring Overlapping based on Comparison of Received Signal Strength Indicator 9 2.6.2 Trilateration . . . 10

2.6.3 Fingerprinting . . . 12

2.7 Artificial Neural Network . . . 12

3 RSSI Characteristics 13 3.1 Relationship between RSSI value and distance . . . 13

3.2 Environmental influence on RSSI . . . 15

3.3 Different Smartphone Brands . . . 17

4 Demonstrator Design 19 4.1 Hardware Setup . . . 19

4.2 Software . . . 19

4.3 Data Collection . . . 19

4.4 Input Filter . . . 23

4.5 Ring Overlapping based on Comparison of Received Signal Strength Indicator . . . 25

4.6 Trilateration . . . 26

4.7 Neural Network . . . 27

4.8 Graphical User Interface . . . 35

(7)

5 Number of Antennas and Placement 37 6 Analysis and Discussion 41 6.1 RSSI Characteristics . . . 41 6.2 Demonstrator Design . . . 41 6.3 Antenna placement . . . 42 7 Conclusion 45 8 Future Work 47 References 48

(8)

List of Figures

1 Overview of the BLE protocol stack. . . 4

2 State machine of a BLE device. . . 5

3 Master device and slave devices connected in a star topology. . . 6

4 Example of one ROCRSSI ring, Phone must be located at a radius longer than B and shorter than C. . . 10

5 Example of ROCRSSI with several rings overlapping. . . 10

6 Trilateration example, intersection of three circles. . . 11

7 Cartesian plane with positions and radius vectors. . . 11

8 Comparison between mean and median value. . . 13

9 Measured relationship between RSSI value and distance for the ASUS BLE module. 14 10 Measured relationship between RSSI value and distance for the CC2650 BLE module. 14 11 Measured RSSI values and calculated RSSI values for the Texas Instruments CC2650 BLE module. . . 15

12 Difference of RSSI values for line of sight and through a human body. . . 16

13 Reading text rows on the USB-port using PuTTY. . . 20

14 A map over the locations where data was collected. . . 21

15 Picture of data collection. . . 21

16 Entry zones. . . 22

17 Welcome zone. . . 22

18 Kalman filter with Process noise of 0.1. . . 23

19 Kalman filter with Process noise of 1. . . 24

20 Average mean filter with 10 samples. . . 24

21 Average mean filter with 6 samples. . . 25

22 Areas for the ROCRSSI method. . . 26

23 Classification hierarchy for the Neural Networks. . . 27

24 Before and after normalization. . . 29

25 Flowchart of the data in the Neural Network. . . 30

26 first output from the neural networks. . . 31

27 Output from the neural networks with improved input filter. . . 31

28 Output from the neural networks with final input filter and normalization. . . 32

29 Output from the neural networks with the output filter. . . 32

30 Output from the neural networks with five entry points. . . 33

31 Output from the neural networks with three entry points. . . 34

32 Graphical User Interface v1.0. . . 35

33 Graphical User Interface v2.0. . . 36

34 First antenna setup. . . 37

35 Second antenna setup. . . 38

36 Third antenna setup. . . 39

(9)

38 Top point of view of two antennas antennas with 1 meter to the advertising device, the blue dot is the advertising device and the white dots are the antennas. . . 43 39 Two antennas antennas with difference height relative to the advertising device, the

(10)

List of Tables

1 Difference in RSSI between line of sight and through a human body . . . 15

2 Difference between smartphone brands . . . 17

3 Variables index and description for the classification of the neural network . . . 28

4 The events in the test walk, recorded for validation of the neural network . . . 30

5 Percentage of correct estimations from each neural network . . . 34

6 Antenna names and placement for the first setup . . . 37

7 Antenna names and placement for the second setup . . . 38

(11)

Abbreviations

ATT Attribute protocol BLE Bluetooth Low Energy GAP Generic Access Profile GATT Generic Attribute Profile

GFSK Gaussian Frequency Shift Keying HCI Host Controller Interface

html Hyper Text Markup Language IoT Internet of Things

L2CAP Logical Link Control and Application Protocol LF Low Frequency

PaaK Phone as a Key

ROCRSSI Ring Overlapping based on Comparison of Received Signal Strength Indicator RSSI Received Signal Strength Indicator

SMP Security Manager Protocol SoC System on Chip

SSH Secure Shell

(12)
(13)

1

Introduction

This chapter presents a introduction to the work and the problem formulation.

1.1

Background

ACTIA Nordic AB is a company which develops products for connected vehicles. ACTIA predicts that the physical car key will soon be redundant and that the future for unlocking cars is with a smartphone. This technique is called PaaK (Phone as a Key).

PaaK is a feature that enables a car user to gain the functionality currently offered in the PEPS (Passive Entry and Passive Start) feature, using their registered and authorized connected mobile device.

PaaK technology is delivered via detection of a customer’s mobile device within predefined zones, using BLE (Bluetooth Low Energy) technology.

1.2

Purpose

The purpose is to investigate if RSSI (Received Signal Strength Indication) is a useful positioning technique for this feature. Furthermore, to investigate how the accuracy is depending on the number of antenna modules and how the system can be calibrated for different type of vehicles. Different filters and suitable algorithms for processing the received antenna data will be evaluated with scripts developed in Python.

1.3

Aim

The aim of this work is to develop a working prototype for demonstration of the technique and to evaluate tracking methods. The demonstration prototype will demonstrate how the broadcasting device moves around and inside the car, from recorded data. This demonstrator could be upgraded to show the position in real-time.

1.4

Research Questions

In the project a demonstration prototype is developed. The technique in this project is that one phone, or other advertising device, is used to broadcast BLE packages which are received by several antennas in and outside the vehicle.

This leads to the following research questions: • RSSI characteristics

– How does the RSSI value depend on the distance?

– How does the RSSI characteristics depend on influence of obstacles?

– Are there any difference in the RSSI characteristics for different smartphone brands? • How many antennas are necessary for the task and how should they be placed?

• Which methods for localization and filtering are suitable for this project?

1.5

Limitations

The work is based on existing Bluetooth modules and no further hardware is developed. Further-more, security aspects will not be investigated. The security aspect is that only an authorized phone can unlock and start the car. The demonstrator in this thesis will localize any device advertising the right message.

(14)

The RSSI technique is the main technique to be investigated, other techniques as for example time of flight is not investigated.

1.6

Outline

The outline of the report is presented in this section. The report is divided into eight chapters and the bullet list below describes the content of each chapter.

• Chapter 1 - Introduction presents the introduction of the thesis together with the problem formulation and research questions

• Chapter 2 - Theoretical Background provides the necessary background theory for the work, about PEPS, PaaK, BLE, filtering, localization algorithms and Neural Networks • Chapter 3 - RSSI Characteristics describes the research of RSSI Characteristics done in

this work

• Chapter 4 - Demonstrator Design presents the design of the demonstrator and the resulting implementation

• Chapter 5 - Number of Antennas and Placement describes how the number of antennas and placements were investigated together with the result

• Chapter 6 - Analysis and Discussion presents an analysis and a discussion about the results in the work

• Chapter 7 - Conclusion conclusion of the work

(15)

2

Theoretical Background

In this chapter, the necessary background theory for this thesis work is presented: The Passive Entry and Start Systems, Phone as a Key and Bluetooth Low Energy concepts. RSSI description and the theory of Kalman filters, Average mean filters, ROCRSSI, Trilateration and Artificial neural networks.

2.1

Passive Entry and Start Systems

Passive entry and passive start is a technique where the user does not need to actively use its car key [1]. To unlock the car the driver just needs to touch the car door, this is called a passive entry. In order to start the car, the only requirement is that the key is inside the car. There is no need to insert the key into the keyhole, this creates a passive start.

In current vehicles that support passive entry and passive start the technique demands a special key. This key uses LF (Low-Frequency) to communicate with the car. The car sends out a LF signal to the key, the field strength is measured by the key, which returns the information to the vehicle. Via this measurement the vehicle can determine if the key is close to the car or inside the car.

A disadvantage with this technique is that the number of car keys limits how many people that have access to the car.

2.2

Phone as a Key

The purpose of the thesis work is to design a system that works like the Passive Entry and Start Systems. In this case the special key is replaced by a smartphone. The smartphone broadcast Bluetooth low energy advertisements to the vehicle continuously. These advertisements are received by several antennas placed in and around the car and the RSSI values for each advertisement are used to estimate where the phone is, relative to the vehicle.

The purpose of this method is to ease the user experience. If the smartphone is used to unlock and start the car, there is no need for a car key. With PaaK the idea is that it will be easier to access your own car and to share a car between several users.

In the PaaK technology the goal is to estimate if the position of the smartphone belongs to any of the three predefined zones: Welcome, Inside and Start. The welcome zone is defined as three meters around the body of the car, if the smartphone is in the Welcome zone, the lights of the car should be turned on. It should be possible to determine whether the smartphone is close to any of the entry points of the car. If the smartphone is sufficiently close to an entry point (two meters) the entry should be unlocked. This means that there are sub-zones to the welcome zone, one sub-zone for each of the entry points and one sub-zone for outside the entry points.

The inside zone is defined as anywhere inside the car, it has two sub-zones. One of the sub-zones is the start zone, which is defined as the area from the front seats and forward. The other sub-zone is defined as the remaining area inside the car.

Some disadvantages of the PaaK technology is that the RSSI values from the Bluetooth trans-mission are exposed to much noise, since other Bluetooth devices can interfere with the signals. Another problem is that Wi-Fi uses the same frequency band as Bluetooth, this means that Wi-Fi traffic in the area can disturb the signal between the smartphone and the vehicle. RSSI is also affected by obstacles in the environment such as walls, other cars and people.

2.3

Bluetooth Low Energy

The demonstrator that will be developed in this thesis work is based on the Bluetooth Low Energy technology. In this section, some background of the technology and the protocol are presented.

(16)

2.3.1 Introduction to BLE

Bluetooth Low Energy is a wireless technology developed by the Bluetooth Special Interest Group. The technology was developed for short range, low power communication applications. BLE is also known as Bluetooth smart and is a part of the Bluetooth 4.0 standard. Both BLE and classical Bluetooth is operating on a frequency of 2.4 GHz. Classical Bluetooth has up to seven times higher transmission capability compared to BLE [2]. Due to the low transmission capability, BLE does not support voice transmission. On the other hand, a BLE device can be connected to any number of peripherals, while the classical Bluetooth device is limited to 7 peripherals [3]. Despite the low transmission capability, the low power consumption makes BLE devices very useful for IoT applications. Healthcare, security, smart energy and indoor localization systems are some examples of where the BLE technology can be found. BLE is an emerging technology and within the near future it is expected to be used in billions of devices [4].

2.3.2 BLE Protocol Stack

The BLE protocol stack can be divided into two main parts, the controller and the host. The controller is found in the bottom of the stack and it consist of the physical layer and the link layer. The controller is typically a SoC (System-on-Chip) with an integrated radio which communicates with the outside world through the antenna and with the host through the standardized HCI (Host Controller Interface). The host comprises three protocols, namely the L2CAP (Logical Link Control and Application protocol), SMP (Security Manager Protocol), ATT (Attribute Protocol). Furthermore, the host comprises two main profiles, the GATT (Generic Attribute Profile) and the GAP (Generic Access Profile). An overview of the BLE protocol stack can be seen in Figure 1.

Figure 1: Overview of the BLE protocol stack.

The physical layer comprises the physical parameters for the communication protocol. The BLE technology operates with a frequency of 2.4 GHz. It consists of 40 physical channels with 2 MHz spacing. There are two types of channels, advertising and data channels. Out of the 40 channels, three are defined as advertising channels and 37 defined as data channels [3]. The advertising channels are used for advertising packets, device discovery and connection establishment. The data channels are used for bidirectional data transmission between two connected devices. The GFSK (Gaussian Frequency Shift Keying) is used as modulation method in all the physical channels, the modulation method allows reduced peak power consumption and smooth transitions between logical zeros and ones. The GFSK modulation method is explained further in [5].

(17)

The link layer is responsible for advertising, scanning, initiating and maintaining connections with other devices [6]. There are five common operation states defined for a BLE device, the states are scanning, advertising, standby, initiating and connected [6]. In Figure 2, a state machine of a BLE device can be seen.

Figure 2: State machine of a BLE device.

In BLE, an advertiser is any device which is transmitting data through the advertising channels. The advertising of packets in the advertising channels takes place in predefined intervals, so called advertising events. Devices with the purpose of receiving the advertised data are called scanners. A link for bidirectional data transmission can be established between two devices. For the link to be established it requires that the advertiser announces through the advertising channels that it is a connectible device. An initiator is a device which is in the initiating state, the initiator is searching for such advertisements. When the Initiator finds a connectible device, it can send a connection request to the advertising device and a point-to-point connection can be established [3]. The two connected devices can transmit data to each other through the data channels. A device will enter the standby state if it stops scanning or if its connection to another device is aborted. There are two different device roles for a connected device, the master and the slave role. The device for which the previous state was advertising will be the slave and the device for which the previous state was initiating will become the master [7]. A master device can be connected to multiple slave devices at the same time while the slave can only be connected to one master at a time. A master device connected to multiple slave devices follows a star topology as can be seen in Figure 3. A master device and its slaves is called a Piconet, a BLE device can only belong to one Piconet at a time.

(18)

Figure 3: Master device and slave devices connected in a star topology.

In the star topology, the master determines the instants for which the slaves must listen. Further-more, the master provides the slave with a map over which data channels to be used for the data transmission. The slaves are in sleep mode by default and wake up periodically to see if there are any requests from the master.

L2CAP is the multiplexing layer for BLE, it handles the multiplexing of data for ATT, SMP and the control signalling for the Link Layer [3]. There are two basic concepts defined; the L2CAP channel and L2CAP signalling commands. Those concepts are explained further in [6].

The rules for data accessing on a peer device are defined in the ATT. More about how the data is stored on an attribute server for read and write operations can be found in [6].

The SMP is responsible for pairing and for setting up a safe connection between devices. Authen-tication is used in the pairing process for the attempt of trusting another device [6]. Secrets can be shared from a slave to a master to prove their authenticity faster whenever they try to reconnect. The SMP also provides a security tool box for generation of data hashes, confirmation values and short-term keys which is used during the pairing process.

The GAP defines parameters for the pairing and connection establishment, it also defines whether the device should be configured as a central or peripheral device. Peripheral devices mostly sends BLE packets with a predefined interval while the central device is scanning for advertise BLE packets. The central device initiates the connection and sets the packet scan duty cycle [4]. The GATT defines a framework which is based on the ATT for exchange of characteristics and discovering of services from one device to another.

2.4

Received Signal Strength Indicator

One important feature of the BLE technology is the RSSI. The RSSI is defined as the ratio between the power of the transmitting antenna and the receiving antenna. The RSSI value is defined in the protocol and can be used without any additional measurements. According to the path loss model, the RSSI value decreases as the distance between the antennas increases. The RSSI value at the receiver is given by (1) [8].

(19)

Where, n is the signal propagation coefficient, d is the distance to the transmitter and A is the reference RSSI value measured at one meter distance.

If the variable d is isolated from (1), an expression for the distance is obtained, see (2). d= 10−RSSI +A

10·n [m] (2)

In (1) and (2), the variable n is varying depending on the propagation medium. In [8] a calibration method is proposed where the value of the constant can be determined with (3) together with an RSSI measurement from three meters and the reference RSSI value for one meter.

n= −RSSI3m− RSSI1m

10 · log(3 − 1) (3) The value of n should be a real number between 2 and 4 [8].

2.5

Filtering Methods

The data received from the RSSI measurement is noisy [9] and is therefore in need of filtering. In this subsection two suitable filtering methods are presented.

2.5.1 Discrete Kalman Filter

The Kalman filtering model [10] is a model that consists of two steps, prediction and correction. The prediction step is based on previous measurements and the correction step is based on the current measurement.

When creating a Kalman filter a model of the system is described with a set of differential equations. Measurements are taken with the interval (sampling time) Ts and therefore the filter must be

discrete. The differential equations for the Kalman filter can be found in [10] and these equations are simplified in [11] to (4) to (12).

This Kalman filter is a regular Kalman filter that is linear. This means that the transition from the current state to the next state should be a linear transformation. The general form of the transition model can be seen in (4).

xt= At· xt1+ Bt· ut+ ǫt (4)

Where, xt is a column vector with the states of the system, xt1 is the previous state, ut is the

control input, Atis the discrete fundamental matrix of the dynamic model, ǫtis the process noise

and Btis a transformation matrix.

In [11] it is assumed that the RSSI signal should be constant. This means that it is assumed that the device does not move. If the device does not move, the control input ut can be ignored and

the discrete fundamental matrix Atcan be set to an identity matrix. With these assumptions, (4)

can be simplified to (5).

xt≈ xt1+ ǫt (5)

The general form of the Kalman-filtering measurement can be seen in (6).

zt= Ct· xt+ δt (6)

Where, zt is the measurement vector, Ct is the measurement matrix and δt is the measurement

noise. This equation can be simplified to (7) since the RSSI is modelled directly.

(20)

Because of the assumption that the RSSI is constant, the prediction should be equal to the previous prediction. The prediction step of the Kalman filter can be seen in (8) and (9).

¯

µt= µt1 (8)

Where, ¯µt is the prediction, the bar denotes that measurements needs to be incorporated, µt1is

the previous prediction.

¯

Σt= Σt1+ Rt (9)

Where, ¯Σtis the certainty of the prediction, Σt1 is the previous certainty and Rt is the process

noise. The process noise is a parameter that can be determined by trial and error when designing the filter. When determining the value, it is a compromise between a fast response and smooth transition. Larger values of the process noise gives a faster filter.

The prediction estimate is used to calculate the Kalman gain. The Kalman gain is used as a weighting function between the certainty of the prediction and the certainty of the measurement. The equation for the Kalman gain can be seen in (10).

Kt= ¯Σt( ¯Σt+ Qt)− 1

(10) Where, Kt is the Kalman gain, ¯Σt is the certainty of the prediction and Qt is the measurement

noise. This measurement noise is chosen to be the variance of the RSSI signal.

To update the filter, and to filter the next measurements an update step is needed. (11) shows how the prediction is updated and (12) shows how the certainty of the prediction is updated.

µt= ¯µt+ Kt(zt− ¯µt) (11)

Where, µt is the prediction, ¯µt is the prediction that need measurements incorporated, Ktis the

Kalman gain and zt is the measurement.

Σt= ¯Σt− (Kt· ¯Σt) (12)

Where, Σtis the certainty of the prediction, ¯Σtis the certainty of the prediction that need

mea-surements incorporated and Kt is the Kalman gain.

The steps in (8) to (12) are then iterated for every sample, in order to filter the values. For further explanation of the filter and its parameters see [10].

2.5.2 Moving Average Filter

A moving average filter computes averages by sliding a window along the data. The general moving average filter is defined by (13) [12].

y[n] = 1 M1+ M2+ 1 M2 X k=M1 x[n − k] (13) Where, y[n] is the nth output, M

1 is the index of the first sample in the window, M2 is the index

of last sample in the window and x[n − k] is the sample.

This filter operates at every sample to smoothen out the differences between the samples. The window size decides how many samples that must be available to do the filtering, this means that if M1 is zero and M2 is five the filter will calculate the average value for six samples. If the filter

is implemented to filter the samples in real-time there will be a time delay, in the case with M1is

(21)

To affect the moving average filter so that it, for example gives earlier samples more importance, weights can be introduced. The filter’s name is then changed to weighted moving average filter. In [13] the weighted moving average filter is implemented and compared to the Kalman filter. The conclusion in [13] is that compared to the moving average filter the Kalman filter needs to build more before it can start filtering and need more time.

(14) shows a simple type of weighted moving average filter and (15) shows a more complex type of weighted moving average filter, both filters are taken from [13].

y[n] = a · x[n − 1] + (1 − a)x[n] (14) Where, y[n] is the nth

output, x[n − 1] is the previous sample, x[n] is the current sample and a is constant between 0 and 1. It is a parameter that is used to define that relationship between the previous and current sample.

y[n] = a3

x[n − 3] + a2

x[n − 2] + a(1 − a)x[n − 1] + (1 − a)x[n] (15) Where, y[n] is the nth

output, x[n − 3] is the third previous sample, x[n − 2] is the second previous sample, x[n − 1] is the previous sample, x[n] is the current sample and a is a constant with value less than one.

In (15) the variable a must be less than 1. Hence, the condition in (16) must be fulfilled.

a2(1 − a) < a(1 − a) < 1 − a (16)

2.6

Localization Techniques

To localize where the phone is, in relation to the car, a localization technique is required. Localiza-tion techniques via signal strength are mainly categorized into two cases. The first one is to gather information offline before the system operation and the second one uses mathematical methods to determine the device’s location during the system operation [14].

2.6.1 Ring Overlapping based on Comparison of Received Signal Strength Indicator ROCRSSI (Ring Overlapping Based on Comparison of Received Signal Strength Indicator) is a range free mathematical localization method, which means that the method does not try to estimate the point-to-point distance between the receiver and sender [15]. The method does not require the receiver nodes to send control messages. However, it gives an accurate location estimation and it is robust under disturbance in the propagation pattern.

The ROCRSSI method compares RSSI values and generates rings dependent on the RSSI values. For example, four devices called A, B, C and Phone are considered. The device A sends out a message and the other devices receives this message.

If the signal strength between the Phone and A is stronger than the signal strength between A and C, and at the same time less than the signal strength between A and B (see the condition in 17). The Phone device can then be estimated to have a distance to the device A that is longer than between A and B and shorter than the distance between A and C.

This is illustrated in Figure 4. The Phone device must then be located within the grey area in the figure.

(22)

Figure 4: Example of one ROCRSSI ring, Phone must be located at a radius longer than B and shorter than C.

If more senders are introduced, more rings will appear and the localization accuracy increases. When two rings are used there are two possible locations where the device can be located in. See the two grey areas in Figure 5a. If a third ring is added, the location of the device is estimated with a single area see the grey area in Figure 5b.

(a) Two rings overlapping. (b) Three rings overlapping.

Figure 5: Example of ROCRSSI with several rings overlapping.

When using three rings or more the location of the device can be determined, since there is only one possible area of where the device can be located.

2.6.2 Trilateration

Trilateration is a range based mathematical localization method, which needs at least three fixed anchor nodes with known positions to locate an advertising device. The method uses the intersec-tion point of three circles to determine the exact posiintersec-tion of the advertising device [8]. The radius of each circle is calculated from the RSSI values of the anchor nodes. The principle of the method can be seen in Figure 6. In Figure 6, P1, P2 and P3 are the positions of the three anchor nodes, r1, r2, r3 are the estimated radius for each of the circles.

(23)

Figure 6: Trilateration example, intersection of three circles.

According to [8] a Cartesian plane can be used to simplify the calculations of the intersection point. The positions (P1, P2 and P3) and radius vectors with new directions (r1, r2 and r3) from Figure 6 placed in a Cartesian plane can be seen in Figure 7.

Figure 7: Cartesian plane with positions and radius vectors. The equation for each circle can be seen in (18) [8].

(x − xi) 2 + (y − yi) 2 = r2 i (18)

Where, x, y is the x- and y-coordinates for the position of the intersection point, xi, yiis the x- and

y-coordinate for the position of the anchor node with index i. Furthermore, ri is the radius vector

between the position of the intersection point and the position of the anchor node with index i. The system for the radius vectors in Figure 7 can be seen in (19).

(24)

     (x − x1) 2 + (y − y1) 2 = r2 1 (x − x2) 2 + (y − y2) 2 = r2 2 (x − x3) 2 + (y − y3) 2 = r2 3 (19) In order to obtain the position of the intersection point, the linear system in (19) has to be solved. 2.6.3 Fingerprinting

The fingerprinting method starts with a calibration step [14] to collect RSSI values for different known positions, to create what is called a radio map. This calibration step is done offline before the system operates. The radio map is basically a list of combinations of the RSSI values from all nodes at different locations. A mobile device can be localized by comparing its RSSI values with the radio map.

The calibration can be done in two other methods as well. These methods are unsupervised fingerprinting and partial fingerprinting [16]. For unsupervised fingerprinting the radio map is created via propagation models for the radio wave. The model predicts the RSSI values and need to know the location and material of walls and floor etc. The partial fingerprinting is a combination of manually collected data and prediction via calculations.

When the data to the radio map is collected it is processed, with for example a neural network [17]. The neural network is trained with the collected data, in order to recognize the pattern between the RSSI values from different nodes and the location of the mobile device.

2.7

Artificial Neural Network

An artificial Neural Network mimics the learning process of the neurons in the human brain. It transfers input data to output data via interconnected neurons [16]. The neural network can be used to recognize patterns. In this work it will be used to process the fingerprinting data to locate the advertising device.

The neural network consists of several nodes and layers, the nodes take the input data, from the previous layer, multiplies the data with a vector of weights, and adds a scalar bias. These steps create the activation function.

There are three types of layers: input layer, hidden layer and output layer. All nodes of the same layer share the same activation function but have different weights and biases.

In order to use the neural network, it must first be trained. The purpose of the training is to decide the values of the weights and biases, while the activation function and number of layers are fixed. In [16], backward error propagation is used, which means that the training is done to find weights and biases that minimize the error between the target and the output. The training process is repeated until certain conditions are fulfilled and can therefore be time consuming. If a neural network is used for classification between zero and one, at least two sets of training data are needed. One negative training set for when the output should be zero and one positive training set for when the output should be one.

(25)

3

RSSI Characteristics

Since RSSI is the technique used for all localization methods in this work, the characteristics of the RSSI were interesting to be examined. This chapter describes the investigation of the RSSI characteristics together with the result. Three characteristics were examined, a) how the RSSI changes with distance, b) how the RSSI is affected by the surroundings and c) if there are any differences between smartphone brands.

Since the RSSI is noisy, a single sample of the RSSI value is misleading, therefore several samples were collected and the mean and median values were calculated and compared.

Figure 8 shows RSSI values from a measurement with a distance of one meter between the trans-mitter and the receiver. The transmitted power was set to -56 dBm, this means that the received power from one meter should be -56 dBm.

Figure 8: Comparison between mean and median value.

From Figure 8, it can be seen that most of the data is gathered around -57.5 dBm which is a realistic value, but there is some data in the range -72.5 dBm to -75 dBm which is lower than expected. The data from this measurement was used to compare whether the mean value or the median value was the most representative for the data collection.

The calculated median and mean values of the measured RSSI was therefore plotted in the same graph as the raw RSSI values. In Figure 8 the red line is the median value and the blue line is the mean value of the RSSI values. From the plot it was determined that the median value was the best representation of the collected data, since it is not affected by a few high or low values.

3.1

Relationship between RSSI value and distance

From the theory section, it is known that the relationship between the RSSI value and the distance is non-linear. To verify the behaviour of the RSSI, measurements were done with different distances between the transmitter and the receiver. The expected behaviour is described by (1).

Data was collected with a ASUS USB-BT400 Bluetooth 4.0 USB Adapter and a CC2650 Launchpad BLE module from Texas Instruments. The data was collected in ACTIA’s garage and 600 samples were collected for each distance. Two different BLE modules were used for data collection to investigate if there was any difference in the RSSI value, between the modules.

(26)

The relationship between the distance and RSSI value for the ASUS BLE module can be seen in Figure 9.

Figure 9: Measured relationship between RSSI value and distance for the ASUS BLE module. It can be seen in Figure 9 that the measured RSSI values from the ASUS BLE modules does not follow the nonlinear (1).

The relationship between the distance and RSSI value for the Texas Instruments CC2650 BLE module can be seen in Figure 10.

Figure 10: Measured relationship between RSSI value and distance for the CC2650 BLE module. In Figure 10 it can be seen that neither does the Texas Instruments CC2650 follows (1).

The result from the measurements with the Texas Instruments CC2650 module was compared with the expected behaviour. To calculate the expected behaviour, the variable n in (1) had to be

(27)

calculated.

Data was collected for two distances between the transmitter and the receiver, these distances were one and three meters. 80 samples of the RSSI were collected, the median for each collection was used to calculate n with (3).

When n was calculated for the Texas Instruments CC2650 BLE module, the expected RSSI values were calculated and plotted together with the measured RSSI values, which can be seen in Figure 11.

Figure 11: Measured RSSI values and calculated RSSI values for the Texas Instruments CC2650 BLE module.

It can be seen in Figure 11 that there are irregularities between the calculated and the measured RSSI values. It is therefore hard to determine the distance between the transmitter and the receiver based on the RSSI value.

3.2

Environmental influence on RSSI

It was interesting to investigate how the RSSI is affected in the measurement scenario of the human body presence. Therefore, measurements were done with the advertising device placed in front and behind a human body. These measurements were done for different distances between the transmitter and the receiver. 225 RSSI samples was collected for the distances 1, 1.5, 2, 2.5 and 3 meters and the median RSSI was calculated, for each distance. The result of the measurements can be seen in Table 1.

Table 1: Difference in RSSI between line of sight and through a human body Distance [m] RSSI Line of sight [dBm] RSSI Through a human body [dBm]

1 -55 -68

1.5 -54 -71

2 -60 -69

2.5 -59 -73

(28)

In Table 1, the difference in RSSI between different distances does not change as expected, with decreasing RSSI for increasing distance. However, what is important is that there is a difference between RSSI value with line of sight and that through a human body. This means that the human body had an impact on the RSSI value.

Figure 12 shows how the RSSI values are distributed for the case when it is two meters between the transmitter and the receiver. In the figure, the blue dots are the RSSI values for line of sight and the red dots are the RSSI values for when there is a human body between the transmitter and the receiver.

Figure 12: Difference of RSSI values for line of sight and through a human body.

In Figure 12 it can be seen that the RSSI values from the measurement with a human body between the transmitter and the receiver have a lower value. This means that the human body attenuates the signal. If the distance equation (1) combined with the calculated n-value is used for the values at two meters, shown in Table 1 the difference between the measurements would be 4.8 meters.

(29)

3.3

Different Smartphone Brands

A test with different smartphones was performed to investigate if there were any differences in RSSI between smartphone brands. In this test, different smartphones were placed one meter from a Texas Instruments CC2650 BLE module that received advertisements from the smartphones. To send advertisements an application called Beacon Simulator was used. The idea was that the received signal strength should be the same for all smartphones when using the same application settings. 80 samples from each smartphone was recorded and the median of these samples was calculated. The result from this test can be seen in Table 2 where the values are the median value of each measurement.

Table 2: Difference between smartphone brands

Samsung Galaxy S7 Edge Sony Xperia Z5 LG Nexus 5X Samsung Galaxy Tab S2 -74 dBm -63 dBm -64 dBm -73 dBm

The result in Table 2 shows that it is a difference between the RSSI from different smartphones when using the same settings in the application.

(30)
(31)

4

Demonstrator Design

In this chapter, the development and implementation of the demonstrator are described.

4.1

Hardware Setup

Two different hardware setups have been used to measure the RSSI values.

The first hardware setup was consisting of six BLE antennas connected to a computer through a USB hub. The computer was running the Linux operating system. The antennas used in the first setup was ASUS USB-BT400 Bluetooth 4.0 USB Adapter.

The second hardware setup consisted of eight CC2650 Launchpad BLE modules from Texas In-struments. These antennas were connected to a Raspberry Pi through a USB hub. The Raspberry Pi was running the Raspbian operating system. The Raspberry Pi was used to collect the RSSI measurements from the modules and to process the data.

The RSSI measurement is built-in in all BLE devices and therefore no extra hardware was needed for the RSSI measurements.

4.2

Software

Most of the software was developed in the Python programming language. The language was chosen since the interpreter and its libraries are free and easy to access. Python scripts are also easy to run on Linux based computers. Other programming languages that have been used through the project are C and html.

4.3

Data Collection

For the first hardware setup, a free software named Wireshark was used to collect the BLE packages from the ASUS Bluetooth Adapters. The packages were including information about the payload, the RSSI value and the MAC address to the recording antenna. The corresponding MAC address was mapped to its antenna location so the RSSI values could be analysed with respect to its location.

For the second hardware setup, a program written in C was used to configure the modules from Texas Instruments. The BLE modules were configured as observers and to simplify the data collection process, the modules continuously sent text rows to the Raspberry Pi. The modules printed the antenna number, measured RSSI value and the payload on each text row. The text row was transmitted via the UART serial communication protocol on the USB-port. To verify the UART communication, PuTTY was used. PuTTY is a free SSH (Secure Shell) and telnet client for Windows. Figure 13 shows an example for when PuTTY is used to read the transmitted text.

(32)

Figure 13: Reading text rows on the USB-port using PuTTY.

To collect the packages on the Raspberry Pi, a script was written in Python. The script used threads to read lines from different USB ports at the same time, one thread per USB port. The script gave the collected packages a time stamp and stored the packages into a file.

For the first hardware setup data was collected from fixed locations in and around the car. A map over the locations can be seen in Figure 14.

(33)

Figure 14: A map over the locations where data was collected.

The blue dots in Figure 14 correspond to the locations from which data was collected. An example for when data is collected from one of these locations can be seen in Figure 15.

Figure 15: Picture of data collection.

For the second hardware setup, data was collected from the predefined zones for PaaK, two of these zones can be seen in Figure 16 and Figure 17. Figure 16 shows the zones for the entry points.

(34)

To unlock for example the driver’s door, the PaaK definition is that the advertising device must be inside a circle with a radius of two meters near the driver’s door. Since the vehicle in the figure has five entry points there is five circles, that corresponds to each entry point.

Figure 16: Entry zones.

Figure 17 shows the welcome zone, which is defined as three meters around the body of the car.

(35)

Data was collected from each zone of the entry points in Figure 16, from the welcome zone shown in Figure 17, from the inside zone and the start zone. To determine which zone the advertising device is in, data from both inside and outside the zones were necessary. Therefore, data was also collected from outside each zone. The collected data created a radio map for the system.

To test the system some test walks were recorded, these test walks were recorded by walking around and inside the car with the advertising device. To determine how well the system worked the test walks were filmed with a smartphone. The video was then used to compare if the system reacted at the same time as the event in the video.

Data collected from inside and outside the zones are referred to as training data and the test walks are referred to as test data.

4.4

Input Filter

Since the RSSI measurements are noisy, processing of the incoming data is essential. Filter algo-rithms were used to reduce the noise level before the RSSI value was used for localization estimation. The Kalman filter and average mean filter were implemented in a Python script for evaluation. In order to evaluate the different filter designs, data was collected for the case when a person with an advertising BLE device was moving towards an antenna. Different values for the process noise in the Kalman filter and window size in the average filter was evaluated.

In Figure 18, the blue dots corresponds to the measured RSSI values and the red line is the same data processed with a Kalman filter with a process noise of 0.1.

Figure 18: Kalman filter with Process noise of 0.1.

It can be seen in Figure 18 that all peaks are attenuated in the processed data, which means that large derivatives in the input data are ignored. On the other hand, the processed data becomes stable.

The process noise was changed to a larger value to obtain a faster filter and still reduce the noise to a sufficient level. In Figure 19 the same measured raw data are the blue dots and the new filter output is the red line.

(36)

Figure 19: Kalman filter with Process noise of 1.

In Figure 19, it can be seen that the noise level is higher than in Figure 18, but the filter is also faster.

Figure 20 shows when the measured RSSI values were processed with an average mean filter with a window size of 10 samples, the filter output is the red line in the figure.

Figure 20: Average mean filter with 10 samples.

It can be seen in Figure 20 that the filter output is delayed compared to the measured data, in order to reduce the delay a smaller window size were examined.

The filter output of an Average mean filter with a window size of 6 can be seen in Figure 21. The filter is faster than the filter in Figure 20 but on the other hand the noise level is increased.

(37)

Figure 21: Average mean filter with 6 samples.

After evaluating the performance of the filters the Kalman filter was chosen for the implementation.

4.5

Ring Overlapping based on Comparison of Received Signal Strength

Indicator

The ROCRSSI method is dependent on differences between signal strengths from different devices. In section 2.6.1, the ROCRSSI method compares three RSSI values to determine whether a receiver is located between two other receivers. In this thesis work the device that is to be located is the sender and therefore modifications to the method were done.

The solution for ROCRSSI was that the antenna placed between the front seats was configured to send advertisements. The RSSI value from the advertisements sent by the antenna was then compared to the RSSI from the advertising device. If the RSSI from the advertising device is smaller than the RSSI from the advertising antenna at one receiving antenna, it can be estimated that the advertising device is located somewhere between the antennas, this is defined as a match. Four antennas were used to check if they have a match. A match gives an area around the antenna where the advertising device is estimated to be located.

The method could not be used outside the car since no rings were overlapping, instead the solution for ROCRSSI estimates the location of the advertising device inside the car.

Figure 22 has light grey areas around each antenna, this area is where the advertising device can be if the antenna have detected a match. If two matches from two antennas are combined then the advertising device must be located in one of the darker grey areas in Figure 22. The darker grey areas in the figure appear at four locations, this means that the solution for the ROCRSSI method can detect if the advertising device is in any of these four locations.

(38)

Figure 22: Areas for the ROCRSSI method.

In theory, this solution should be able to classify which of the four locations the advertising device is located in. Although the result from experiments with this method showed that the method did not work as intended, therefore localization with this solution was not considered for the demonstrator.

4.6

Trilateration

A Python script was written to solve the Trilateration equations shown in (19). In (19), x and y corresponds to the coordinates where the advertising device is estimated to be.

In (19), x1, x2, x3, y1, y2, y3are the positions of the antennas used for the Trilateration. Since these

positions are known, (19) can be expanded and all variables that contains these values can be replaced with parameters calculated for each antenna position. Replacing these values results in (20).      B1+ A1· x + x 2 + C1+ D1· y + y 2 = E1 B2+ A2· x + x 2 + C2+ D2· y + y 2 = E2 B3+ A3· x + x 2 + C3+ D3· y + y 2 = E3 (20) Where, A, B, C, D, and E are parameters that are calculated using the positions of the antennas. This equation system was then simplified, using substitution of the equations, to the equation system in (21). This results in a equation system that is easier to be solved.

(

Ax+ By = C

Dx+ Ey = F (21) where: A = A1− A2,B = B1− B2,C = E1− E2− (B1− B2)−(C1− C2), D = A2− A3, B = B2− B3,

E= C2− C3and F = E2− E3− (B2− B3) − (C2− C3).

Since the solution uses the substitution method, there are some cases when the parameters in (21) can be equal to zero. These cases are when the x- or y-position of two antennas are the same. The script works fine for the case when the RSSI values intersects, however due to the noise this does not occur often. Therefore localization with Trilateration was not considered for the demonstrator.

(39)

4.7

Neural Network

Neural networks were implemented in a Python script, based on the library fann2 (fast artificial neural network 2). Eight neural networks were defined, one for the welcome zone, five networks for the vehicle entries, one for inside the vehicle and one for the start zone. The collected data was used to train the neural networks to detect a given zone, the back-propagation method was used for the training. Each of the networks was used to classify whether the device was in a certain zone. The output of the neural networks is in the range between zero and one, where one means that the neural network estimates that a state is true. If the output is zero it means that the neural network estimates that a state is false. When the output is in the range between zero and one it means that the neural network cannot determine a certain state, but it can be seen as an indicator. For example, if the output is 0.8 it indicates that the state is true and if the output is 0.2 it indicates that the state is false.

A classification hierarchy was established to classify in which zone the advertising device was located for a certain data set. In the classification hierarchy, a variable was set to minus one if there was no possibility for the state to be true. The classification hierarchy can be seen in Figure 23.

Figure 23: Classification hierarchy for the Neural Networks.

A list of the variables used in Figure 23 can be seen in Table 3. Each variable corresponds to an output of the neural networks.

(40)

Table 3: Variables index and description for the classification of the neural network Variable Description

i inside the car s start zone w welcome zone

e1 entry 1, right front door e2 entry 2, right back door e3 entry 3, trunk

e4 entry 4, left back door e5 entry 5, right front door

As can be seen in Figure 23, the first classification is whether the advertiser is inside the car or not. If it is inside the car it cannot be in the welcome zone at the same time, therefore the variable

w is set to minus one. If the device is inside the car, then the Neural network for the start zone

determines if it is in the start zone or not. If the advertiser is not inside the car it cannot be in the start zone at the same time, hence the variable s is set to minus one. If the device is not in the welcome zone it cannot be in any of the entry zones, therefore the variables corresponding to the entry points are set to minus one.

The neural networks used a sigmoid function with values between zero and one. Since the collected data was RSSI values which is not between zero and one, normalization was needed. The normal-ization was done by an assumption that the value of the RSSI was within the range -90 dBm to -40 dBm. If the value of the RSSI was smaller than -90 dBm it was set to -90 dBm, if the value was larger than -40 dBm it was set to -40 dBm. This means that after this step all data is within the range -90 dBm to -40 dBm. The RSSI values was then changed to positive values so that the range 40 to 90 was achieved. From these values 40 was subtracted to change the values from zero to 50, and all values was divided by 50. (22) shows this normalization. After the normalization, all data was in the range zero to one.

−x − 40

50 (22)

Where, x is the RSSI value. If the RSSI value is the highest assumed (-40 dBm) the normalized value is zero, if the RSSI value is the lowest assumed (-90 dBm) the normalized value is one. Therefore, all values higher than -40 dBm is also normalized to zero and all values lower than -90 dBm is normalized to one.

(41)

Figure 24: Before and after normalization.

Before the normalization the input data was filtered. For the first hardware setup, the training data was collected from static locations and the test data was collected with the advertising device moving. In this case the neural network had several input filter configurations, one for the training data and another for the localization step. Both filters were Kalman filters and the difference between the filters was the prediction model. Since the training data was collected from static locations, the prediction model assumed that there was no difference in the current RSSI value compared to the previous value. For the test data, it was known that the advertising devise was moving and the prediction step assumed that the RSSI value was always increasing.

For the second hardware setup, both training and test data was collected with the advertising device moving. In this case the neural network had only one input filter configuration, with the assumption that there was no difference in the current RSSI value compared to the previous value. This creates a kind of inertia in the filter that disregard fast changes.

After the filtering and normalization, the data can be used for either training of a neural network or as input to an already trained network. A flowchart of the data through the neural network can be seen in Figure 25. Several steps are dependent on each other and a change in one step change the output of the whole network.

(42)

Figure 25: Flowchart of the data in the Neural Network.

In Figure 25, training means that a neural network uses the data for training. Usage means that the data is used in an already trained neural network.

To develop a neural network that worked well for the task, these steps were changed and improved, by trial and error. The process noise in the input filter was the first parameter to be changed in pursuit of a better result.

To validate whether the changes in the system improved the output, a test walk was recorded. The event in the test walk is described in Table 4.

Table 4: The events in the test walk, recorded for validation of the neural network Expected Outputs Approximate Time [s] Event Welcome Inside Start 0 Start outside the welcome zone 0 0 -1 10 Enter the welcome zone 1 0 -1 20 Enter the car and start zone -1 1 1 35 Exit the car and enter welcome zone 1 0 -1 45 Enter the car but not start zone -1 1 0

The output from the neural networks for the test walk in Table 4 can be seen in Figure 26. This output is from the first test, without any improvements.

(43)

Figure 26: first output from the neural networks.

When changing the process noise, it was discovered that different values of the process noise for the training and for the usage of the network gave a better result. A higher process noise in the training process than in the usage gave the best result. Figure 27 shows the output from the networks when the process noise for the training process is larger than for the localization process.

Figure 27: Output from the neural networks with improved input filter.

When the input filter was improved and worked well, changes of the normalization was done. At first one normalization was used for all cases, this was then changed. Since the welcome zone is further away from the antennas than the inside zone, the welcome zone should have a normalization that focus on lower RSSI values than for the inside zone. Therefore, a solution with several normalizations were introduced. The solution with several normalizations worked better than with one general normalization. With several normalizations, the neural networks worked fine for the welcome zone, the inside zone and the start zone as can be seen in Figure 28.

(44)

Figure 28: Output from the neural networks with final input filter and normalization. An output filter which filter the output from the neural networks to zero or one, was implemented to improve the result further. This filter compares the output from the neural networks with two threshold values, one upper and one lower threshold. If the output from the neural network is higher than the upper threshold, the filtered value is set to one. The filtered value is not changed from one to zero until the output is below the lower threshold. In the same way, the filtered value is not changed from zero to one until the output of the network is above the upper threshold. This creates a kind of inertia in the filter. The result after implementing the output filter can be seen in Figure 29.

Figure 29: Output from the neural networks with the output filter.

The result in Figure 29 shows that neural networks are able to classify if the advertising device is inside the welcome zone, inside zone or start zone. These networks were then used in the implementation of the demonstrator.

(45)

To develop networks for the entry points, a new test walk was recorded. The new test walk was recorded for the case when the advertising device was moved along the entry points around the car. In the beginning of the test walk the advertising device was located next to entry point one, then it was moved towards entry point two and so on.

The same network configurations, which gave the best result for the previous networks was used. The expected result was that the network for each entry point should be triggered, one after each other.

The result for the test walk can be seen in Figure 30.

Figure 30: Output from the neural networks with five entry points.

As can be seen in the Figure 30, the networks cannot determine which door the advertising device is located next to.

A small set of training data was collected from fixed locations to examine if this gave a better result. The test gave an indication that training data from fixed locations could give a better result for the entry points.

In order to simplify the detection of an entry point, the definition of the entry points was redefined. The new definition was three entry points instead of five. The new entry points were defined as right, left and behind.

New data was collected for the new definition of the entry points. The new data was collected from fixed locations on each side of the car.

The result from the new definition of the entry points can be seen in Figure 31 where the test data is collected from the right side of the car, this means that the expected output from the networks should be that the right side has the highest value.

(46)

Figure 31: Output from the neural networks with three entry points.

The result in Figure 31 was considered an improvement of the entry points. The output filter used in the previous networks was not used in this case. Instead a comparison of the outputs from the three networks were implemented. The comparison of the outputs from the networks were based on the median of five samples from each network. The network with the highest median value and a value above a threshold was considered to represent the most likely location of the device. The threshold was needed since there is one case when the device is inside the welcome zone but not inside any of the entry zones. The reason why five samples were used was to disregard fast changes. The new definition of the entry points was used in the implementation of the demonstrator. In the graphical representation of the outputs from the neural networks it is easy to see the improvements of the neural networks, but it is hard to determine how accurate the neural networks are compared to reality. To determine the performance of the networks new tests were recorded. In these tests, all data were collected with the advertising device moving in only one zone for each collection.

The output from the neural network, corresponding to the zone where the data was collected should then be true for all samples. The numbers of true output values from the network were divided by the number of collected data samples and in this way the accuracy on the neural network could be presented in percentage. The results from this test can be seen in table 5.

Table 5: Percentage of correct estimations from each neural network Neural Network Result [%]

Welcome 62 Inside 100 Start 92 Right 97 Left 89 Behind 49

(47)

The results in Table 5 are from one measurement and the output filter corresponding to each neural network were used. This means that the results from the neural networks: Right, Left and Behind where based on the comparison of the three networks.

4.8

Graphical User Interface

To illustrate the location of the broadcasting device a GUI (Graphical User Interface) was devel-oped. The first draft of the GUI was a Python script reading a position (x- and y-coordinates) from a file and updating the position in a Cartesian plane. The first draft of the GUI can be seen in Figure 32, where the red dots corresponds to the antenna locations and the blue dot is the estimated position of the advertising device.

Figure 32: Graphical User Interface v1.0.

The x- and y-axis in Figure 32 have the units meter and the distances between the red dots are the measured distances to the corresponding antennas in the car.

The GUI was used to evaluate the Trilateration algorithm, the estimated position from the algo-rithm was plotted in the GUI and this plot was then compared to the actual position where the RSSI value was collected. This GUI was used to determine that the Trilateration script did not perform well with the collected RSSI values.

The first draft of the GUI was used with the first hardware setup. The GUI was then updated for the second hardware setup. In the second hardware setup, the Raspberry Pi was used as a Wi-Fi access point. The final GUI was therefore a html (Hyper Text Markup Language) based web-page and can be seen in Figure 33.

(48)

Figure 33: Graphical User Interface v2.0.

In Figure 33 the advertising device is estimated to be located inside the car. This is illustrated with the green area inside the car and the text "INSIDE".

To access the final GUI the user must connect to the Raspberry Pi, via Wi-Fi and after this go to the specific web-page. The second GUI did not show the position in the same way as the first one did, instead of showing the exact position the final GUI showed which zone the advertising device is estimated to be in. With this method, the GUI could be used for the neural networks.

4.9

Real-Time Implementation

A real-time demonstrator gives better demo effect, since it is easy for a crowd to see the events in the GUI and at the same compare the events with the reality. The graphs from the recorded data can be hard to understand and a better visualization was required. Therefore, a real-time implementation was developed, when the neural networks and the GUI worked as intended. The real-time implementation was a Python script running on the Raspberry Pi. The Raspberry Pi collected data from the antennas, this data was then processed with the developed input filters and the normalizations. The processed data was used as input for the trained neural networks and the output from the networks was represented by the GUI.

(49)

5

Number of Antennas and Placement

One research question in this thesis work was to investigate how many BLE antennas that are necessary to localize a broadcasting device using neural networks. Another related question was, which placement of the antennas that gave the best output from the neural networks. This chapter describes how the BLE antennas were placed and how the numbers of necessary antennas were investigated, three different placements of the antennas were considered.

The first placement of the antennas was implemented with the first hardware setup. The ASUS antennas were attached to a Volvo XC90. The placement of each antenna can be seen in Figure 34 where each antenna is represented by a red dot.

Figure 34: First antenna setup. Table 6 shows the name and the location of each antenna.

Table 6: Antenna names and placement for the first setup Antenna name Position

A1 on top of the console A2 right front door A3 between the front seats A4 left front door

A5 in the roof behind the backseat A6 inside of the trunk door

For the second placement of the antennas the second hardware setup was used. The Texas In-struments CC2650 Launchpads were attached to a Volvo V60 and the antennas placement are presented in Figure 35.

(50)

Figure 35: Second antenna setup.

Table 7 shows the antennas name and which name that correspond to which location. Table 7: Antenna names and placement for the second setup

Antenna name Position A1 left front door

A2 between the front seats A3 right front door A4 left back door A5 right back door

A6 inside of the trunk door A7 on the left side of the console A8 on the right side of the console

With the second antenna setup BLE packages were lost during the data collection process, this data loss appeared to be due to the power consumption of the antennas. The Texas Instruments CC2650 power consumption was too high, the Raspberry Pi and the USB-hub could not meet the required power needed. Therefore, the number of antennas were reduced to seven in the third antenna setup.

In the third setup all antennas were placed inside the car, the placement of the antennas can be seen in Figure 36.

References

Related documents

46 Konkreta exempel skulle kunna vara främjandeinsatser för affärsänglar/affärsängelnätverk, skapa arenor där aktörer från utbuds- och efterfrågesidan kan mötas eller

Generally, a transition from primary raw materials to recycled materials, along with a change to renewable energy, are the most important actions to reduce greenhouse gas emissions

Both Brazil and Sweden have made bilateral cooperation in areas of technology and innovation a top priority. It has been formalized in a series of agreements and made explicit

För att uppskatta den totala effekten av reformerna måste dock hänsyn tas till såväl samt- liga priseffekter som sammansättningseffekter, till följd av ökad försäljningsandel

Från den teoretiska modellen vet vi att när det finns två budgivare på marknaden, och marknadsandelen för månadens vara ökar, så leder detta till lägre

Regioner med en omfattande varuproduktion hade också en tydlig tendens att ha den starkaste nedgången i bruttoregionproduktionen (BRP) under krisåret 2009. De

Generella styrmedel kan ha varit mindre verksamma än man har trott De generella styrmedlen, till skillnad från de specifika styrmedlen, har kommit att användas i större

Parallellmarknader innebär dock inte en drivkraft för en grön omställning Ökad andel direktförsäljning räddar många lokala producenter och kan tyckas utgöra en drivkraft