Elevate: an iBeacon experience made by Touchwonders

Post on 22-Jul-2015

169 views 0 download

Transcript of Elevate: an iBeacon experience made by Touchwonders

An iBeacon experience made by Touchwonders

Elevate

Fabio Milano

ElevateThe challenges

iOS SDK and iBeacons

Monitoring and rangingHow iOS listens to a beacon signal

BEACON REGION

Broadcast signalWhat an iBeacon transmits

Data(up to 31 bytes)

UUID Major Minor Measured Power

An iBeacon “object”Get your app ready for some iBeacons

CLBeaconRegion *beacon = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:elem[@"UUID"]] major:[elem[@"major"] integerValue] minor:[elem[@"minor"] integerValue] identifier:elem[@"identifier"]];

@interface CLBeacon : NSObject <NSCopying, NSSecureCoding>

@property (readonly, nonatomic, strong) NSUUID *proximityUUID;

@property (readonly, nonatomic, strong) NSNumber *major;

@property (readonly, nonatomic, strong) NSNumber *minor;

@property (readonly, nonatomic) CLProximity proximity;

@property (readonly, nonatomic) CLLocationAccuracy accuracy;

@property (readonly, nonatomic) NSInteger rssi;

@end

- (void)startLookupForBeacon:(CLBeaconRegion *)beaconRegion { // Start monitoring [self.locationManager startMonitoringForRegion:beaconRegion]; } [...]

// Receive region cross-boarding events - (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region { CLBeaconRegion *beaconRegion = [self.rangedBeacons objectForKey:region.identifier]; switch (state) { case CLRegionStateInside: { NSLog(@"locationManager didDetermineState INSIDE for %@", beaconRegion.identifier); [self.locationManager startRangingBeaconsInRegion:beaconRegion]; [self scheduleEnterNotification:beaconRegion]; if (self.delegate) { [self.delegate didEnterRegion]; } } break; case CLRegionStateOutside: { NSLog(@"locationManager didDetermineState OUTSIDE for %@", beaconRegion.identifier); [self scheduleExitNotification:beaconRegion]; [self.locationManager stopRangingBeaconsInRegion:beaconRegion]; if (self.delegate) { [self.delegate didExitRegion]; } } break; default: break; } }

- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region

{ if ([beacons count] > 0) { for (CLBeacon *beacon in beacons) { NSLog(@“RSSI: %d", beacon.rssi); NSLog(@"Accuracy: %f", beacon.accuracy); NSLog(@"Proximity: %d", beacon.proximity]); NSLog(@“----------------");

if (self.delegate) { [self.delegate didReceiveSignal:beacon.rssi accuracy:beacon.accuracy proximity:beacon.proximity]; } } } }

ElevateThe challenges

Positioning Responsiveness Accuracy

PositioningWhere should I drill ?

Floor’s “template”Location

Define beacon regionWhispering loudly

BEACON REGION

PROXIMITY FIELD

Out restroom’s doorCollected data

RSS

I

-100

-80

-60

-40

-20

0

Seconds1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

iBeacon signal Upper bound Lower bound

Find your beaconGimbal S20

95mmx102mmx24mm

Find your beaconGimbal S20

battery life of approximately 1-3 years

Find your beaconGimbal S20

configurable omni-directional or directional antenna

Directional brodcast signalGimbal S20

ResponsivenessCaffeine mode

Monitoring and

rangingStart background task End background task

Collect data for threshold mechanism

ResponsivenessCaffeine mode

Start background task End background taskCollect data for threshold mechanism

PrecisionDistance between an iBeacon and an iDevice

CLProximityiBeacon proximity

Immediate

Near

Far

Unknown

CLProximityWhere is the decimal system ?

“RSSI and proximity estimate are not one-to-one. The proximity estimate is a heavily filtered value intended to capture typical user behaviour and use cases. The other values are available for developers who are willing to spend time experimenting and curating a specific user experience.”

- Apple documentation

CLLocationAccuracy… close but not enough

/* * accuracy * * Discussion: * Represents an one sigma horizontal accuracy in meters where the measuring device's location is * referenced at the beaconing device. * Do not use it to identify a precise location for the beacon. * This value is heavily subject to variations in an RF environment.

* A negative accuracy value indicates the proximity is unknown. * */ @property (readonly, nonatomic) CLLocationAccuracy accuracy;

Estimate iBeacon distance..because we really want it

Moving Average Method Power law model

Power law modelRelation between RSSI and iBeacon’s distance

RSSI = −(10 * n)log10(d) − A

Texas Instruments - Chipcon CC2420

Power law modelRelation between RSSI and iBeacon’s distance

RSSI = −(10 * n)log10(d) − A

Power law modelRelation between RSSI and iBeacon’s distance

RSSI = −(10 * n)log10(d) − A

Power law modelRelation between RSSI and iBeacon’s distance

RSSI = −(10 * n)log10(d) − A

Power law and iBeaconRelation between RSSI and iBeacon’s distance

RSSI = −(10 * n)log10(d) − A

Power law and iBeaconRelation between RSSI and iBeacon’s distance

RSSI = −(10 * n)log10(d) − A

x = (−10)log10(d)

Power law and iBeaconRelation between RSSI and iBeacon’s distance

RSSI = −(10 * n)log10(d) − A

x = (−10)log10(d)

n = (RSSI + A) / x