ESPEasy and deep sleep mode (ESP8266 low power consumption)

The ESP8266 microcontroller is very well prepared to make the best use of energywith very low power consumption modes.

For many people, these low-power modes seem like issues. mystical or occultThe most important thing is that it is within the reach of very few people. elected.

Here you will see that with ESPEasy are very easy to use. and that will allow you to huge energy savings.

What is deep sleep mode?

The deep sleep mode of the ESP8266 means that the microcontroller goes into a deep sleep mode, with virtually all offexcept for a very small part of the microcontroller that checks if this happens. "something" which should cause the rest of ESP8266 to wake up, coming out of its lethargy.

An ESP8266 in deep sleep mode (sleeping, and waiting for for something to happenThe ESP8266 (the ESP8266 is used to wake up) can consume as little as 8 to 20µA (1 mA = 1000 µA) while a NodeMCU board with its ESP8266 in deep sleep mode consumes 8-20mA. That is 500 to 1000 times more!

If you are interested in the topic of low power consumption, I recommend that when you finish reading this article, you read this one. Here you will find all the basics you need to know to reach the low power Olympus with ESP8266:

What do I need to use the ESP8266 deep sleep mode?

You need two things: a complex hardware external precision that allows the microcontroller to go into a coma and a complex programmingThe new, almost undecipherable, even for the best programmers in the world.

The hardware for deep sleep

The hardware you need is this:

And the programming for deep sleep

The programming you need is this:

deepsleep,x

In this article I will tell you how to easily take advantage of this high technology.

ESPEasy and deep sleep

ESPEasy includes full support for putting the processor into deep sleep mode and can be used from your rules very easily.

The first thing you need to know is that the RST pin must be connected to GPIO-16This is necessary in order for the ESP8266 to enter and exit its comatose state. This is what you will use the cable I showed you before, to make a bridge from RST to GPIO-16, as simple as this.

In order for the ESP8266 to enter this comatose stateYou only have to call it from a rule (or a command, for example):

deepsleep,x

Where "x" is the time, in microseconds, you want the ESP8266 to be in deep sleep mode..

When this time has elapsed, the ESP8266 will come out of its deep coma and the execution will begin, exactly the same as if we had just turned it on..

Here are the details of this mode.

Here's what happens when the ESP8266 wakes up from its DEEP NAP and ESP Easy starts working again:

  • Attempts to connect via wifi to the defined SSID, and to SSID2 if defined and SSID fails.
  • If you are unable to connect and you have enabled the option Sleep on connection failureIf you have to do something with wifi and it is not available, why wait any longer, wasting energy).
  • It shall send all sensor measurements at the same time (ignoring any delays that have been defined).
  • It will shut down and sleep for the number of seconds you set in the Sleep Delay setting. Deepsleep uses an internal 32-bit counter in uSecs. That means it is running up to 4294 seconds, longer delays will not work. That is. the longest sleep time is approximately 1 hour and 11 minutes..

Wake up the ESP8266 manually

If you specify a deepsleep,0 the ESP8266 will enter deep sleep mode. without a pre-set time to wake him up.

You will have to wake up the device yourself connecting RST to GNDwith a push button, for example, or a simple cable.

This is a very useful mode if we want to do something like a door or window sensor with a magnetic sensor (which we will connect between RST and GND) and which will make the ESP8266 wake up the moment that contact is closed, seconds or months have elapsed since the last time.

Coming out of deep sleep

When deep sleep mode is active, you cannot connect to the web interface. In fact, the ESP8266 is turned off and there is only a small timer circuit on to wake up the main ESP8266 core when the time comes.

There are three ways to exit deep sleep mode:

Cold start

Turn off the ESP8266 and turn the power back on. You will have 30 seconds to connect to the web interface and disable deep sleep mode (you will get information on the serial port).

Temporary deactivation of deep sleep by means of a jumper

If 30 seconds is too short for you, you can use this method.

Disconnect GPIO-16 from RST and connect it to GND. Reconnect the ESP8266.

Deep sleep will now be disabled and the ESP8266 will operate normally, until you reconnect GPIO-16 to RST.

This requires a version of ESPEasy v2.0.0-dev6 or newer.

Factory Reset

If all else fails, simply perform a factory reset - you will lose all your settings!

The reset is done by connecting the RX and TX pins together while resetting the ESP8266. Turn off the device. Then, remove the connector between the RX and TX pins. Reboot and install the ESPEasy firmware again.

If this does not work, try loading the blank image to match the size of the memory installed in the device. Reboot and wait 5 minutes. Then load the firmware you want to use. Reboot and wait 5 minutes.

DID YOU FIND IT INTERESTING?
DON'T MISS FUTURE ARTICLES LIKE THIS ONE!
SUBSCRIBE TO THE NEWSLETTER AND JOIN THE TELEGRAM GROUP AND DON'T MISS ANY OF THE BEST.

5 thoughts on “ESPEasy y el modo deep sleep (ESP8266 bajo consumo)”

  1. Hi Mario, another good article, thanks for the exposition.
    I have a beginner's doubt: while the ESP8266 is in deep sleep, is the OLED screen still on, showing the last measured values? I assume so, otherwise there wouldn't even be time to see the measurements, but I would like you to confirm this.
    Best regards

    Reply
    • Hello Jesus.

      I haven't tested with an OLED screen and deep sleep but I would say that yes, the image is maintained while the ESP8266 is in deep sleep.

      In any case, it should be noted that although OLED screens consume relatively little power, they still consume (I would say between 5 and 25mA, depending on the brightness and how many pixels are on) so the ideal, if you want to get great autonomy, is to keep the OLED screen off and turn it on with a button that wakes up the ESP8266, turn on and update the screen and turn it off again and return to deep sleep state after a few seconds to allow time to read it comfortably.

      To achieve long autonomies, it is best to use an e-Ink screen, which has a negligible consumption when it is not being updated, as you can see in the article "Design of an ultra-low power CO2 meter". https://emariete.com/diseno-medidor-co2-ultra-bajo-consumo/

      Reply
  2. Thanks Mario, I'm thinking about it, to see if I can clarify what I want to do first. I have also read that article, although without stopping too much, and I have seen the screens, but they are more expensive. That said, if I find the time and inspiration (in that order) I will try to make a low consumption only meter, using the great ideas that you expose in your articles.
    Best regards.

    Reply

Leave a comment