there also seems to be a bit of confusion about this technology. So we figured the best way to fix it is to delve deep into the underlying stack and explain what exactly beacons are and how they work. Enjoy the read!
Under the hood
How does a beacon work? The principles are pretty easy. Under the silicone casing, there is small ARM computer, combined with a Bluetooth Smart connectivity module, powered by a battery. This little circuit board from Nordic Semiconductor is running Estimote firmware – the piece of low-level software installed on beacons, that makes sure they know exactly how to behave. While the computing power of the CPU and the amount of memory at its disposal are limited, it’s more than enough to handle tasks like processing sensor data or encrypting a beacon’s ID for improved security.
On the thinner side of the beacon, there is a short wire sticking out of the CPU: the antenna. It’s broadcasting electromagnetic waves with specific length and frequency. Namely, 2.4 GHz radio waves. If you would open a beacon, you would notice that the antenna is nothing like the one your old TV set or radio set had. And not only because it’s so much smaller. It’s twisted and looks like a zigzag. There’s a reason for that. The electromagnetic field around a straight wire is shaped like a donut – the waves do not propagate in every direction with the same strength, leaving out sort of blank areas. The best solution to that is to reshape the antenna. The desired outcome is to achieve a perfectly spherical field. This, however, is not possible in real-world conditions, so there’s a lot of data science going into figuring out the right shape of that wire. There are tons of books available on antenna theory, and we’re also conducting our own lab tests to equip Estimote Beacons with an antenna providing the strongest and most reliable field.
Beacons use Bluetooth Smart for communication. It allows for broadcasting only small amounts of data. The maximum payload of a Bluetooth 4.2 packet is 257 bytes. It’s not enough to embed media content and that’s why beacons only broadcast their ID’s (which in the case of the iBeacon protocol is divided into three values: UUID, Major, Minor) and information about signal power, essential for a nearby smartphone to calculate proximity.
The maths and the physics
The reach and stability of a beacon’s signal depends on two main factors: advertising interval (frequency) and broadcasting power. The beacon is not broadcasting continuously – it’s blinking instead. Advertising interval describes the amount of time between each blink. The more frequent the blinks, the more reliable the signal detection. That’s because smartphones also do not continuously scan for beacons. They do that with a given frequency as well, and to make it even more complex, this frequency may depend on the state the phone is in (locked or unlocked). The OS and device type also play a role. If the phone is active, scans will be happening very often, while if it lies locked in your pocket for a few minutes, it will start preserving its battery by limiting the number of Bluetooth scans.
Estimote Beacons’ advertising interval is set to 950 ms by default, but that rate is adjustable. It can have any value between 100 and 2000 ms. The default rate was chosen for a specific reason. On average, iOS scans for beacons in 1 second intervals. 950 ms is almost the highest value to fit into this window. In noisy environments though, it might be possible that the advertising packet simply doesn’t make it to the device (e.g. somebody breaks the line of sight between the device and the beacon). One idea to improve detection stability is to simply increase the advertising frequency, by decreasing the advertising interval. If you set it to 490 ms, you should have two packets per iOS scan. 330 ms gives you three packets, 240 ms four packets and so on. What this means is that even if a single packet doesn’t make it to the device during the 1 second scan period, there’s a chance others will. You need to take into consideration that it will also impact beacon’s battery life, because more blinks equals greater power consumption. We’ve covered best practices for optimizing battery life elsewhere.
As important as advertising interval is the broadcasting power. It describes the signal’s strength and is measured in dBm – decibels referenced to milliwatts. A beacon’s range derives directly from the broadcasting power. If you want to see how signal strength translates to range, launch the Estimote app and connect to a beacon. The app can estimate range based on broadcasting power, but remember that it’s only an approximation. It’s not possible to measure exactly how far a radio wave propagate, because there is no specific point in space where it just stops. Consider a lightbulb: it makes a certain area bright, but the light itself travels much further, dissipated. It’s the same with beacons.
The closer you are to a beacon, the more accurate the distance estimates will be, because of higher signal density in the immediate vicinity of the source. As you move away, the signal gets more scattered and distorted, until it’s not possible at all to distinguish it from the background noise. To understand this concept better, imagine that the beacon is your radio set, and the broadcasting power is the volume setting. If you turn it up, you could hear it playing from far away, and as you’re getting closer, the sound becomes really crisp and clear. But if it’s really low, you might have problems with figuring out what track is playing even with your ear stuck to the speaker. Still, knowing the exact volume in decibels doesn’t mean you can determine exactly how far will the sound travel. There are too many factors affecting that, from the obstacles in the way, the physical matter through which the sound needs to propagate, to your hearing sensitivity.
You already know that a smartphone can approximate distance to the beacon after ‘hearing’ it. To do that, the phone reads a value called RSSI – received signal strength indicator. Then it examines Measured Power, delivered as part of the beacon data packet. Measured Power (depending on nomenclature, sometimes you may see it referred to as Tx Power) is average RSSI received at 1 meter distance, so by comparing it with the actual RSSI, a device can calculate its distance to a beacon. The 1 meter value used for calibrations wasn’t picked by an accident: as mentioned above, it’s easier to obtain accurate readings in close proximity, because of denser signal coverage.
To understand it better, let’s go back to the radio set example, but imagine that instead of putting it in your living room, you’ve left it in the middle of a crowded train station. It’s playing on full volume, so you can easily hear that it’s nearby. Still, you can’t find its exact location, because people are constantly walking in and out of the station. Also, the trains coming and going, along with the speaker announcing arrivals and departures, are distorting the sound, so you’re never sure how far you are from your set. Calculating the exact proximity to a beacon based solely on the radio waves is exactly as hard. Instead of people passing by, trains leaving and the annoying, hardly-audible speaker, you encounter factors like multipath propagation, wave diffraction, absorption or interference. And remember when we said that it’s impossible to design an antenna with equal signal distribution in all directions? Because of that, the orientation of both beacon and smartphone can impact the approximation. Due to those factors, RSSI readings might fluctuate heavily, skewing the distance measurements. This is why if you place a beacon 10 meters away from your phone, it might report the distance of 8 meters, then make a correct assessment, then go up to 12 meters, down to 7, back to 10… you get how it works. And when you rotate the phone, it might think that you just moved 2 meters closer to the beacon.
Location, location, location
So, you might ask, if the RSSI is just a not-so-consistent estimation, is it then possible to build a reliable location service with Estimote Beacons (or any beacons, for that matter)? Short answer is: yes. Long one: this is exactly why hardware is only a part of great beacon solutions. Laws of nature put certain limitations on radio waves, so we need to utilize powerful software to make the most of what physics allows us. Both Estimote’s platform and Apple’s iBeacon standard take advantage of thousands of lines of code, written to overcome issues with shaky signal readings. In iOS, location services are governed by the Core Location framework, of which iBeacon is a part. The Estimote SDK is built on top of Core Location, so it includes all noise reduction algorithms developed by Apple to smooth the signal readings. What’s more important, iBeacon wasn’t designed to operate on exact distance measurements in the first place – although you can still fetch them; Instead, it uses proximity zones. There are four of those: immediate (very close to the beacon), near (about 1-3 meters from the beacon), far (further away or the signal is fluctuating too much to make a better estimate) and unknown. The framework was built in a way that allows for each zone entry to trigger different actions in the app. This gives you control over users’ experience in relation to their location and proximity to specific beacons.
But is it possible to receive more granular results? Say, down to few inches? After almost two years in the beacon market, we’ve heard those questions a thousand times. The answer again is yes, but before we go into the details, we should state something that’s crucial, but often forgot about. Nine times out of ten, you do not need anything beyond proximity zones to track location. If your app is about delivering deals relevant to an aisle in the mall, there’s no reason to pinpoint the user’s location with 50 centimeters accuracy, because the aisle is about 10 meters long. Or suppose you install beacons in a cafe or pub, like Downtown and Tab do, to simplify ordering and payments. With a beacon under each table, you don’t need to determine how far a client is from a beacon. Rather, you only have to check which of the beacons is the closest to the client (by the way, Core Location does that automatically) to know at which table he or she is sitting. This is something solved with a well-designed app, not smoothing out RSSI readings. Remember to always consider how your solution is adding value to the user experience through location context.
We’ve established that nine out of ten use cases are fine with proximity zones and reliable distance approximations. What about the other one, though? Our answer to that is Estimote Indoor Location SDK, a tool developed for those rare cases when you do need precise location tracking. It enables developers to map a location in just a few minutes, using only a set of Estimote Beacons and an iPhone. A map created this way can be embedded into apps and used to navigate users through a venue.
When we started building it, we were experimenting with a method called trilateration. Because an RSSI reading from a single beacon gives you information about proximity, but not from what direction the signal is coming, you need at least three fixed reference points to understand the orientation in space. In theory, if you know the location of three beacons and measure distance to each one, you can figure out exactly where you are. But in practice, this is still the radio set in a crowded a train station situation, although now we have a 3.1 sound system instead. We’ve quickly learned that trilateration alone won’t do the trick. It’s good enough if you’re okay with average accuracy of about 5 meters, but that’s well below the bar we’ve set for ourselves. We’ve started adding more and more complex components, and now that the first version of Indoor Location is released, it takes advantage of particle filtering, sensor fusion and a whole lot of noise reduction algorithms. Thanks to that, we include predictive analysis and the tons of data in location assessment, which increases the accuracy dramatically.
Estimote Indoor Location SDK is still in an early phase of development, but already yields results on par with much more costly and time-consuming solutions. Our goal is to achieve stable location tracking with best accuracy possible, and we’re confident that we’ll reach that point in 2015. Fine tuning this technology will require tons of testing and experimenting, and we’re already in the process of doing it: our lab is also running every day to field-test what we hypothesize. In the next few weeks you can expect a software update giving you a taste of improved stability and better accuracy. We also want to take some of the noise reduction mechanisms we’ve developed for the purposes of Indoor Location and add them to our original beacon SDK, so that you non-Indoor apps can benefit from more accurate distance calculations too.