Energy efficiency: ble devices – when can I connect?
I am designing a custom ble device protocol. My device will be one of - scale, sphygmomanometer, fitness belt
The protocol defines the collection process that my android / IOS collector will use to collect sensor data from one of these devices
We can assume that the collector exists for 50% of the time and is searching for broadcast devices in the broadcast to connect and collect data from it
My question is: considering the battery power, what is the effective way to make the device connectable?
My current practice:
The device is connectable if
>(A) For some users, its measured value has not been sent, > (b) the user turns it on (by stepping on the scale, pressing the button or other operations)
In case (b), the device broadcasts itself, for example, every 1 second can be used to connect to the collector
In the case of (a), the device broadcasts itself, for example. Every 5 seconds can be used to connect to the collector
Once the condition (a) / (b) is not met, the device enters sleep mode - no content is broadcast
Is this an effective way through energy consumption? Is there a better way to achieve "device visibility"?
Postscript there is no better resource to ask this question, but this question can be regarded as a programming problem because it is related to firmware programming
resolvent:
See my decision tree
If you link the sleep / off and start boxes together, the code will run a very efficient infinite loop. If you open the device or have data to share, it will open the device
Start - –
B) Did the user open me?
>No: continue to a) > Yes: continue with questions 1. And 2
A) Do I have any data to send?
>No: if there is no "user open" command and no need to send any data, then: enter the sleep / off state (probably cause the startup box and restart the cycle) > Yes: the user does not open the device, but has data to send; then:
>If connection = true - > send data. > if connection = / = true - > start a timer and start the connection cycle at a fixed interval of 1 or 5 seconds in the next 2-5 minutes
When timer = 2-5min or connection = true, the connection cycle ends. When the timer runs out, it enters the off / sleep state
Note: just in case, you may or may not want to add an error handler to break the code to a)