Brock Boland
Brock Boland

Reputation: 16720

iOS: How can I determine the power consumption of broadcasting as an iBeacon?

For context: I'm working on an app where we're considering the use of iBeacon to identify other people nearby who are running the app. Any time that the app is running, the device acts as an iBeacon; when the user takes a particular action, their device will range nearby iBeacons to identify others nearby.

I'm trying to figure out what kind of impact this would have on the battery, to continuously broadcast as an iBeacon. It should be minimal (I mean, the whole point of Bluetooth low energy is that it's low energy, right?), but without running two identical devices side-by-side for a couple hours, one broadcast and one not, I'm not sure how to determine how much it will affect battery life.

I tried using the Energy Diagnostics profile in Instruments, but for Bluetooth, it's just on or off. This only changes if I disable/enable the Bluetooth on the device. Starting or stopping iBeacon broadcasting doesn't change anything. It seems unlikely that broadcasting as an iBeacon adds zero overhead on top of the already-running Bluetooth hardware, but Instruments doesn't give me enough info to know that for sure.

Any ideas?

Upvotes: 0

Views: 341

Answers (1)

davidgyoung
davidgyoung

Reputation: 65005

In making the Android Beacon Library, I had to figure out a way to do similar tests on that platform. The technique I used is brute force enough that it should apply to iOS as well.

I. Put your phone in a state where very little will be going on that is not related to your app.

  1. Uninstall or kill any apps that may be running in the background
  2. Disable 3G/Wifi (to prevent OS data transfers from using battery)
  3. Disable your screen from going to sleep (ever).
  4. Charge your battery to 100%

II. Take a measurement of how much your app drains the battery when transmitting as a beacon:

  1. Launch your app and make it transmit as a beacon.
  2. Disconnect your phone from the charger, and record the time.
  3. Wait several hours until your battery gets low. Record how much time has passed since the previous step.
  4. Record the battery level (e.g. 10%)

III. After charging your phone back to 100%, then take a baseline measurement:

  1. Launch you app in a state where it is not transmitting as a beacon.
  2. Disconnect your phone from the charger, and record the time.
  3. Wait exactly the same amount of time as in step II(3).
  4. Record the battery level.

The difference in the battery level between III(4) and II(4) is how much extra your phone uses when transmitting as a beacon vs the baseline.

Yes, this technique will take time -- but run the tests overnight, and you can have your answer in 48 hours. (Although you'll have a dead battery two mornings in a row!)

Upvotes: 2

Related Questions