By carefully rearranging the operations my weather station does each time it wakes up, I have reduced the power consumption even further.
As it wakes up, it needs to make a series of measurements:
- Read the current battery voltage
- Read the current temperature from a DHT22
- Read the current humidity from a DHT22
- Read the current temperature from a BMP180
- Read the current air pressure from a BMP180
The battery voltage is read through a resistor voltage divider feeding into the analog input of the ESP8266. This reading is very sensitive, and a massive power drain from the WiFi function will bring down the measured voltage. This can be mitigated by using capacitors to buffer the analog readings, but if I have a choice I’d still prefer to have the WiFi function off when reading this.
The rest of the readings, however, are digital and not that sensitive to overall system power drain, and that gives us an opportunity to do things in parallel.
A 470μF capacitor across the power supply pins of the Huzzah breakout board provides enough of a buffer that we can actually start the WiFi function as soon as the analog voltage reading has been taken. The ESP8266 is able to handle the WiFi connection in the background (as long as the code is sprinkled with delay() or yield() statements, and the code that reads the DHT22 and BMP180 have them. Thus, the WiFi connection can proceed in parallel with reading these two sensors.
This is beneficial, especially as the DHT22 (and other sensors) will have a minimum time from the sensor wakes up until the first reading can be taken. For the DHT22 this is 1 second.
The result? The whole reading/reporting cycle takes about 1.2-1.3 seconds less than before, and while we do use a fair bit more power early in the process, this is more than offset by being able to go back to sleep a lot sooner:
We see the slight gap between the boot loader finishing and the WiFi radio switching on. This is where the analog reading happens. Then, as soon as the WiFi is switched on, we start waiting for the sensors to become ready and then read them.
The sensors are powered by a GPIO output so I can switch them off as soon as I have all the information I need. We can see this as a slightly lower power consumption at about the 1800ms mark.
With this change, the power consumption is now down to 0.054 mAh per cycle, that’s 54 μAh, or approximately one third of where we started.
There’s not much more that can be done without modifying the current sensor. A couple of weeks, at least, before I get another sensor so I can modify one without risking breaking the one I already have.
In the mean time, I’ll start looking at what I can do with the additional headroom I have achieved. As I’m getting tired of running around updating the devices, getting some form of OTA updates up and running will be an interesting project.
A follow-up post is now online, with more power savings.
2 thoughts on “Further reducing power consumption on ESP8266”
Very nice work ! You can further reduce WiFi association time by storing the WiFi channel and BSSID to RTC memory. Once saved you connect by WiFi.begin( ssid, password, rtc.channel, rtc.bbsid). By timeout and reset of channel and BSSID in case of failure one can handle a change in WiFi network. I was able to save approx. 1.5s by avoiding full channel scan on each wakeup. Regards, Tobias
Thanks for that.
That tip sounds very interesting, so I’ll hook the test environment back up tonight and run some tests. There will be a follow up post coming if this works as well as I hope.
I’ve also got a more precise current monitor now, so I’ll see how far down I can push the sleep current, too.
Comments are closed.