A Bluetooth Low Energy Beacon is a simple one-way technology that works like a lighthouse. All it does is sending out a bluetooth message with its id, and signal strength (Tx Power). This in an interval typical inside the 100ms - 1000ms range. The faster is often better, but uses more power from the beacon.
It comes in different forms, some that uses batteries (coin, AA etc.), and some that drains its power from a USB or wall socket. Also computers and mobile devices can work as beacons, but then with limitations (adjustment of signal strength, etc.).
There are several standards, some of the most common are:
- iBeacon: App. Apple specification. Native iOS.
- AltBeacon: App. Open specification. Similar to iBeacon (and compatible), but less strict.
- Eddystone: Native Android, comes with four different frames:
- UID: App, frame.
- URL: Physical web (can be used without dedicated app on Android).
- TLM: Extension to give more information like, temperature, battery status, etc.
- EID: Security frame.
Example of a Eddystone-URL on Android:
A region is a set of beacons, where you will be inside of that region, if you see one or more of the beacons. Naming is here essential, if you choose a region id that someone else has, your beacons will trigger theirs app, or theirs will trigger yours. There are however more than enough combinations, so just pick a random one and stick with it.
iBeacon / AltBeacon:
Created of a UUID, Major and Major:
On iBeacon you can scan for the UUID or the UUID + Major.
Created of a Namespace and Instance:
On Eddystone you can scan for all beacons or divided by namespace.
Beacons comes in two modes: Ranging and monitoring.
Ranging is the one you will use when the application is open and on the screen. You can scan in whatever interval you want, as you have all the applications resources to use. However, be nice. It will consume power.
To calculate the distance, the phone will tell the signal strength it’s receiving on, and this combined with the information of the transmitting strength (tx power), you can calculate the estimated distance (typical done inside of a SDK/library).
However, since every phone is different, it is hard to get this correct. Other factors like echo of the radio waves, walls, or people, might also give a wrong distance.
This will therefor make things like trilateration very hard. So you should probably not try to make your own positioning library.
Monitoring is used as a background service to start a job on the event of entering or exiting a region. This can then be used to push a notification, or similar to the user when going inside, or out of some area.
There are two ways of scanning for regions.
One is using the native format of the device, and have the HW scan for you. This typical triggers the event after a couple of seconds on entering, and half a minute plus some seconds on exit (30s to be sure it’s not just some missing messages).
The other way of scanning is having a job that starts every X minutes. However, this will not be as responsive, and if you have a low message interval on the beacons (ex. 1s), you might miss them. In the case of a low interval, you might actually not trigger the event at all.
There are also restrictions of how many regions a App can listen after (20 on iOS). However, if this is a problem, you probably doing something very wrong.
There are several places where you can use beacons to give something extra to the user, or to collect some extra data.
However, in most cases, you cannot depend on it to work at all.
This is because:
- The user must have your app installed (except Eddystone-URL).
- The user must have a modern phone (ex. Android 4.3+).
- The user must have bluetooth switched on. And given enough access to the app.
Som typical places to use beacons could be:
- Large buildings: Shopping malls, Hospitals, Stadiums.
- Smaller buildings: Resturants, home automation.
- Public transportation.
Some possible usecases:
- Many is interested in using beacons or WiFi for indoor navigation.
- Advertisement (however be carefull, to much spam, and people will turn bluetooth off).
- Proximity based alerts. Example: “you are standing on the wrong bus stop”.
- Proximity based searches in searchengines.
However, using other sources like WiFi, GPS, sound, vibration, etc., might be good enough. Just look at applications like MazeMap, Citymapper, Tripadvisor, Foursquare, etc.
Since beacons are a one-way technology, there is often not much to security on them, other than when connecting to change the configuring.
Anyone can buy a beacon and use the same ID as you, so what is often done in this case is to change the IDs in intervals on several minutes.
However if the beacons are placed at fixed point, a sensor at another fixed point can very fast know what the new IDs is.
From there you can do stuff like:
- Spoof the IDs, and guide person the wrong way.
- Spoof the IDs, and spam the user with notifications from the official app.
- Use the original beacons in a competitive app.
To get started you can start with using a mobile device as a beacon, or buy a developer kit (Kontakt.io, Estimote, RadiusNetworks, GemTot, etc.).
I have both USB and battery beacons that I play with. USB are often better, as you can change the message interval, beacon standard, transmitting power, etc. To develop I like to use the AltBeacon library for Android, as it’s open and based on the standards.
If you want to go a little deeper, you can get something like the nRF52, and start writing some beacon firmware. The nRF52 uses the same chips as many of the better once, like Estimote and Kontakt.io. I also have a Adafruit BLE sniffer that works with wireshark.