Drew
Drew

Reputation: 3334

Energy economy: BLE device - when to make connectable?

I am designing custom BLE device protocol. My Device will be one of - Scales, Blood Pressure Monitor, Fitness Band.

The Protocol defines the collection procedure that my Android/iOS app (Collector) will use to collect sensor data from one of these devices.

We can assume that Collector is present 50% of the time and is scanning the air for a broadcasted Device to connect and collect data from it

My question is: What is an effective way of making device connectable, with battery power in mind?

My current approach:

Device is connectable, if

In case (B) Device broadcasts itself e.g. each 1 seconds and is available to be connected to Collector

In case (A) Device broadcasts itself e.g. each 5 seconds and is available to be connected to Collector

As soon as conditions (A)/(B) do not apply, device goes into sleeping mode - not broadcasting anything.

Is this effective approach by means of energy consumption? Or are there any better practices to accomplish "device visibility" ?

P.S. Could not find a better resource for asking that, but this question can be considered a programming question, as it is related to firmware programming

Upvotes: 3

Views: 139

Answers (1)

Kermit
Kermit

Reputation: 64

See my decision tree for this.

If you link the sleep/off and Start boxes together, the code runs an extremely efficient infinite loop which will turn the device on if you turn it on, or if there is data to share.

Start -----

B) Did the user turn me on?

  • No: Proceed to A)
  • Yes: Proceed to questions 1.and 2.

A) Do I have data to send?

  • No: If there was no 'user on' command and no data needs to be sent, then: Proceed to the sleep/off state (which presumably leads to the start box and begins the loop all over again)
  • Yes: the device was not turned on by the user, but has data to send; then:

    1. if connection=true --> send the data.
    2. if connection =/= true --> start a timer and begin the connecting loop for the next 2-5 mins at regular intervals of either 1 or 5 seconds.

The connecting loop ends when either the timer=2-5min or connection=true. When the timer runs out, proceed to the off/sleep state.

Note: you may or may not want to add an error handler to make the code break to A) just in case.

Upvotes: 3

Related Questions