Tutorial Battery Powered Devices

From Let's Control It
Jump to navigation Jump to search

Battery-powered IOT devices with ESP

Unlike BLE, WiFi is not designed for battery powered devices. Nevertheless, with a few tricks it is possible to operate a measuring device (for example a weather station) with a battery pack for more than one year. This is, however, only possible if the ESP is sent to sleep most of the time (deep sleep mode).

The lifetime of the battery depends essentially on three factors: the switch-on time, the switch-on frequency and the quiescent current.

Switch-on time

When the WiFi is switched on, the ESP requires approx. 80mA. This consumption can not be changed, but the on-time (before the ESO is going into the deep sleep mode (with 0.01mA)) can. Therefore, it is important to read the sensors as quickly as possible and to transmit the data to the server without delay. Expanding the transmission time of 1 second will result in a 10% reduction in the lifetime of the battery. Also, the choice of another transmission protocol (HTTP, MQTT) can save another second.

Switch on frequency

If the duty cycle can not be reduced, the distance between the measurements and the transmissions can be extended at least. Of course, it would be nice to push every minute new measured values to the server, but with an hourly update, the battery lives more than a factor of 30 longer. For the ESP, the maximum adjustable distance between two wake-ups is 4294 seconds (71 minutes). For larger (or more accurate) time intervals an external RTC is necessary.

quiescent current

The sleep current (deep sleep mode) of the pure ESP is approx. 0.01mA. Thus the self-discharge of the battery would be greater than the sleep current. However, when using a development board, there are the other components that 'eats' the current. Especially the linear voltage regulator from 5 to 3.3 volts is decisive for the lifetime. The controller on the NodeMCU boards has a quiescent current of approx. 2.5mA and that shortened the battery time by a factor of 10. The voltage regulator on the WeMos D1 mini 'consumes' only 0.15mA, which is a time factor of 1.6. Even if you feed the voltage directly at the 3V3-pin, the controllers pull a cross-current. For new developments or upgrades, the MCP1703-3302 is recommended with has a quiescent current of 0.002mA.

connection failures

For most cases its no use to do anything when there is no wifi connection. Connecting to a controller without wifi connection also takes a long time.

To prevent this use the option 'Sleep on connection failure'. (Use ESPEasy v2.0.0-dev11 or higher)

This way ESPEasy will go back to sleep immediately when it cant connect.

Examples of Battery Life

Minimalist ESP (without voltage regulator) to lithium thionylchloride battery (3.6V 2600mAh); One measurement per hour -> lifetime 1.25 years

WeMos D1 mini to 3x AA battery (2500mAh); One measurement per hour -> lifetime 0.75 years

WeMos D1 mini to 3x AA battery (2500mAh); A measurement every 10 minutes -> lifetime 70 days

NodeMCU to 3x AA battery (2500mAh); One measurement per hour -> lifetime 35 days

Note: All examples with 10 seconds on-time and 80mA current consumption