I’ve been playing with this great new board for a few days now. One issue I have run into is that the battery life is very poor. I’m only getting a couple of days out of a coin cell.
I’ve dug into the code, and a couple of things become clear. First, when running rom battery, when you connect to the board, all the sensors switch on, and stay on, until you disconnect.
Second, when you read the sensor values, you aren’t reading the sensors directly, you are reading a cached copy of the values, which are updated every 3 seconds, continuously while you are connected - irrespective of how often you actually read the values out.
Thirdly, on USB power, sensors are powered on all the time (OK, not a big deal).
The conclusion is that if you connect, stay connected, and read the sensors once per minute, the sensors are live all the time, and the battery dies quickly. In fact, I’m not sure the device sleeps at all when connected.
If you connect, read, then disconnect, you have the problem that the device times out after 30 seconds (ie goes into deep sleep, and can only be woken with a button push).
I have changed this timeout to 1 hour, reduced the advertising cycle to 500ms (from 100ms) and reduced the led flashes (during advertising) to 20ms every 10 seconds, but the battery life is still poor when connecting, reading, disconnecting once every minute. I’m just reading the environmental sensors.
It seems that although the sensors are off when not connected, the device does not sleep at all when advertising. (Although debug output does say BLE sleep mode enabled).
Does anyone have any suggestions on how to reduce battery drain? Make the device sleep between advertisements? Or any other way to extend the battery life beyond a few days?
So I have some success.
I have figured out how everything works, and have added two new GATT parameters "Low Power" and "TX Power"
Now if you write 1 to Low Power, the system does the following:
# turns off the LED
# disables the 100ms clock
# disables beacon switching (ie iBeacon data is not sent, just regular beacons)
# enables short cycle one-shot sensor reading (ie you have to disconnect before you can read the sensors again)
# reduces power consumption to about 70uA average(depending on the Tx Power setting, and how often you read)
Tx Power is obvious, you can read and write it, valid values are -26 to +13dBm. Boot default is +8dBm. You have to sneak the power down until the Rssi is about -90dB, go too low and you won't be able to connect anymore.
I have also lowered the advertising interval to 1 s (from 100ms). If you go lower (10.4s max) you can't connect reliably.
This should give a theoretical battery life of 6 months, reading once per minute. The power down after 30 seconds is completely disabled, but advertising at 0dBm consumes 50uA, so it's not a big drain (reading the sensors consumes 6-8mA for 1 second, so that's the gating factor).
All the Environmental sensors turn on and off at once (irrespective of what you actually read), so if you just wanted one or two sensors read, better battery life could be obtained by making the sensor power control more fine grained.
The system does sleep in EM2, it was just that the 100ms clock was on all the time, even when it was doing nothing, so this was confusing me. enabling smart energy profiling (thank you Silicone labs!) with code correlation helped immensely. Turned out to be easy to enable, just not explained anywhere (I do have a Happy Gecko STK which you need for this). You don't need anything if you just want to program though (just Simplicity Studio). The COM port printing is nice, if you are used to Arduino environments, it's just the same - except with eclipse bells and whistles.
I do have some projects in mind for this, so now I know how it works, and how to extend the battery life, I may actually build something (awning monitor is one I am planning "is it in/out, is it hot, bright? etc"). Might need AA's for that.
You can also find some neat 3D printed cases for them online. I got a few and they are nice. Would be nicer if SI made a form fitting case like the TI sensortag though.
I'm using python and bluepy to control the boards (my program also monitors SI SensorPucks and TI senstortags as well). It's running on my server 24/7 but would work on a RPi equally well I think (as long as you have blueZ).
Altogether an outstanding little board!
Any chance you might care to share your solution?
I'm looking to understand what I can maniputale to squeeze the most out of battery life as well and it would be an immense time saver to start with what it is you developed.
are you still present ? it really would be great, if you'd be willing to share your implementation code for your enhanced Thunderboard Demo solution for extented battery life !