ESP8266 + bme280 battery life: 120 days and counting

The sensor

I have an outside battery powered temperature/humidity/pressure sensor, here is the list of what it is based on:

  • ESP8266 (esp12f), according to espressif
    • from 120 to 170mAh for Tx
    • 10µAh in deep sleep mode
  • bme280
    • 3.6µAh at 1Hz when measuring the 3 parameters
  • MCP1700-3302E LDO
    • 1.6µAh quiescent current
  • Panasonic NCR18650B
    • 3400 mAh

It looks like this:

homie-esp8266-bme280

Active time

When writing the code for this device, I added some debug to time how long it needed to go from deep sleep, connect to wifi, read values, send them to MQTT and go back to deep sleep mode. That was a tiny bit over 4s, and without print, a tiny bit below 4s. So for the final version, I built it without any print, which means even less than what was in my test, as I still need to initialize the serial, and do at least one print to show the time. I guess we can use 4s as a basis here, and assume that it actually is lower than that.

Deep sleep is set to last 10 minutes every time, so:

  • 4 seconds active
  • 596 seconds deep sleep
  • OR 24 seconds active and 3576 seconds of deep sleep in an hour

Theorical estimations

Once again, it is lilkely below that, but let's assume the esp module is using 170mAh when active:

(170 / 3600) * 24 = 1.1333333333333333

And 10µAh for 3576 seconds:

((10 / 1000) / 3600) * 3576 = 0.009933333333333334

The bme280 will only be powered when the esp module is asking for it, so let's round it to the 24 seconds an hour, which is probably a bit more than real world usage as it will likely only be active when doing the reading

((3.6 / 1000) / 3600) * 24 = 2.4e-05

And finally, 0.0016mAh for the LDO:

1.1333333333333333 + 0.009933333333333334 + 2.4e-05 + 0.0016 = 1.1448906666666667

So in a day:

1.1448906666666667 * 24 = 27.477376

Which sums up to 27.477376mA a day.

The Panasonic batteries are apparently measured pretty often around 3280mAh, so

3280 / 27.477376 = 119.37093265383129

We can round that down to 119 days.

If considering 120mAh this figure goes up to 168.4 days.

Also note the actual code goes:

  • wake up
  • connect to wifi
  • connect to MQTT broker
  • read sensor values
  • send values to MQTT broker
  • go back to sleep

I would venture that this probaly mean we are not in Tx mode all the time, so the actual esp module consumption during these ~4 seconds is likely shorter, therefore we can hope for even longer battery life.

Dream mode on: If Tx is at about 120mAh and is actually half the awake time, and the rest is Rx, at about 56mAh, that would bring us to 228 days!

Trying to be more serious, it seems likely that Tx is not using the higher current, and that it only is using part of the awake time, so I would be pretty happy with 6 months battery life.

Real life

At first I wanted to write this once I had depleted an 18650 cell completely.

Knowing I estimated it at first with about the same as today, so 119 days. That being theorical, I was actually expecting 90 days, maybe a 100. Espcially as there was quite some time below freezing point since it was put up, and that this has bad impact on batteries as far as I know.

It now has been 4 months, since november 25th, or 120days and it still is running, Vcc measurement doesn't seem to get any lower, but the only measures I hava is from the ESP.getVcc(), which is what the ESP gets, and not what the battery actually deliver.

The readings jittters between 3.14 and 3.33v knowing the MCP1700-3302E has a dropout voltage of 0.178v, we can assume that at worst, the battery still delivers 3.318v. I got an alarm set when this goes below 3.1v, so if the real battery gets below 3.278v, so the battery is safe.

I'll likely do a new post when the battery is finally depleted.