My Estimote Developer Preview kit arrived this week. The kit contains 3 small devices that broadcast a signal over Bluetooth LE, to be used for proximity detection. Most interesting is that the devices are compatible with iBeacon, the new microlocation & proxity feature in iOS 7.
Unboxing
The developer kit contains 3 soft rubber shell devices, each in a different color. The bottom side has some kind of adhesive material applied so the beacon can be attached to a flat surface. There’s no on/off button. The device is broadcasting all the time, even before getting out of its packaging. On a single battery (included) it should be able to survive up to two years.
Not imporatant but worth a mention: for a developer kit the packaging is quite nice and well designed.
A dev preview kit is available from estimote.com
The technology
On the inside the beacon contains a 32-bit ARM Cortex M0 CPU. This is the brain that coordinates between the onboard sensors and operates the Bluetooth LE profile.
Using a Bluetooth LE scanner like LightBlue or BLExplr you’ll be able to find each device. The apps will discover several LE services, presumably used to access its sensor data (accellerometer) or to flash the firmware over the air.
In addition to the published Bluetooth LE services each device conforms to the iBeacon specification. An iBeacon publishes certain information in its advertising packet that makes it possible to tie in to the new CoreLocation functionality in iOS 7. Because all information is contained in the advertising packet it’s not needed to actually connect to the device in your software. If you are mainly interested in iBeacon you can ignore the services published by the device.
Discovering the estimotes with iBeacon
iBeacon is part of the CoreLocation framework in iOS. Using a beacon is similar to geofencing. But instead of using a gps coordinate you are basing your proximity on receiving a Bluetooth LE signal. This makes it possible to detect proximity of moving targets by placing a beacon on them, instead of having to rely on a fixed gps location.
Each beacon has three identifiers:
proximityUUID
: a unique UUID to distinguish your beacons from those others are using.major
: used to group related sets of beaconsminor
: used to identify a beacon within a group
The major and minor numbers are basically arbitrary numbers and your app will have to give those a meaning using tie-ins to your product or shop database for example.
Currently on the Estimote the identifiers are specified by the manufacturer. However I have been promised functionality to customize these properties using an upcoming version of the Estimote app.
Developers take note, if you want to scan for your Estimote beacons use the following UUID. It’s currently not available in any of the documentation.
The UUID for an estimote beacon is:
B9407F30-F5F8-466E-AFF9-25556B57FE6D
One wish I have is to also be able to customize this UUID in the future.
Code
First you set up a beacon region to scan for.
1 2 3 4 5 6 7 8 |
|
As soon as you enter a region you’ll receive a notification via the CLLocationManagerDelegate mechanism. Next thing you can do is start monitoring for individual beacons in that range.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
You can also use the AirLocate WWDC sample code published by Apple to scan for the devices. Just make sure you update the UUID with the one provided above.
Advantages of iBeacon
Technically proximity detection of Bluetooth LE devices is perfectly possible without iBeacon. You can find the signal strength by just scanning for any advertising packet using the CoreBluetooth framework. I already demonstrated this in my UIKonf talk last april, when iBeacon was not even announced yet.
So why would you want to use iBeacon instead of making your own proximity detection on top of CoreBluetooth? The iBeacon functionality offers certain advantages:
- A clean uniform API.
- Possibly cheaper hardware, no need to run actual LE services.
- Allows you to receive state notifications for ranges in the background using the location background mode.
Feedback
Let me know your opinion on iBeacon or what you would use it for. I’m @kluivers on twitter.