# Indoor tracking solution

## Introduction

Precise GNSS tracking might be physically not possible in certain environments, where the GNSS signal is unable to reach the tracking device. One example of such environment might be the inside of a large industrial warehouse, where the GNSS signal is attenuated by it's walls. If the precise position of a vehicle, such as a forklift is needed to be tracked inside of it, other additional measures need to be taken. Teltonika indoor tracking solution ensures indoor positioning in such environments by utilising eye beacons. Eye Beacons are interchangeable with Eye Sensors; it works in the same way as an Eye Beacon while also providing additional features, such as magnetic field detection, temperature and humidity reading. All of which help ensure proper warehouse conditions to prevent damage of goods. However, for regular indoor positioning, it is recommended to use Eye Beacons, as they ensure a longer battery life.

## Solution description

First, BLE beacons are set up in an inside space, their position will remain fixed and they will serve as a known location reference. These beacons periodically broadcast a signal which is unique for each beacon containing the beacon’s ID. All FM devices can detect this broadcasted signal, therefore, many FM devices can utilise the set up beacons for positioning simultaneously. Once a FM device configured for the solution receives a signal from a beacon, the relationship between the strength of this received signal (RSSI-Received signal strength Indicator) and transmitted signal strength (which is a constant for each beacon), will be proportional to the distance between them, as radio waves propagate according to the inverse square law. In general, distance to the beacon can be calculated by the following formula:

${\displaystyle Distance=10^{\frac {MeasuredPower-RSSI}{10N}}}$

Where,

• Measured Power is the RSSI value one meter away from the beacon if it is using iBeacon protocol, or 0 meters away if it is using Eddystone protocol.
• N is a constant for the environmental factor. It has a value between 2-4 and should be determined experimentally based on the facility.

With several beacons detected by the FM device and having calculated the distance to each of them, the position of the configured FM device can be approximated by a positioning algorithm, such as trilateration. These calculations are performed on the server side.

## Beacon installation

The main challenge in using BLE beacon signals for indoor positioning is the variance of RSSI readings due to their sensitivity to environment factors. These factors include attenuation of signal due to physical obstacles: walls, doors, metal objects. The inside of buildings is not free space, so the accuracy of positioning is impacted by absorption and reflection from walls. Moving objects such as doors, vehicles, and people can pose an even greater issue, as they can affect the signal strength in unpredictable ways.
To maximise the accuracy of positioning, EyeBeacons should be installed on the walls, ceiling or racks and their position will remain fixed. Clear line of sight should be maintained for optimal coverage of the beacon signal. For best tracking coverage and accuracy results, beacons should be installed in such a way, that at least 3 beacon transmissions can be detected at any point of the indoor facility. The maximum open-field distance of EyeBeacon detection is 80 meters, however, indoor signal range will be smaller and depend on the configured transmitting power of the Eye beacon as well as layout of the facility. In general, the more beacons are set up, the higher the positioning accuracy.

## Configuring FM device

1. In System Settings Enable Codec8 Extended;
2. In Bluetooth settings Enable Bluetooth, set this setting as either "Enable (hidden)" or "Enable (visible)", otherwise Bluetooth will be disabled;
3. In Bluetooth 4.0 settings, set Non Stop Scan to "enabled" or "disabled" and configure the desired update interval.
4. In Beacon list settings, configure Beacon Detection as "Configured" and Beacon Record as "Periodic". This configuration will allow detection of beacons from the beacon list and send periodical positioning data to the server. The lower the period, the more frequently a position update can be obtained. If On Change is selected – device will not create Beacon record after every scan procedure is completed unless scanned Beacon list will change.

•If the beacon detection option is set to Configured, only beacons from the beacon list will be detected and their data will be sent to the server.
•If beacon detection is set to All, all beacons will be detected by the FM device, therefore beacon lists will not have to be configured on the devices.
•It is also possible to configure the device to recognize the beacon by it’s MAC address.
As always, FM device configuration will vary depending on the User’s exact needs.

## Configuring EyeBeacon

