ESP8266 - 1+ Year 18650 battery lifetime
Around 1.5 year ago I started developing small sensors that could be placed around the house measuring temperature and humidity. The first few version did not last very long on their batteries (2xAA), around 1-3 months. So I spend some extra effort reducing average power consumption.
It has now been more then a year ago that I placed the first two sensors. Below is the reported battery level over the past year: (there is a slight offset between the readouts, the values are not calibrated).
There is still some battery life left, I suspect another months.
The sensors are build from the following components:
- ESP12-F or Wemos D1 mini
- XC6206 3.3V ldo.
- TrustFire 18650 cell with protection.
(image from ebay.com) (image from aliexpress) (image from aliexpress)
The sensor takes the following steps:
- Enable and configure Sensor
- Setup WiFi and connect
- Take measurement
- Connect to MQTT server
- Push message
- DeepSleep for 15 minutes
Lowering power consumption
The most critical thing for this sensor is to lower the average power consumption as much as possible.
Bypass Wemos D1 mini LDO
By feeding the wemos D1 3.3V directly we bypass the internal LDO. I later switched some over to using a ESP12-F modules to get rid of the serial to usb converter (and they are cheaper). However switching to ESP12-s, to save on external parts, failed as they have problem resetting themself. (Anybody in need for 10 ESP12-S modules that need two reset pulses to reset?)
Power off the BME280
Between samples, I make sure to fully poweroff the BME280. I do this by feeding it from one of the ESP8266 GPIO pins, so it can be powerdown. Some BME280 board you can buy (and in the above screenshot) have a build-in LDO to drop 5V to 3.3V . While it is unneeded it does not seem to make a lot of difference, given the short time powered on.
Store and restore Wifi settings
This is a tip I found on the internet. It used to work well with my old WiFi router. However with my new Unify accespoints I don’t think this tricks still works. Quick connect fails most of the time. But with the unify setup, connecting seems to be a lot quicker.
I followed the information presented here;
Disable DHCP, use static ip
This is a big time saver, using a static IP reduces a lot of on time. It removes around 40% of the on time.
All these changes resulted in an idle current of around 26 µA (including ldo). The on time is harder to determine, as it varies between 1 and 3 seconds depending on variables.
The battery I bought is a TrustFire 3400mAh. Unexpected, doing a few charge/discharge cycles seem to confirm the 3400mAh. Lets assume a 1% discharge per month then it holds around 3000mAh after a year (no idea if this assumption is correct). If we want get a year of battery lifetime we can have a maximum average consumption of 342 µA. This means that during on time we can consume a maximum average of 95 mA. This seems to be well within the capability of a ESP8266. The results seem to confirm that we manage to stay within this power budget.
Every sensor needs a case. The first version I designed was milled out of 3mm hardwood plywood. While this looked nice, it absorbed enough moisture to work as a low-pass filter on the humidity sensor.
Only found photo of unvarnished prototype of the box:
I made another one by milling it out of plastic, but when you go plastic, why not 3d print it. So I redesigned it for 3d printing, this gave the desired result.
The case is split into 3 parts. The box on the right, with grills at the bottom and top, holds the bme280 sensor. On the left it is split in one box for the battery and the other for the Wemos D1 mini/ESP8266.comments powered by Disqus