65
Indoor Location in Mobile Applications using iBeacons -- Simon Guest, Distinguished Engineer. Neudesic, LLC

Indoor location in mobile applications using iBeacons

Embed Size (px)

DESCRIPTION

Session from GIDS 2014, covering iBeacons, developing applications, and trilateration techniques.

Citation preview

Page 1: Indoor location in mobile applications using iBeacons

Indoor Location in Mobile Applications using iBeacons-- Simon Guest, Distinguished Engineer. Neudesic, LLC

Page 2: Indoor location in mobile applications using iBeacons

GPS IS GREAT!

Page 3: Indoor location in mobile applications using iBeacons

WHEN YOU ARE OUTDOORS

Page 4: Indoor location in mobile applications using iBeacons

INDOOR LOCATION IS A DIFFERENT STORY

Page 5: Indoor location in mobile applications using iBeacons

ISSUES▸ GPS signal rarely works indoors▸ When it does, it's often inaccurate

▸ No concept of indoor space, such as multiple floors

Page 6: Indoor location in mobile applications using iBeacons

MANY COMPANIES HAVE TRIED TO SOLVE THIS!

Page 7: Indoor location in mobile applications using iBeacons

WIFI SOLUTIONS

Page 8: Indoor location in mobile applications using iBeacons

NFC BASED SOLUTIONS

Page 9: Indoor location in mobile applications using iBeacons

MAGNETOMETER

Page 10: Indoor location in mobile applications using iBeacons

LESS THAN IDEAL RESULTS▸ Expensive▸ Custom

▸ Too heavy on power▸ Unpredictable requirements (e.g. WiFi)

▸ Don't run in background

Page 11: Indoor location in mobile applications using iBeacons

DEMOCRATIZATION

Page 12: Indoor location in mobile applications using iBeacons

IBEACONS

Page 13: Indoor location in mobile applications using iBeacons

GOAL OF THIS SESSION▸ What are iBeacons?

▸ Developing iOS and Android applications ▸ Pushing the boundaries

Page 14: Indoor location in mobile applications using iBeacons
Page 15: Indoor location in mobile applications using iBeacons

CLASSIC

Page 16: Indoor location in mobile applications using iBeacons

BLUETOOTH LOW ENERGY (BLE)

Page 17: Indoor location in mobile applications using iBeacons

BLUETOOTH LE/SMART▸ Designed for low power

consumption▸ Secure, simple pairing

w/ multiple profiles▸ Wide range of hardware

vendor support

Page 18: Indoor location in mobile applications using iBeacons

HOW DOES IBEACON RELATE?

Page 19: Indoor location in mobile applications using iBeacons

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

Page 20: Indoor location in mobile applications using iBeacons

REDBEAR BEACON▸ RedBear BLE Mini▸ TI CC2540

▸ 5v USB or 3.4v cell battery input

▸ Around $30 USD

Page 21: Indoor location in mobile applications using iBeacons

HOW DO IBEACONS WORK?

Page 22: Indoor location in mobile applications using iBeacons

IBEACONS IN USE▸ iBeacon broadcasts

signal using a UUID▸ UUID is unique to a group of iBeacons, not

an individual

Page 23: Indoor location in mobile applications using iBeacons

IBEACONS IN USE▸ Beacon identifies itself

in the group using a Major and Minor number▸ For example, Major: 1,

Minor 2

Page 24: Indoor location in mobile applications using iBeacons

IBEACONS IN USE▸ Devices can find iBeacons nearby that

match a particular UUID▸ This is known as ranging for beacons

Page 25: Indoor location in mobile applications using iBeacons

IBEACONS IN USE▸ Once found, device can

detemine power level of signal from the beacon▸ Which in turn can

approximate the distance

Page 26: Indoor location in mobile applications using iBeacons

IBEACONS IN USE▸ Three enumerated ranges supported in the

specification▸ IMMEDIATE, NEAR, and

FAR

Page 27: Indoor location in mobile applications using iBeacons

EXAMPLE SCENARIOS

Page 28: Indoor location in mobile applications using iBeacons

RETAIL STORE: PRODUCT PROMOTION AND LOCATION

Page 29: Indoor location in mobile applications using iBeacons

EDUCATION: MUSEUM INFORMATION SYSTEM

Page 30: Indoor location in mobile applications using iBeacons

OIL & GAS: PERSONNEL SAFETY SYSTEM

Page 31: Indoor location in mobile applications using iBeacons

REAL ESTATE: OPEN HOUSE WALKTHROUGH

Page 32: Indoor location in mobile applications using iBeacons

REMEMBER, IBEACONS ARE NOT SMART!

Page 33: Indoor location in mobile applications using iBeacons

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

Page 34: Indoor location in mobile applications using iBeacons

DEVICE COMPATIBILITY

Page 35: Indoor location in mobile applications using iBeacons

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

Page 36: Indoor location in mobile applications using iBeacons

DEVELOPING APPLICATIONS THAT SUPPORT IBEACONS

Page 37: Indoor location in mobile applications using 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

Page 38: Indoor location in mobile applications using iBeacons

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 ();}

Page 39: Indoor location in mobile applications using iBeacons

ANDROID▸ Apple does not provide iBeacon SDK for Android

▸ Radius Networks open sourced SDK▸ Extend Activity with IBeaconConsumer

▸ OnIBeaconServiceConnect and RangingBeaconsInRegion

Page 40: Indoor location in mobile applications using iBeacons

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);}

Page 41: Indoor location in mobile applications using iBeacons

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}

Page 42: Indoor location in mobile applications using iBeacons

DEMO

Page 43: Indoor location in mobile applications using iBeacons

WHAT DID WE SEE?▸ Simple application using CLLocationManager to range

for beacons▸ Relatively accurate line-of-sight proximity detection

▸ Enumerated proximity levels

Page 44: Indoor location in mobile applications using iBeacons

BEYOND THE BASICS

Page 45: Indoor location in mobile applications using iBeacons

RUNNING IBEACONS IN THE BACKGROUND

Page 46: Indoor location in mobile applications using iBeacons

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

Page 47: Indoor location in mobile applications using iBeacons

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

Page 48: Indoor location in mobile applications using iBeacons

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

Page 49: Indoor location in mobile applications using iBeacons

DEMO

Page 50: Indoor location in mobile applications using iBeacons

BETTER ACCURACY OF INDOOR LOCATION

Page 51: Indoor location in mobile applications using iBeacons
Page 52: Indoor location in mobile applications using iBeacons
Page 53: Indoor location in mobile applications using iBeacons
Page 54: Indoor location in mobile applications using iBeacons

TRILATERATION

Page 55: Indoor location in mobile applications using iBeacons

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

Page 56: Indoor location in mobile applications using iBeacons

DEMO

Page 57: Indoor location in mobile applications using iBeacons

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

Page 58: Indoor location in mobile applications using iBeacons

NOT PERFECT...

Page 59: Indoor location in mobile applications using iBeacons

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

Page 60: Indoor location in mobile applications using iBeacons

WRAPPING UP

Page 61: Indoor location in mobile applications using iBeacons

IBEACONS

Page 62: Indoor location in mobile applications using 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

Page 63: Indoor location in mobile applications using iBeacons

THANK YOU!

Page 64: Indoor location in mobile applications using iBeacons

Q&A▸ Simon Guest, Distinguished Engineer, Neudesic LLC

▸ simonguest.com (@simonguest)▸ http://github.com/simonguest/gids▸ http://slideshare.net/simonguest

Page 65: Indoor location in mobile applications using iBeacons

-- http://www.amazon.com/File-

New-Presentation-Developers-Professionals/

dp/0615910459