Devices work constantly and are ready to perform out of the box. Default basic Sensor settings are set to:
• Transmitting at 2 dBm power.
• Data advertising at 3 second intervals.
• Eddystone protocol
However, these parameters can be changed. Transmitting power can be set from -14dBm to 8dBm – higher transmitting power equates to a larger beacon range. Data advertising interval can be selected from the range 20ms to 10s, shorter data advertising intervals ensure a more stable signal. However, increasing power or reducing the advertising interval affects the battery life of the Eye Beacon.

 EYE Beacon / BTSID1 EYE Sensor / BTSMP1 2+ years (Tx=2 dBm; interval: 1 s) 1+ year (Tx=2 dBm; interval: 1 s) 5+ years (Tx=2 dBm; interval: 3 s) 2.5+ years (Tx=2 dBm; interval: 3 s) 10+ years (Tx=2 dBm; interval: 10s) 5+ years (Tx=2 dBm; interval: 10s)

More information can be found here All configuration of the Eye Beacon will be done via EYEapp. On the app, wanted protocol can be selected, transmitting power, advertising interval and Beacon ID can be easily configured. Below is an example configuration.

## Beacon data

After the FM device and EyeBeacons are configured, the FM device will be able to read EyeBeacon data and send it to the server, where distance and positioning calculations are to be performed. Depending on the beacon mode parameter setting on the FM device, Beacon data will be sent to the server in a variable length packet AVL ID: 385 or AVL ID 548.
•if advanced beacon mode is selected, beacon data is packed into AVL ID: 548. Advanced beacon mode allows the user to configure beacon data capturing manually.
•if simple mode is selected, beacon data is packed into AVL ID: 385. Using simple mode, beacon parsing is done automatically (Eddystone and iBeacon protocols are supported).
In order to make sense of the data sent to the server for the calculation to be made, packets need to be parsed. Depending on the selected beacon protocol, packet structure will differ. Provided below are examples of parsing a packet containing Beacon data.

### Simple Beacon mode Eddystone protocol example with 1 beacon

received raw data: 00000000000000408e01000001701f9b3fa9010f0e502a209ab461007400c60e00000181000100000000000000000001018100131101e39b606aa38255aa8e460b154e2d0055cf0100000056 parsing example:

AVL Data Packet
AVL Data Packet Part HEX Code Part
Zero Bytes 00 00 00 00
Data Field Length 00 00 00 40
Codec ID 8E (Codec8 Extended)
Number of Data 1 (Number of Total Records) 01
AVL Data Timestamp 00 00 01 70 1F 9B 3F A9 (GMT: Friday, 07 February 2020 12:23:53.001)
Priority 01
Longitude 0F 0E 50 2A
Latitude 20 9A B4 61
Altitude 00 74
Angle 00 C6
Satellites 0E
Speed 00 00
Event IO ID 01 81 (385)
N of Total ID 00 01
N1 of One Byte IO 00 00
N2 of Two Bytes IO 00 00
N4 of Four Bytes IO 00 00
N8 of Eight Bytes IO 00 00
NX of X Bytes IO 00 01
N’th IO ID - AVL ID. 01 81 (385)
Length of Variable Length IO 00 13
Value of Variable Length IO 1101E39B606AA38255AA8E460B154E2D0055CF
Number of Data 2 (Number of Total Records) 01
CRC-16 00 00 00 56

AVL 385 Parsing
Data part BLE beacon flags #1 Beacon ID #1 Signal Strength #1 Beacon data #2
1 Byte 1 Byte 20/16 Bytes 1 Byte
11 – Data part, 1 Record out of 1 Beacon Packet. 01 – Eddystone with RSSI Eddystone – 16B (Namespace, Instance ID)

E39B606AA38255AA8E46 – BLE Beacon Namespace

0B154E2D0055 – BLE Beacon Instance ID

-49 - - -

#### iBeacon example with 2 beacons

received raw data: 000000000000005a8e010000016b69b0c9510000000000000000000000000000000001810001000000000000000000010181002d11216b817f8a274d4fbdb62d33e1842f8df8014d0
22bbf21a579723675064dc396a7c3520129f61900000000bf0100003e5d
parsing example:

