Nowadays we can see a lot of applications on object localization. Depending on the applications developers use different technologies to implement localization. Indoor and Outdoor are the two major categories which determines the technologies we can use. The problem of localization has largely been solved for outdoor situations, with systems such as the GPS. We can’t use such applications for indoors because they full-filled with obstacles and GPS signals don’t penetrate buildings.
Instead we can use short range radio signals for positioning. Here we propose a method of using BLE beacons for Positioning. Since they are consuming low power, we can extend the battery life as well. We can find certain number of micro-controllers which is compatible with Bluetooth beacons. In our application we used STM32WB.
Basically there are two types of beacons which are compatible with STM32WB.
- iBeacon (Apple)
- Eddystone (Google)
Each one has advantages and disadvantages over others. But comparatively iBeacon is simple and easy to implement. So, we used it.
Beacons are continuously advertising packets according to defined minimum and maximum advertising intervals. Length of the beacons’ advertising packet is comparatively less. iBeacon standard uses a 30 byte advertising packet comprised of
- 3 byte header : (AD length, AD type and flags)
- 27 byte payload : (AD length, AD type, Company ID, iBeacon type, iBeacon length, UUID, major number, minor number and transmit output power).
Rather than advertising packet,We have to take care of other parameter settings as well . Such as,
- Advertising interval : It must be an integer multiple of 0.625ms (N * 0.625 ms) from 20 ms to 10.24 s. Long advertising interval leads to long term battery usage but it cause major issues with signal stability. That’s why we used the middle value(default) 700ms as advertising interval. A common mistake we can do is to use improper advertising intervals due to misconfiguration which leads the client device not to be able to discover beacons.
- ADTYPE : Since we don’t need connection between devices (only advertising and scanning are enough), we have to set the AD TYPE as Non connectable undirected advertising mode (ADV NONCONN IND).
Client or Receiver device scans Bluetooth packets for defined scanning interval. As soon as device detects a beacon, the hci le advertising report event call back function is invoked. It provides the information of the Bluetooth device during a passive scan. The Controller maintains the queue of these advertising packets and provides the information from multiple devices in one LE Advertising Report event. We can get the values of Tx power, RSSI and local-name,etc from the LE Advertising Report event.
Since we are scanning continuously for a scanning interval, we can get multiple packets from the same device. Since there are variations in the RSSI signal due to external factors such as absorption, interference and diffraction, we have to apply the weighted mean or average filter to remove the variation.
In our case there are multiple beacons advertise at the same time. Therefore we have process the scanned packets separately for each beacon. Since we are extracting RSSI w.r.t its local-name we can separate the scanned packets w.r.t its local-name at each scan. This enables to calculate the average RSSI for each beacon separately.
3 Distance Calculation and Positioning
There are lot of positioning concepts to calculate the distance from RSSI. Initially we have tried Ranging concept. Then we have tried Fingerprint concept as well.
Ranging is the process of determining the distance between two objects, without any regard to angle. Several methods to accomplish this exists and the two most common in radio ranging are based on either received signal strength or time of flight. In outdoor environment (without obstacles) we can observe the calibrated relation between RSSI and distance as,
Where Measured power is calibrated transmit power at 1m (In our case it is -63) and N is a constant depends on the Environmental factor (Range 2-4).
To find the value of N for our case, I selected few known distances randomly and got the RSSI values for those distances. Through the equation(1) I optimized the value of N using RMSE as evaluation metric. I found the optimized N value as 1.870 . Therefore, for our case equation(1) turned as follows,
3.1.1 Results Obtained
To clarify the performance of above method we took the RSSI values for each 5m distances manually and compared with the result from the equation(2). The comparison was as follows,
By analyzing Table 1 we can say that the accuracy of Ranging method relies between ±5m.
Fingerprinting is a method based on using primarily RSSI data to identify the current location using pre-recorded data. The data consists of RSSI readings of different radio signals available in the area. Actually we have to select 2D fingerprint nodes for our task because forklift can move to any coordinates in the indoor environment. Since we initially checked the behaviour of the algorithm for straight line setup(Figure 4), we selected 1D grid with a point distance of 5m and marked in a straight line. Each fingerprint consists of 10 measurements, 5 per beacon. This value is then averaged and saved together with coordinate(1D) of the grid. At the end fingerprint map was as follows,
3.2.1 Results Obtained
To check the reliability of this method, we selected 1D grid with a point distance of 2.5m and marked in a straight line. Since we limited the maximum beacon range as 30m, here I assumed that beacons are fixed at a distance of 30meters. Then we moved the receiver to random points and measured the RSSI levels like mentioned in Figure 4.
Figure 4: Setup of beacons and the receiver to observe the straight line behaviour
By using the fingerprint map and measured RSSI levels we approximated the distance as follows,
N = Number of fingerprints(In our case it is 7)
mn = Currently measured RSSI value
fn = P re − recorded RSSI value
We used Equation (3) under fingerprinting method to obtain the results for the straight line movement of receiver between beacons. And the result was as follows,
Like previous method here also we obtained the accuracy of ±5m.
4. Problems Faced
1. Due to the variations in RSSI levels, we initially calculate the mean value for a scanning interval. To fix the RSSI level for a particular distance we can’t go with a single value(avg RSSI for a single scanning interval). So we got 5 samples continuously for each beacon and calculated the mean for those 5 samples. At the end result was as follows,
Since device(receiver) is continuously scanning for a scanning interval, we can observe multiple adv packets from a single beacon within that interval. Randomly when I went through the scanned packets there were some packets with zero RSSI levels. zero RSSI level reflects a fault condition. Since the count of these packets were very less compared to other packets, we removed the zero RSSI levels from average calculation. After that we restarted the above procedure and got the results as follows,
By analyzing the Table 5 we can observe that,
- Measured RSSI levels at the distance of 1m for our beacons(-63.5) get approximate to calibrated Tx power at 1m (-63).
- Before removing and after removing the zero RSSI levels, we got the same low power at 10m and 30m respectively.
2. No.of scanned/received packets for longer distances (30 to 50m) were comparatively very less than than short distances(below 30 meters). Therefore we limited our target range between beacon and receiver as below 30m.
3. To increase the battery life, we initially set the advertising interval of beacon as 1000ms. Later we found that higher interval settings (over 700ms) actually cause major issues with signal stability. Since 700ms was a boundary condition as well as our device uses it as default, we used 700ms as advertising interval.
5 Recommendations for Future Work
- Since we only focused on the movement of device in the straight line, we didn’t take the effect of angle between transmitter and receiver antennas in accounts. In such case direction of transmitter and receiver antennas aligned together. But in our future work the forklift can move to any coordinates, therefore we have to take account of angular effects. RSSI levels may change w.r.t positioning of devices.
- Lateration is the determining of one objects position using several range measurements. Each measurement can be seen as a circle and calculating the intersection of the measurements yields a position. To find such intersection for actual positioning, at least 3 measurements are needed. By considering the costs and maintenance, using three beacons are enough. The Lateration can be explained as follows,
- We took the measurements and did distance calculation in the outdoor environment. But we have to do the localization in the indoor environment with obstacles. Obstacles lead to multi-path propagation and introduces delay between received signals. It may change the RSSI levels and there might be a possibility to having Multiple RSSI levels from a single beacon within a scanning interval.
- We didn’t experiment the dependency of battery life in advertising interval. Setting proper advertising interval yields better battery life as well as stable signals. We have to do proper experiment on this topic as well.
- JOHAN LARSSON ; Distance estimation and positioning based on Bluetooth low energy technology
- STM32WB BluetoothR Low Energy (BLE) wireless interface ; AN 5270
- Social Distancing Detection using BluetoothR Low Energy ; AN 5508