Welcome!

iPhone Authors: Mat Rider, An Bui, Matthew Lobas, Shelly Palmer, RealWire News Distribution

Blog Feed Post

How iBeacons Work for Indoor Location Based Services - Technical Guide and Recommendations

Peter Rogers
Principal Mobility Architect
Cognizant
My colleague Peter Rogers is long suffering and obviously in need of sunshine.  He sacrificed his weekend to answer questions I presented him last week on the subject of iBeacons and how they work. I want to thank Peter for the following:

There is a lot of excitement about Apple’s new iBeacon technology but most people still don't realise what it is or how to use it.

iBeacon is actually used in two contexts:
  1. It is primarily a Bluetooth Low Energy (BLE) Profile that enables a device to broadcast its relative position
  2. It is any hardware device that uses the iBeacon BLE Profile 
The following paragraph illustrates this terminology effectively. A third party beacon can use the iBeacon BLE profile to advertise its relative location and therefore be classed itself as an iBeacon. An iPhone can also use the iBeacon BLE profile itself to act as a Virtual iBeacon. In this case the power levels are generally higher and so you may get a more accurate result. There is nothing to stop an Android 4.3 device being able to use the iBeacon BLE profile to advertise itself as a Virtual iBeacon too. In fact any device that supports BLE can communicate using the iBeacon BLE Profile. The core difference that iOS 7 offers is that is normalises the results from the iBeacon (in order to avoid fluctuations) and it offers the new iOS 7 CLBeacon class within the CoreLocation framework.

Here are some interesting fun facts:
  • Apple does not produce iBeacon hardware
  • iBeacon is not the only BLE profile for beacons, there are others that predated it (S-beacon, Gimbal, GeLo)
  • Most beacons allow over the air (OTA) software updates which can be used to load the iBeacon profile
  • The beacons from different vendors often behave quite differently
  • iBeacons CANNOT reliably be used to pinpoint a precise indoor position – more on that later
The iBeacon BLE Profile does not have any payload. Instead it just sends three pieces of information:
  1. UUID – beacon manufacturer’s unique identifier
  2. Major – a value that can identify a group of beacons (can be used for general region)
  3. Minor – a value that can identify an individual  beacon with a group (can be used for a specific location within that region)
The CLBeacon class offers three different properties for determining the distance from the beacon:
  1. Accuracy – the accuracy of the proximity value allegedly in meters - in practice this doesn’t map directly to meters in most cases
  2. Proximity – the vague definition of proximity – immediate, near, far and unknown
  3. RSSI – the received signal strength of the beacon in decibels
The CLBeaconRegion class enables notifications when the iPhone detects that the range of an iBeacon has changed and this can be used to launch your App even if it was not running. The class also enables the construction of a Virtual Beacon whereby the iPhone itself uses the iBeacon BLE Profile to behave like an iBeacon.

This means that we can detect proximity to an iBeacon quite easily by using the Proximity property. In practice this means using the CLBeaconRegion class to set up notifications when we get a proximity of “immediate” to certain strategically positions iBeacons. The accuracy of the beacons can be increased by more power and changing the frequency of updates (the default varies per vendor). Increasing these two parameters obviously decreases the battery life. The simplest option is to look for cases where ‘the device is close to a beacon and the accuracy confidence is high’ which translates into immediate zone. If you were however to put your hand in front of the device and the iBeacon, this can provide enough interference to push it back to the ‘near zone’ although neither the device or beacon has actually moved.

