Reducing WiFi power consumption on ESP8266, part 2

In my previous post I showed the baseline power consumption data for one of my ESP8266-based weather monitors.

The device wakes up from deep sleep, reads some sensors, connects to a WiFi network and transmits the readings over MQTT, it will then go back to sleep for 5 minutes.  One such reporting cycle would consume 0.164 mAh.

This time I’ll show the first steps on the way to reducing this to less than half.

Continue reading “Reducing WiFi power consumption on ESP8266, part 2”

Reducing WiFi power consumption on ESP8266, part 1

The ESP8266 is a brilliant little chip, one I am using for a lot of network connected devices such as weather stations, lighting controllers, environment monitors, etc.

For a lot of these, it is important to be able to run for extended periods on batteries.  Several will be in places where there is no power connections, and I don’t want to run around changing batteries all the time.

After experimenting for a while, I had a weather station which could operate for 3 weeks on 4 AAA batteries.  Not too bad, considering the device had WiFi connectivity and would transmit the current readings back to my server every 5 minutes.  However, it is possible to achieve much better results than this. Continue reading “Reducing WiFi power consumption on ESP8266, part 1”

Adding retained messages to Adafruit's MQTT library

Recently, when building a weather station based on Adafruit’s Huzzah ESP8266 breakout board, I needed the ability to send messages that should be retained on the MQTT server.

I am using mosquitto on my home server, acting as a message broker.  My weather stations send messages to it and these are then forwarded to the subscribers who have signed up for them.  At the moment, these subscribers are a weather logging system, a current weather display panel on the different computers at home, and, occasionally, a command-line client used for troubleshooting.

As the weather stations are battery powered, they will not run always on, always connected, but they wake up every few minutes, check the weather, and transmit the results to the MQTT server before they go to sleep again.

Any subscribers will receive these messages as soon as they are sent.  However, when a subscriber starts running and connects to the MQTT server, it will not receive any messages until the relevant weather station sends one.  By default, there’s no concept of the most recent values.  This is kind of inconvenient for the weather panel application on the computers, as they will not show any values until the next time the weather station wakes up.  Depending on the battery levels and configuration, that could be quite a while…

Continue reading “Adding retained messages to Adafruit's MQTT library”