Indoor location in mobile applications using iBeacons

Post on 28-Jan-2015

111 views 2 download

Tags:

description

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

Transcript of Indoor location in mobile applications using iBeacons

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