Syncing LTE Beacon events with Estimote Cloud

Arguably the greatest power of the LTE Beacon is that it can talk directly to Estimote Cloud.

The way this works however is somewhat different than, for example, your computer, constantly connected to the Internet. That’s because being online uses energy, and that’s something the battery-powered LTE beacon has a limited amount of.

Instead, the LTE beacon spends most of its time offline. It’ll store data to be sent to Estimote Cloud in its memory. And once in a while, it’ll connect to the network to actually send that data. Or, in the LTE beacon’s micro-app terminology, it’ll enqueue events to be synced later. (For time-sensitive events, you can also force an immediate sync.)

What’s ahead (aka Table of Contents)

Enqueueing events

Each event has a name, and can also have some JSON data attached to it. Let’s check this example:

var oneHour = 60 * 60 * 1000; // timer intervals are in milliseconds
timers.repeat(oneHour, () => {
    var currentTemperature = sensors.temp.get();
    cloud.enqueue("temperature-checkpoint", {temperature: currentTemperature});
});

This code says that every 1 hour, the beacon will read the temperature from its sensor, and generate a new “temperature-checkpoint” event with the temperature attached to it. That event is then stored in the beacon’s memory until we sync it to Estimote Cloud.

Syncing events with Estimote Cloud

There are two main ways to do that:

  • You can configure your micro-app to do the sync periodically—for example, every 1 day.

or

  • Your micro-app can “force” a sync at any given time.

Periodic syncing

Out-of-the-box, the LTE Beacon will sync with Estimote Cloud every 1 month. Your micro-app can change that:

var oneDay = 24 * 60 * 60; // sync period is in seconds
sync.setSyncPeriod(oneDay);

Combined with the hourly temperature checkpoints, we have an app that measures the temperature every hour, and syncs the measurements once a day.

Forced syncing

Micro-apps can also force a sync. For example, maybe there are some exceptional situations when we can’t wait until the daily sync we’ve set above. We could code our micro-app to force a sync with a button press:

io.press(() => {
    sync.now();
});

This way, we get the benefit of automated, daily syncs, with a “fail-safe” option to force a sync with a button press.

Important consideration: battery life

In our temperature-measuring example, why not just sync every time we read from the temperature sensor? Why do the whole, “save events for later” dance?

The thing is, the LTE radio in the LTE beacon uses quite a lot of energy. The more often you use it, the shorter the battery life of your LTE Beacon. This means you need to find the right balance between how often you want to sync, and how often you’ll have to recharge the beacon. Here are some rough numbers to give you an idea:

sync period built-in battery life
daily 15 months
hourly 3 weeks
every 5 minutes < 2 days

Keep in mind: These numbers are just for LTE syncs. If you program your beacon to also do other energy-intensive operations, like GPS tracking or Bluetooth scanning, this will further reduce its battery life.

Important consideration: memory

Storing events to sync them in bulk later is a great little trick, but the storage space isn’t unlimited. If the beacon runs out of space, enqueue might start throwing a Not enough storage space error, and you’ll need to either wait for the next sync, or force a sync, so that the queue gets emptied.

Tip: Starting with firmware 0.0.7, the beacon will automatically attempt to sync the events to Cloud when running low on memory, to make space for new events.

The math of “how many events before I run out” isn’t exactly clear-cut. It depends on how much space other system components (firmware, configuration, your micro-app) use, and how much data the events themselves carry. But let’s say it’s something in the ballpark of 100 to 1000 events.

Note: The events are stored in a persistent flash memory, so they’ll survive things like running out of power, or unexpected restarts.

Important consideration: data usage

LTE Beacon subscription comes with 1000 syncs per year per each LTE Beacon (for example, about 2-3 syncs per day). There’s also a data-cap of 100 MB per year (for example, about 100 kB per sync).

First 3 months (starting the day you receive your dev kit) are free, and then it’s $2 per beacon per month.

You can read more about the LTE subscription on our Community Portal.