Indoor Location in Mobile Applications using iBeacons
-- Simon Guest, Distinguished Engineer. Neudesic, LLC
GPS IS GREAT!
WHEN YOU ARE OUTDOORS
INDOOR LOCATION IS A DIFFERENT STORY
ISSUES
▸ GPS signal rarely works indoors
▸ When it does, it's often inaccurate
▸ No concept of indoor space, such as multiple floors
MANY COMPANIES HAVE TRIED TO SOLVE THIS!
WIFI SOLUTIONS
NFC BASED SOLUTIONS
MAGNETOMETER
LESS THAN IDEAL RESULTS
▸ Expensive
▸ Custom
▸ Too heavy on power
▸ Unpredictable requirements (e.g. WiFi)
▸ Don't run in background
DEMOCRATIZATION
IBEACONS
GOAL OF THIS SESSION
▸ What are iBeacons?
▸ Developing iOS and Android applications
▸ Pushing the boundaries
CLASSIC
BLUETOOTH LOW ENERGY (BLE)
BLUETOOTH LE/SMART
▸ Designed for low power
consumption
▸ Secure, simple pairing
w/ multiple profiles
▸ Wide range of hardware
vendor support
HOW DOES IBEACON RELATE?
IBEACON SPECIFICATION
▸ Apple Specification and Trademark on using Bluetooth
LE/Smart for indoor proximity
▸ Similar to a Bluetooth profile, except Apple are driving it
▸ Implementing specification is free, subject to Apple
NDA
REDBEAR BEACON
▸ RedBear BLE Mini
▸ TI CC2540
▸ 5v USB or 3.4v cell
battery input
▸ Around $30 USD
HOW DO IBEACONS WORK?
IBEACONS IN USE
▸ iBeacon broadcasts
signal using a UUID
▸ UUID is unique to a
group of iBeacons, not
an individual
IBEACONS IN USE
▸ Beacon identifies itself
in the group using a
Major and Minor number
▸ For example, Major: 1,
Minor 2
IBEACONS IN USE
▸ Devices can find
iBeacons nearby that
match a particular UUID
▸ This is known as
ranging for beacons
IBEACONS IN USE
▸ Once found, device can
detemine power level of
signal from the beacon
▸ Which in turn can
approximate the
distance
IBEACONS IN USE
▸ Three enumerated
ranges supported in the
specification
▸ IMMEDIATE, NEAR, and
FAR
EXAMPLE SCENARIOS
RETAIL STORE: PRODUCT PROMOTION AND LOCATION
EDUCATION: MUSEUM INFORMATION SYSTEM
OIL & GAS: PERSONNEL SAFETY SYSTEM
REAL ESTATE: OPEN HOUSE WALKTHROUGH
REMEMBER, IBEACONS ARE NOT SMART!
REMEMBER, IBEACONS ARE NOT SMART!
▸ No network connectivity
▸ No concept of devices that have discovered them
▸ No storage or additional information beyond UUID,
Major, Minor
DEVICE COMPATIBILITY
DEVICE COMPATIBILITY
▸ iPhone 4S / iPad 3 and upwards, running iOS 7+
▸ Android 4.3 and upwards, running Linux Kernel 3.4+
▸ Macs with Bluetooth 4 hardware, running Mavericks
▸ Hardware vendors
-- Radius, Redbear, Estimote, and others
DEVELOPING APPLICATIONS THAT SUPPORT IBEACONS
IOS
▸ Support for iBeacons in CoreLocation in iOS 7.x
▸ Create new CLBeaconRegion using UUID
▸ DidRangeBeacons event used to detect nearby beacons
▸ Returns array of beacons
IOS (XAMARIN)
private CLLocationManager locationManager;
private NSUuid beaconUUID = new NSUuid ("E2C56DB5-DFFB-48D2-B060-D0F5A71096E0");
private CLBeaconRegion beaconRegion;
public void StartListeningForBeacons ()
{
beaconRegion = new CLBeaconRegion (beaconUUID, "0");
locationManager = new CLLocationManager ();
locationManager.DidRangeBeacons += (object sender, CLRegionBeaconsRangedEventArgs args) => {
// args.Beacons contains the array of found beacons
};
locationManager.StartRangingBeacons (beaconRegion);
locationManager.StartUpdatingLocation ();
}
ANDROID
▸ Apple does not provide iBeacon SDK for Android
▸ Radius Networks open sourced SDK
▸ Extend Activity with IBeaconConsumer
▸ OnIBeaconServiceConnect and RangingBeaconsInRegion
ANDROID (XAMARIN)
private readonly IBeaconManager iBeaconManager;
private readonly Region monitoringRegion;
private readonly Region rangingRegion;
private const string UUID = "e2c56db5dffb48d2b060d0f5a71096e0";
public MainActivity ()
{
iBeaconManager = IBeaconManager.GetInstanceForApplication (this);
monitorNotifier = new MonitorNotifier ();
rangeNotifier = new RangeNotifier ();
monitoringRegion = new Region ("r2MonitoringUniqueId", UUID, null, null);
rangingRegion = new Region ("r2RangingUniqueId", UUID, null, null);
}
ANDROID (XAMARIN)
public void OnIBeaconServiceConnect ()
{
iBeaconManager.SetMonitorNotifier (monitorNotifier);
iBeaconManager.SetRangeNotifier (rangeNotifier);
iBeaconManager.StartMonitoringBeaconsInRegion (monitoringRegion);
iBeaconManager.StartRangingBeaconsInRegion (rangingRegion);
}
private void RangingBeaconsInRegion (object sender, RangeEventArgs e)
{
// beacons returned in e.Beacons
}
DEMO
WHAT DID WE SEE?
▸ Simple application using CLLocationManager to range
for beacons
▸ Relatively accurate line-of-sight proximity detection
▸ Enumerated proximity levels
BEYOND THE BASICS
RUNNING IBEACONS IN THE BACKGROUND
BACKGROUND DETECTION IN IOS
▸ Made possible by iOS 7.1!
▸ Invoke ranging for beacons from AppDelegate (not
ViewController)
▸ Beacon ranging will persist background and even work
when device is locked/standby
BACKGROUND DETECTION IN ANDROID
▸ Default as Radius SDK actually runs as a service
▸ Developer chooses how to handle OnResume, OnPause
events, and invoking application/service on updates
▸ Should consider own service to handle background
notifications
BACKGROUND TIPS
▸ Keeping BLE enabled and ranging will have some effect
on battery
▸ Consider adding sleep time if running in background
▸ Don't make expensive calls (e.g. networking,
computation) on each ranging
DEMO
BETTER ACCURACY OF INDOOR LOCATION
TRILATERATION
TRILATERATION
▸ Similar in concept to triangulation except uses distance
vs. angles
▸ Requires minimum of three beacons
▸ Assuming accurate power signals, can calculate more
accurate position
DEMO
WHAT DID WE SEE?
▸ Position of 3+ beacons sent to NodeJS server
▸ NodeJS server uses cartersian coords to work out
position, broadcast via WebSockets
▸ HTML5 page responds to WebSockets and plots position
on canvas
NOT PERFECT...
NOT PERFECT...
▸ Walls or line-of-sight obstructions will decrease
observed power range, and lead to inaccurate results
▸ But an array of iBeacons in an open area (e.g. retail
store) should provide 1-2m accuracy
WRAPPING UP
IBEACONS
IBEACONS
▸ Apple standard, but supported well on most (latest)
mobile devices
▸ Mix of hardware and software options, easy to develop
▸ Opening up wide opportunity of indoor location
scenarios to any developer at a relatively low cost point
THANK YOU!
Q&A
▸ Simon Guest, Distinguished Engineer, Neudesic LLC
▸ simonguest.com (@simonguest)
▸ http://github.com/simonguest/gids
▸ http://slideshare.net/simonguest
-- http://
www.amazon.com/File-
New-Presentation-
Developers-Professionals/
dp/0615910459