Immediate Zone (0-20 cm) (0-8")
When a device is held up close to a beacon
Accuracy confidence is high

Near Zone (20 cm - 2 m) (8"- 6.5')
Within a couple of meters to the beacon
Accuracy is fairly certain

Far Zone (2 - 70 m) (6.5 - 230')
More than a few meters away
Accuracy is low or the signal strength is weak
[https://community.estimote.com/hc/en-us/articles/201029223-RSSI-Range-Zones-and-Distance-Accuracy]

A simple strategy is to have a Cloud hosted data set that determines the positions of the beacons for an App to dynamically load and refer to. If you try and hardcode the iBeacon positions or have a non-updateable configuration file then you would have to go through the Apple App Store review process every time you want to physically add a new iBeacon. You could also host other information such as broadcast messages, regions and what the major and minor versions actually represent. It would certainly be interesting to have Location Data Stores that can describe multiple indoor positioning systems and that you can look up based on UUID, major and minor. That could be perceived as a security risk in certain situations though.

There are definite differences between the beacon vendors, and things you should be looking into are as follows:
  • Secure firmware update over the air
  • Cloud management platform
  • iBeacon profile support
  • Configurable properties: radio output power; RSSI; iBeacon advertising interval; UUID, major; and minor
  • Developer SDK with documentation
If you buy beacons without the iBeacon profile pre-installed and they are not firmware updateable over the air then you are limited to older profiles. Likewise if the UUID is not configurable and not communicated in the documentation then you are locked into the vendor SDK. If the iBeacon advertising interval is very slow by default and not configurable then your beacons will be less accurate. Finally not being able to configure the power and RSSI means the beacons cannot be configured to be more accurate. http://localz.co/blog/ibeacon-ble-hardware-commercial-comparison/

There are also differences in the accuracy of iBeacons and associated SDKs as followed:
  • Drop out rate
  • Consistency of beacon results amongst the same vendor
  • Correct implementation of measured power (he value of measured RSSI at a distance of one meter)
  • Change in accuracy due to rotation
  • Beacon interference with each other (not something that should have an effect)
 http://blog.shinetech.com/2014/02/17/the-beacon-experiments-low-energy-bluetooth-devices-in-action/

The challenge comes when you want to try and use triangulation with the RSSI or accuracy properties in order to find out a precise location rather than ‘immediate’, ‘near’ or ‘far’. Using the accuracy property is best summed up by the following statement in the iOS 7 API documentation, “Accuracy indicates the one sigma horizontal accuracy in meters. Use this property to differentiate between beacons with the same proximity value. Do not use it to identify a precise location for the beacon. Accuracy values may fluctuate due to RF interference. A negative value in this property signifies that the actual accuracy could not be determined.”

The distance estimate provided by iOS is based on the ratio of the iBeacon signal strength (RSSI) over the calibrated transmitter power (txPower). The txPower is the known measured signal strength in RSSI at 1 meter away. iOS also normalises the values to negate the fluctuations.

“At first glance it would appear that accuracy does seem to resemble distance. However at 0.5 meters, the accuracy underestimated distance, and by 1.5 meters, accuracy was an overestimation of distance. I decided to extend the distance out to 8 meters to see if the accuracy continued increasing with distance, however over the course of 80 seconds the accuracy of the beacon only reported an accuracy of 3.87m - some 4.13 meters shy of 8 meters. This was less than convincing that accuracy was representing distance. In certain ranges with this beacon there does appear to be some correlation between accuracy and distance. I turned the power up to 100% (+4bBm) and measured the accuracy at the same varying distances. This time I was seeing a very close relationship between accuracy and distance between 1 and 5 meters, though it did start to slip at greater distances (however at 15 meters there were desks and computers obscuring the path, so perhaps this is expected).”
http://blog.shinetech.com/2014/02/17/the-beacon-experiments-low-energy-bluetooth-devices-in-action/


One equation that sums up the way to calculate distance is as follows:

P(d)[dBm] = P(do)[dBm] – 10n log (d / d0) – Z
  • d             The distance we want to know
  • d0           A measure of distance for a known power output
  • n             The way the signal power degrades over distance
  • Z              The environmental effect (which is quite large).
http://www.codepilots.com/2014/03/ibeacons-accuracy/

To provide the algorithm for Android or to create your own custom version for iOS then you would need to do something like the following:
  1. Normalise the RSSI and txPower values
  2. Calibrate each IBeacon with the txPower value to allow accurate distance estimates.
  3. Measured a bunch of RSSI measurements at known distances, then do a best fit curve to match the data points
  4. Convert the best fit curve into an algorithm
protected static double calculateAccuracy(int txPower, double rssi) {
  if (rssi == 0) {
    return -1.0; // if we cannot determine accuracy, return -1.
  }

  double ratio = rssi*1.0/txPower;
  if (ratio < 1.0) {
    return Math.pow(ratio,10);
  }
  else {
    double accuracy =  (0.89976)*Math.pow(ratio,7.7095) + 0.111;
    return accuracy;
  }
}
http://stackoverflow.com/questions/20416218/understanding-ibeacon-distancing/20434019#20434019

There are mainly five issues with the approach of triangulation for more accurate positioning:
  1. In non-controlled environments, where you can find metals, and other objects that affect the signal, the received signal strength of the beacons changes so often that it seems impossible to get an error range below 5 meters.
  2. Other devices using 2.4 GHz frequency might be interfering with the Beacons' signal.
  3. Depending on the way that the user is handling the receiver device, the readings can change a lot as well. If the user puts his/her hand over the bluetooth antenna, then the algorithm will have low signals as input, and thus the beacons will supposed to be very far from the device.
  4. The directionality of the beacons and the receiver affects the readings.
  5. The beacons and their SDKs all have a different effect on the accuracy of the results
http://stackoverflow.com/questions/20332856/triangulate-example-for-ibeacons

“Having completed these experiments, I’ve been able to conclude that achieving accurate distance measurements with a single beacon is potentially possible, provided you have the right beacon and the right brand. Out of eight beacons, I only found one that was consistently achieving accurate distances. Given that there is so much inconsistency between the beacons and there is no guarantee you will even receive a beacon in an order that does provide accurate results, it seems the only way to achieve accuracy is by using many beacons and averaging the results.”
http://blog.shinetech.com/2014/02/17/the-beacon-experiments-low-energy-bluetooth-devices-in-action/

Recommendations
  1. Ceiling mounting of beacons reduces variance and the user blocking the path
  2. Signal transmission and reception are dependent on the orientation of both the transmitter and receiver
  3. Radio absorption by the user is significant in determining distance
  4. Other radio interference does not seem significant
  5. Clustering of beacons does not seem to have an impact
  6. The measured power does not decrease uniformly as we move away from the receiver, this is the biggest limiting factor in using this technology for accurate positioning
  7. Increasing the power to the beacons using the vendor SDK increases the relationship between accuracy and distance (on correctly configured beacons)
  8. One mooted solution is to try to set up a beacon every X meters (X being the maximum error tolerated in the system) so we can track on this beacons grid the position of a given device by calculating which beacon on the grid is the closest to the device and assuming that the device is on the same position
  9. Choose the beacon vendor carefully based on online reports because functionality does vary a lot
  10. Use lots of beacons and take an average due to drop out rates and inconsistency amongst beacons in the same place
I leave you some other reading material and the general advice that using relative proximity is probably a far lot simpler than trying to implement precise location. That means designing your solution architecture and physical deployment appropriately. I can see the ability to track a user through a shopping centre of airport, but the ability to pinpoint out a product in a retail store will be challenging unless beacons with very high power levels are used and ceiling mounted.

Additional Resources:
************************************************************************
Kevin Benedict
Writer, Speaker, Editor
Senior Analyst, Digital Transformation, EBA, Center for the Future of Work Cognizant
View my profile on LinkedIn
Learn about mobile strategies at MobileEnterpriseStrategies.com
Follow me on Twitter @krbenedict
Join the Linkedin Group Strategic Enterprise Mobility
Join the Google+ Community Mobile Enterprise Strategies
Recommended Strategy Book Code Halos
Recommended iPad App Code Halos for iPads

***Full Disclosure: These are my personal opinions. No company is silly enough to claim them. I am a mobility and digital transformation analyst, consultant and writer. I work with and have worked with many of the companies mentioned in my articles.

Read the original blog entry...

More Stories By Kevin Benedict

Kevin Benedict is the Senior Analyst for Digital Transformation at Cognizant, a writer, speaker and SAP Mentor Alumnus. Follow him on Twitter @krbenedict. He is a popular speaker around the world on the topic of digital transformation and enterprise mobility. He maintains a busy schedule researching, writing and speaking at events in North America, Asia and Europe. He has over 25 years of experience working in the enterprise IT solutions industry.