How to use accelerometer and Telemetry packet?

Follow

Every Estimote Beacon has an accelerometer installed. This means that the beacon detects when it’s put in motion, giving you the ability to enrich your app with additional context. Also, conditional broadcasting allows to ‘mute’ a beacon based on accelerometer readings, which makes testing easier and helps preserve battery life.

The new beacons automatically enable/disable the accelerometer depending on whether you're using any features that require it or not. For example, if you enable the Estimote Telemetry packet, which makes the beacon broadcast all of its sensor data, then our firmware automatically enables the accelerometer.

Estimote Stickers also come with a built-in accelerometer. They use our own Nearable communication protocol to advertise motion status. This means that stickers broadcast full accelerometer data over the air at all times.

Visit Estimote Developer Portal to learn how to utilize stickers’ motion data.

How to use Estimote Telemetry packet and accelerometer?

Telemetry is one of the packets that you can use in Proximity and Location Beacons. These days, both types of beacons ship with Telemetry enabled by default. If you bought beacons before September 2017, you will have to probably enable it manually. In order to do so, connect to a beacon with the Estimote app and update the settings. You can also enable it in the Estimote Cloud.

Telemetry allows you to broadcast real-time sensor and health check data from your beacon to a nearby device. These can include temperature or ambient light readings but also battery level or accelerometer (motion) data. Especially the latter one is very useful in many use cases. You can display specific content on the nearby devices when a beacon or a Sticker is in motion. You can also prompt actions to be taken when a beacon starts moving or is still for the specified time (e.g. log a visit, send an email, analyze the usage of an object). Finally, you can measure the time 

Motion data can be very useful in many use cases. You can display specific content on the nearby devices when a beacon or a Sticker is in motion. You can also prompt actions to be taken when a beacon starts moving or is still for the specified time (e.g. log a visit, send an email, analyze the usage of an object). Finally, you can measure the time a device spends in motion or still and prompt specific actions based on it.

In order to receive the sensor data through the Telemetry packet, you'll need to have a device (such as a smartphone or another compatible device) placed in the near vicinity to a beacon. You'll then be able to constantly observe as the data changes on the nearby device (via a dedicated app) or remotely (on a desktop or mobile devices).

Do I need to use Estimote Telemetry packet?

No. But keep in mind that it's the most robust way to utilize sensor data. Estimote Telemetry packet broadcasts the data from all the sensors beacons are equipped with, including motion status and accelerometer readings. It’s connectionless: to access data you only need to be in a range of a beacon. Check out our telemetry tutorial on Dev Portal to learn more.

If your app uses iBeacon as the default protocol, you might also try a basic feature called Motion UUID built on top of iBeacon. In order to try it out, make sure the iBeacon packet it on. Motion UUID allows for the limited motion tracking, as the 30 seconds delay might affect the results (see below for details).

When using Motion UUID, only one UUID is broadcast at a time (the ‘static’ one or the ‘motion’ one). We can figure out whether the beacons in motion or not by ranging/monitoring for both UUIDs.

Note about monitoring:

iBeacon's region monitoring has a built-in delay of around 30 seconds from the point when the beacon goes out of range till the exit event is triggered by iOS. The implication is that when the beacon starts moving, the exit event for the ‘static’ region won’t be triggered until 30 seconds pass with the beacon constantly in motion. Same goes for the beacon stopping moving and the ‘exit’ event for the “motion” region.

 

How do you use Motion UUID?

Define the “static” and “motion” regions:

NSUUID *stillUUID = ESTIMOTE_PROXIMITY_UUID;
CLBeaconRegion *staticRegion = [[CLBeaconRegion alloc] initWithProximityUUID:stillUUID major:123 minor:456 identifier:@"still"]; NSUUID *motionUUID = [ESTBeaconManager
motionProximityUUIDForProximityUUID:stillUUID];
CLBeaconRegion *motionRegion = [[CLBeaconRegion alloc] initWithProximityUUID:motionUUID major:123 minor:456 identifier:@"moving"];

Use ranging for best responsiveness in detecting whether the beacon broadcasts its regular UUID, or the motion UUID:

[self.beaconManager startRangingBeaconsInRegion:staticRegion];
[self.beaconManager startRangingBeaconsInRegion:motionRegion];
...

- (void)beaconManager:(id)manager
      didRangeBeacons:(NSArray *)beacons
             inRegion:(CLBeaconRegion *)region {
    if ([region.identifier isEqualToString:@"still"]
            && beacons.count > 0) {
        NSLog(@"the beacon is still");
    } else if ([region.identifier isEqualToString:@"moving"]
            && beacons.count > 0) {
        NSLog(@"the beacon is moving");
    }
}

Hint: Location Beacons (hardware revision "F") and next-generation Proximity Beacons (hardware revision "G") can broadcast their motion status, as well as full accelerometer data, directly in an Estimote Telemetry packet:

Scanning telemetry data with Estimote iOS SDK
Scanning telemetry data with Estimote Android SDK

Flip to Sleep and Motion only

When Flip to Sleep is enabled, beacon goes ‘mute’ if it’s put on its back.

When Motion UUID is enabled, beacon goes ‘mute’ if it’s not moving.

Read the article on conditional broadcasting to learn about benefits of Flip to Sleep and Motion only modes.

Was this article helpful?
0 out of 0 found this helpful

1 Comment(s)

  • Avatar
    Samuel Cox

    I'm slightly unsure how to implement this code within, say, the iOS SDK accelerator example app. Could you expand on how to do this? Thanks

Estimote is
hiring!