How to Make Wemos D1 Module Sleep Effectively
Typically, autonomous data collection devices and alarm devices spend more time in a sleep state.
For the development of IOT devices based on ESP8266, the Wemos D1 mini module is convenient, which contains a USB-UART adapter and a 3.3V LDO ME6211C33 for powering the ESP.
It is easy to work with this module out of the box on any PC, program the module and exchange data with it via USB and WiFi.
The Wemos module can be easily integrated into various stand-alone devices. To connect an external power source, the module has two contacts 5 volts and 3.3 volts. Any source with a voltage from 4 to 6 volts can be connected to the 5 volt contact. A battery or accumulator should be connected to the 3.3 volt pin via an LDO type ME6211C33.
Therefore, to use the Wemos module in self-powered devices, you must either connect the battery to the 5 volt pin, or via LDO to the 3.3 volt pin.
It would seem that everything is simple, but the problem is that turning on the power in this way does not significantly reduce the current consumption of the module at a time when it is not active, that is, the ESP chip is in DEEP SLEEP mode.
If you put the WEMOS D1 mini module (ESP8266 chip) into sleep mode, the current consumption when powered through the 5V pin will be 0.2mA, and when powered through the 3.3V pin, the current will be 0.14mA.
To understand the share of energy consumption during sleep, consider an example of the operation of an autonomous temperature sensor, which sends readings to the server once every 10 minutes.
The active operating mode of the module will consist of the following stages:
Wake-up: 0.033s* 30mA= 1 mA*s;
Sensor polling: 0.5s* 80 mA= 40 mA*s;
Transmitter operation: 0.01s* 300mA= 3 mA*s;
Sleep mode: 599.36s* 0.2mA= 120 mA*s;
Total: 164 mA*s.
Thus, the energy consumption of the module in sleep mode is 85% of the total costs.
If you make devices on ESP12 modules (ESP8266), then the current consumption in sleep mode is 0.02 mA and the power consumption in this mode for our example will be 12 mA*s or 35% of the total cost of 33 mA*s. But such a solution requires a certain level of knowledge of circuit design and complicates the development of the final device.
Let's look at a simple way to reduce the current in sleep mode of the Wemos module to 0.03mA.
In this case, the active operating mode of the module will consist of the following stages:
Wake-up: 0.033s* 30mA= 1 mA*s;
Sensor polling: 0.5s* 16 mA= 8 mA*s; (see previous articles)
Turning on Wi‑Fi: 0.1s* 80 mA = 8 mA*s;
Transmitter operation: 0.01s* 300mA= 3 mA*s;
Sleep mode: 599.36s* 0.03mA= 18 mA*s;
Total: 38 mA*s.
Which ensures the energy consumption in sleep mode in our example is 18 mA*s, which will be 45% of the total energy consumption of 38 mA*s, which will decrease by about 4 times.
![Source module. The conductor break is marked in red. Source module. The conductor break is marked in red.](https://habrastorage.org/getpro/habr/upload_files/f4a/407/15c/f4a40715c1e017e83ac14cc76e32a2d9.png)
![Modified module Modified module](https://habrastorage.org/getpro/habr/upload_files/c51/026/1db/c510261dbb7481229f493bae9be80bbd.jpg)
To allow Wemos to wake up from sleep mode, a Schottky diode is installed from the RST pin to the D0 pin.
To reduce the current consumption when operating on battery power, it is enough to break the conductor on the printed circuit board connecting the LDO (the conductor from under the CH340 chip) with the conductor from the 3.3V contact.
In this case, the ESP12 will be powered only from the 3.3V contact, which requires a battery even when operating from USB.
To ensure that the operating mode of the USB module does not change, you need to install a Schottky diode in the place where the conductor breaks, with the cathode towards the 3.3V contact.
As a result, the current consumption in sleep mode through the 3.3V contact will be 0.04 mA.
If you remove the LED on the ESP12 module, the current consumption in sleep mode will be 0.03 mA.
After such an upgrade, the Wemos D1 mini module can work in the battery-powered device in our example for about 4 times longer than before.