AVL Data Packet
AVL Data Packet Part HEX Code Part
Zero Bytes 00 00 00 00
Data Field Length 00 00 00 5A
Codec ID 8E (Codec8 Extended)
Number of Data 1 (Number of Total Records) 01
AVL Data Timestamp 00 00 01 6B 69 B0 C9 51(GMT: Tuesday, 18 June 2019 08:25:22.001)
Priority 00
Longitude 00 00 00 00
Latitude 00 00 00 00
Altitude 00 00
Angle 00 00
Satellites 00
Speed 00 00
Event IO ID 01 81 (385)
N of Total ID 00 01
N1 of One Byte IO 00 00
N2 of Two Bytes IO 00 00
N4 of Four Bytes IO 00 00
N8 of Eight Bytes IO 00 00
NX of X Bytes IO 00 01
N’th IO ID - AVL ID. 01 81 (385)
Length of Variable Length IO 00 2D
Value of Variable Length IO 11216B817F8A274D4FBDB62D33E1842F8DF8014D022BBF21A579723675064DC396A7C3520129F61900000000BF
Number of Data 2 (Number of Total Records) 01
CRC-16 00 00 3E 5D

AVL 385 Parsing
Data part BLE beacon flags #1 Beacon ID #1 Signal Strength #1 Beacon data #2
1 Byte 1 Byte 20/16 Bytes 1 Byte
11 – Data part, 1 Record out of 1 Beacon Packet. 21 – iBeacon with RSSI 17F8A274D4FBDB62D33E1842F8DF8 – UUID

014D – Major

022B – Minor

-65 21A579723675064DC396A7C3520129F61900

000000BF

- 21 – iBeacon with RSSI A579723675064DC396A7C3520129F619 – UUID

0000 – Major

0000 – Minor

-65 - - -

More examples on parsing AVL ID:385 can be found here
Note, the signal strength byte value in Hex format must be converted to Decimal from signed 2's complement, the converted value will be in dBm. For Eddystone protocol, Beacon namespace:instance ID will be used to identify the beacon, for iBeacon protocol UUID:major:minor will be used. From there, the signal strength information can be used to calculate the distance to the beacon, then various positioning algorithms can be implemented on the server side for indoor positioning.
It is also possible to identify beacons by their MAC address, by selecting advanced beacon mode on the FM device configuration. Below is an example

### Advanced Beacon Mode

When advanced beacon mode is selected, beacon data capturing can be configured manually (AVL ID 548). This mode can prove very useful in several scenarios as it provides a very flexible and customisable method of capturing Beacon data. For example, advanced beacon mode could be used to read additional data, such as temperature or humidity from EyeSensors or monitoring beacons' battery voltage. A detailed description of advanced beacon mode can be found here.
Advanced beacon mode can also be used for configuring the FM device to discover beacons based on their MAC address, instead of UUID:major:minor for iBeacon or namespace:instanceID for Eddystone.
Below is an example configuration for the FM device discovering EyeBeacons whose MAC addresses match the ones specified in beacon list and are using Eddystone protocol.

Received Raw beacon frame with AVL ID 548, containing data from 1 beacon:
000000000000003a8e010000018088ef844b000f0e5732209ab89c004f001010000002240001000000000000000000010224000d010b0001dc01067cd9f418d9c001000027b7
AVL ID 548 (224 in hex) part:
010b0001dc01067cd9f418d9c0

AVL 548 parsing
Parsed Beacon data part HEX Code Part
(Constant) 01
1st Beacon data length 0b
RSSI (Parameter 00) 00
RSSI length 01
RSSI value dc (coverted to dec -> -49)
Beacon ID (Parameter 01) 01
Beacon ID length 06
Beacon ID 7cd9f418d9c0

The below table represents possible Beacon Parameters.

Parameters
00 RSSI
01 Beacon ID
02 Additional beacon data

An example configuration of how to capture RSSI as well temperature readings from an Eye Sensor can be found here