Indoor location in mobile applications using iBeacons

  • 1.
    Indoor Location inMobile Applications using iBeacons -- Simon Guest, Distinguished Engineer. Neudesic, LLC
  • 2.
  • 3.
    WHEN YOU AREOUTDOORS
  • 4.
    INDOOR LOCATION ISA DIFFERENT STORY
  • 5.
    ISSUES ▸ GPS signalrarely works indoors ▸ When it does, it's often inaccurate ▸ No concept of indoor space, such as multiple floors
  • 6.
    MANY COMPANIES HAVETRIED TO SOLVE THIS!
  • 7.
  • 8.
  • 9.
  • 10.
    LESS THAN IDEALRESULTS ▸ Expensive ▸ Custom ▸ Too heavy on power ▸ Unpredictable requirements (e.g. WiFi) ▸ Don't run in background
  • 11.
  • 12.
  • 13.
    GOAL OF THISSESSION ▸ What are iBeacons? ▸ Developing iOS and Android applications ▸ Pushing the boundaries
  • 15.
  • 16.
  • 17.
    BLUETOOTH LE/SMART ▸ Designedfor low power consumption ▸ Secure, simple pairing w/ multiple profiles ▸ Wide range of hardware vendor support
  • 18.
  • 19.
    IBEACON SPECIFICATION ▸ AppleSpecification and Trademark on using Bluetooth LE/Smart for indoor proximity ▸ Similar to a Bluetooth profile, except Apple are driving it ▸ Implementing specification is free, subject to Apple NDA
  • 20.
    REDBEAR BEACON ▸ RedBearBLE Mini ▸ TI CC2540 ▸ 5v USB or 3.4v cell battery input ▸ Around $30 USD
  • 21.
  • 22.
    IBEACONS IN USE ▸iBeacon broadcasts signal using a UUID ▸ UUID is unique to a group of iBeacons, not an individual
  • 23.
    IBEACONS IN USE ▸Beacon identifies itself in the group using a Major and Minor number ▸ For example, Major: 1, Minor 2
  • 24.
    IBEACONS IN USE ▸Devices can find iBeacons nearby that match a particular UUID ▸ This is known as ranging for beacons
  • 25.
    IBEACONS IN USE ▸Once found, device can detemine power level of signal from the beacon ▸ Which in turn can approximate the distance
  • 26.
    IBEACONS IN USE ▸Three enumerated ranges supported in the specification ▸ IMMEDIATE, NEAR, and FAR
  • 27.
  • 28.
    RETAIL STORE: PRODUCTPROMOTION AND LOCATION
  • 29.
  • 30.
    OIL & GAS:PERSONNEL SAFETY SYSTEM
  • 31.
    REAL ESTATE: OPENHOUSE WALKTHROUGH
  • 32.
  • 33.
    REMEMBER, IBEACONS ARENOT SMART! ▸ No network connectivity ▸ No concept of devices that have discovered them ▸ No storage or additional information beyond UUID, Major, Minor
  • 34.
  • 35.
    DEVICE COMPATIBILITY ▸ iPhone4S / iPad 3 and upwards, running iOS 7+ ▸ Android 4.3 and upwards, running Linux Kernel 3.4+ ▸ Macs with Bluetooth 4 hardware, running Mavericks ▸ Hardware vendors -- Radius, Redbear, Estimote, and others
  • 36.
  • 37.
    IOS ▸ Support foriBeacons in CoreLocation in iOS 7.x ▸ Create new CLBeaconRegion using UUID ▸ DidRangeBeacons event used to detect nearby beacons ▸ Returns array of beacons
  • 38.
    IOS (XAMARIN) private CLLocationManagerlocationManager; private NSUuid beaconUUID = new NSUuid ("E2C56DB5-DFFB-48D2-B060-D0F5A71096E0"); private CLBeaconRegion beaconRegion; public void StartListeningForBeacons () { beaconRegion = new CLBeaconRegion (beaconUUID, "0"); locationManager = new CLLocationManager (); locationManager.DidRangeBeacons += (object sender, CLRegionBeaconsRangedEventArgs args) => { // args.Beacons contains the array of found beacons }; locationManager.StartRangingBeacons (beaconRegion); locationManager.StartUpdatingLocation (); }
  • 39.
    ANDROID ▸ Apple doesnot provide iBeacon SDK for Android ▸ Radius Networks open sourced SDK ▸ Extend Activity with IBeaconConsumer ▸ OnIBeaconServiceConnect and RangingBeaconsInRegion
  • 40.
    ANDROID (XAMARIN) private readonlyIBeaconManager iBeaconManager; private readonly Region monitoringRegion; private readonly Region rangingRegion; private const string UUID = "e2c56db5dffb48d2b060d0f5a71096e0"; public MainActivity () { iBeaconManager = IBeaconManager.GetInstanceForApplication (this); monitorNotifier = new MonitorNotifier (); rangeNotifier = new RangeNotifier (); monitoringRegion = new Region ("r2MonitoringUniqueId", UUID, null, null); rangingRegion = new Region ("r2RangingUniqueId", UUID, null, null); }
  • 41.
    ANDROID (XAMARIN) public voidOnIBeaconServiceConnect () { iBeaconManager.SetMonitorNotifier (monitorNotifier); iBeaconManager.SetRangeNotifier (rangeNotifier); iBeaconManager.StartMonitoringBeaconsInRegion (monitoringRegion); iBeaconManager.StartRangingBeaconsInRegion (rangingRegion); } private void RangingBeaconsInRegion (object sender, RangeEventArgs e) { // beacons returned in e.Beacons }
  • 42.
  • 43.
    WHAT DID WESEE? ▸ Simple application using CLLocationManager to range for beacons ▸ Relatively accurate line-of-sight proximity detection ▸ Enumerated proximity levels
  • 44.
  • 45.
    RUNNING IBEACONS INTHE BACKGROUND
  • 46.
    BACKGROUND DETECTION INIOS ▸ Made possible by iOS 7.1! ▸ Invoke ranging for beacons from AppDelegate (not ViewController) ▸ Beacon ranging will persist background and even work when device is locked/standby
  • 47.
    BACKGROUND DETECTION INANDROID ▸ Default as Radius SDK actually runs as a service ▸ Developer chooses how to handle OnResume, OnPause events, and invoking application/service on updates ▸ Should consider own service to handle background notifications
  • 48.
    BACKGROUND TIPS ▸ KeepingBLE enabled and ranging will have some effect on battery ▸ Consider adding sleep time if running in background ▸ Don't make expensive calls (e.g. networking, computation) on each ranging
  • 49.
  • 50.
    BETTER ACCURACY OFINDOOR LOCATION
  • 54.
  • 55.
    TRILATERATION ▸ Similar inconcept to triangulation except uses distance vs. angles ▸ Requires minimum of three beacons ▸ Assuming accurate power signals, can calculate more accurate position
  • 56.
  • 57.
    WHAT DID WESEE? ▸ Position of 3+ beacons sent to NodeJS server ▸ NodeJS server uses cartersian coords to work out position, broadcast via WebSockets ▸ HTML5 page responds to WebSockets and plots position on canvas
  • 58.
  • 59.
    NOT PERFECT... ▸ Wallsor line-of-sight obstructions will decrease observed power range, and lead to inaccurate results ▸ But an array of iBeacons in an open area (e.g. retail store) should provide 1-2m accuracy
  • 60.
  • 61.
  • 62.
    IBEACONS ▸ Apple standard,but supported well on most (latest) mobile devices ▸ Mix of hardware and software options, easy to develop ▸ Opening up wide opportunity of indoor location scenarios to any developer at a relatively low cost point
  • 63.
  • 64.
    Q&A ▸ Simon Guest,Distinguished Engineer, Neudesic LLC ▸ simonguest.com (@simonguest) ▸ http://github.com/simonguest/gids ▸ http://slideshare.net/simonguest
  • 65.