Different power consumption in sleep-modes !?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Different power consumption in sleep-modes !?

#1 Post by Micha_he » 27 Jan 2020, 18:27

Hardware: ESP-01 without power-led for my battery-powered window-contact. Wakeup only via RST.
Software: ESP_Easy_mega-20191208_normal_ESP8266_1M_VCC.bin (same with older versions)

If I configure the DeepSleep via 'Config/Sleep Awake Time', the ESP-01 goes into DeepSleep and need less than 20µA. All Ok.

Now I'll use the rules to publish some values and then go to DeepSleep with the Command 'DeepSleep,1' (zero doesn't work). The parameter 'Config/Sleep Awake Time' is reset to 0 and the rule put the ESP-01 to DeepSleep after some seconds. But the power consumption is ~13mA ! That's factor 650 more...

Is there a problem with the DeepSleep-command ???

seb82
Normal user
Posts: 62
Joined: 05 Sep 2018, 10:56

Re: Different power consumption in sleep-modes !?

#2 Post by seb82 » 28 Jan 2020, 10:34

deepsleep,1 will put the esp in deepsleep for ... 1s.

Look at the example in this documentation.
Sébastien - espRFLinkMQTT gateway RFLink MQTT on esp

seb82
Normal user
Posts: 62
Joined: 05 Sep 2018, 10:56

Re: Different power consumption in sleep-modes !?

#3 Post by seb82 » 28 Jan 2020, 10:37

If you want something really efficient for a door contact, you need to add an attiny13 or use another protocol (zigbee for example).
Sébastien - espRFLinkMQTT gateway RFLink MQTT on esp

Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: Different power consumption in sleep-modes !?

#4 Post by Micha_he » 28 Jan 2020, 11:24

Yes, I know that. But the GPIO-16 is NOT connected to RST ! So it doesn't matter, if it sleep 1s or more... The ESP didn't wake up, that's sure.

And with the DeepSleep from the config-page, my two AA-batteries reach ~ 1 year, before I must change it. Without ATtiny13.

I assumed the command would do an identical DeepSleep, like the DeepSleep-configuration from the config-page.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Different power consumption in sleep-modes !?

#5 Post by TD-er » 28 Jan 2020, 21:49

Maybe the ESP doesn't wake up, but the timer will trigger an alarm to wake up and I am not sure if that pulse will trigger every second, or maybe remains triggered.

What you can do is use an FET to power the ESP.
Connect the switch to trigger it over the FET and set a pin that's pulled up (e.g. GPIO2) to the gate.
Then the ESP will draw almost nothing when off (as little as the leaking current of the FET) and to let the ESP switch itself off, draw the GPIO pin low.

See for example: https://electronics.stackexchange.com/q ... th-esp8266
And a very nice tutorial on transistors: https://www.youtube.com/watch?v=Kvl-mR5gldw

N.B. by switching off like this, you will loose RTC information, so connecting to wifi may take a bit more time and you cannot refer to sensor values from before switching off.

Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: Different power consumption in sleep-modes !?

#6 Post by Micha_he » 29 Jan 2020, 08:26

Nice idea with the FET-schematic....

But back to the real problem:

There is no difference between the comands "DeepSleep,1" and "DeepSleep,300" ! All over the (sleep-) time, the ESP needs 10-13mA. If you were right, it should be less in the second case, until the timer ends.

It appears, the ESP goes into a different sleep mode with the rule commands. Either because a timer is running or some other components (CPU, RTC, WIFI) are not disabled.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Different power consumption in sleep-modes !?

#7 Post by TD-er » 03 Feb 2020, 14:38

I was thinking about this.
What if the sensors are indeed not put into some sleep mode, so not the ESP is to blame, but some of the sensors.

Can you test it with a unit without any external sensor connected?

Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: Different power consumption in sleep-modes !?

#8 Post by Micha_he » 03 Feb 2020, 16:07

The ESP has no other sensors. Only two reed-contacts, one for the RST and one for close position.
And between the current-measuring-tests, I've nothing changed on the wiring. Here's the schematic:
FK001_Schaltplan.jpg
FK001_Schaltplan.jpg (24.44 KiB) Viewed 19096 times

Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: Different power consumption in sleep-modes !?

#9 Post by Micha_he » 03 Feb 2020, 17:53

TD-er wrote: 28 Jan 2020, 21:49 Maybe the ESP doesn't wake up, but the timer will trigger an alarm to wake up and I am not sure if that pulse will trigger every second, or maybe remains triggered.
Sorry, my mistake (The second test-esp01 has a additional resistor at GPIO16). You're right!
While the sleeptime from the deepsleep-command, the ESP needs only ~20µA. But when the sleeptime is over, he needs ~13mA, forever... !

Then I'll have to wait, until the command 'DeepSleep,0' works.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Different power consumption in sleep-modes !?

#10 Post by TD-er » 03 Feb 2020, 18:07

Can you measure what happens on GPIO16 after the sleep time is over?

I will have a look at the code to see what is the difference between going to sleep using the command and when it goes into deep sleep as interval.
What version are you running?
I thought I had changed something like this a few months ago, but apparently not enough?

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Different power consumption in sleep-modes !?

#11 Post by ThomasB » 03 Feb 2020, 19:18

Perhaps the serial log's Info Level will provide some useful information. That is to say, compare the sleep messages that appear during Config/Sleep Awake Time versus those you see in the Command DeepSleep. If they are different then post the logs for review.
Can you measure what happens on GPIO16 after the sleep time is over?
Good idea. FWIW, the logs will also report if GPIO16 has canceled/disabled the sleep operation. It is reported as:

Code: Select all

SLEEP: Deep sleep cancelled (GPIO16 connected to GND)
- Thomas

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Different power consumption in sleep-modes !?

#12 Post by TD-er » 03 Feb 2020, 19:52

I have noticed 2 differences in deep sleep behavior between normal deep sleep and when called from a command:

- Deep sleep from a command directly calls

Code: Select all

void deepSleepStart(int dsdelay)
- Deep sleep via the regular interval does only call deep sleep at the end of

Code: Select all

loop()
and it also does a check whether deep sleep is enabled.

The check for enabled deep sleep does:
- return false when deep sleep awake time is set to 0
- return false if GPIO-16 is low (by enabling pull up resistor on GPIO-16)
- else return true.

So maybe we should just keep track of a flag in memory which can be set from the rules command.
In this check for enabled deep sleep, we then need to have a look at this flag, which only will be set via this command.
Then the execution of going to sleep is exactly the same as when doing the regular sleep.

Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: Different power consumption in sleep-modes !?

#13 Post by Micha_he » 24 Mar 2020, 13:48

TD-er wrote: 03 Feb 2020, 18:07 Can you measure what happens on GPIO16 after the sleep time is over?
When sleep-time (from command deepsleep,xxx) is over, the voltage level goes from ~Vcc to GND and stay there. That seems ok, because it should normally reset via RST (not wired in my circuit). But in this state, the ESP needs to much energy :(

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Different power consumption in sleep-modes !?

#14 Post by TD-er » 24 Mar 2020, 14:18

So during sleep it does consume the expected low current (roughly 60 uA) and after this the energy consumption rises even when the node does not boot?

This means we need to make the deep sleep command act the same as the regular deep sleep.

Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: Different power consumption in sleep-modes !?

#15 Post by Micha_he » 24 Mar 2020, 14:33

TD-er wrote: 24 Mar 2020, 14:18 So during sleep it does consume the expected low current (roughly 60 uA) and after this the energy consumption rises even when the node does not boot?
Yes, that is right.

Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: Different power consumption in sleep-modes !?

#16 Post by Micha_he » 19 Mar 2021, 15:21

I'll bring the thread up again.

The problem, that the deepsleep of my ESP-01 uses ~12mA instead of correctly ~20µA, is now (tested firmware ESP_Easy_mega_20210223 and the current sourcecode from GIT) always present, DeepSleep via Config-page and via 'DeepSleep,0'-command.

A test with a firmware 'ESP_Easy_mega_20191104_normal_ESP8266_1M_VCC.bin' (on the same ESP-01, with the identical wiring), shows that it works fine there (a 'DeepSleep,0'-command was still missing in this version).

I'm just looking for the reason and which is the last working version.... More later.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Different power consumption in sleep-modes !?

#17 Post by TD-er » 19 Mar 2021, 15:45

The current code used to enter deep sleep is based on this (lengthy) discussion: https://github.com/esp8266/Arduino/issu ... -711389479

Maybe this fix does only work on ESP12E/F/S boards and not on your ESP-01?
See: https://github.com/letscontrolit/ESPEas ... #L126-L172
Maybe you can test with inverting the check for

Code: Select all

    # if defined(CORE_POST_2_5_0)
into:

Code: Select all

    # if !defined(CORE_POST_2_5_0)

This way you are using the "old" way again. (also limiting the max. deepsleep to 71 minutes)

Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: Different power consumption in sleep-modes !?

#18 Post by Micha_he » 19 Mar 2021, 15:51

Info: In the firmware 'ESP_Easy_mega_20200608_normal_ESP8266_1M_VCC' works both, 'Sleep awake time' on config page and 'DeepSleep,0'-command.

I'll test your hint with the inverted check later today and report the results here.

Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: Different power consumption in sleep-modes !?

#19 Post by Micha_he » 19 Mar 2021, 19:59

With the inverted check

Code: Select all

# if !defined(CORE_POST_2_5_0)
the firmware works as expected. Both ('Sleep awake time' on config page and 'DeepSleep,0'-command) results in a power consumption of ~20µA ;-)

Can we modify the firmware, so that DeepSleep works properly on all ESP's ?
I'll test and measure some other ESP-models (Wroom-02, ESP12F) tomorrow.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Different power consumption in sleep-modes !?

#20 Post by TD-er » 19 Mar 2021, 21:31

If you can test units with an ESP12E/F/S then please let me know the standby currents.
I can make a define to use it and set it in the platformio.ini file for those platforms that need it.

Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: Different power consumption in sleep-modes !?

#21 Post by Micha_he » 20 Mar 2021, 15:25

All tested units show the same behavior!

With the current GIT-source and the firmware release 20210223 I've measure the following DeepSleep-current:

ESP12F: 9,6mA
Wroom02: 10,8mA

With the modified (negated if-clause) DeepSleep.cpp, the DeepSleep-current sink to the following values:

ESP12F: 18µA
Wroom02: 15µA

All tests are with: 'Sleep awake time'=60, 'Sleep time'=0 and Vcc=3,3V.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Different power consumption in sleep-modes !?

#22 Post by TD-er » 20 Mar 2021, 18:23

OK, that does sound like I need to revert it.
Do you happen to have any units with "DOIOT" on the metallic cap?
Or maybe a Wemos D1 mini clone with the ESP soldered on the PCB without any metallic cap?

Micha_he
Normal user
Posts: 369
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: Different power consumption in sleep-modes !?

#23 Post by Micha_he » 20 Mar 2021, 20:46

No, I don't have any of these ESP's.

Edit: I've created a issue on GitHub: https://github.com/letscontrolit/ESPEasy/issues/3556

ezparce
Normal user
Posts: 12
Joined: 13 Jul 2020, 09:18

Re: Different power consumption in sleep-modes !?

#24 Post by ezparce » 13 Jun 2021, 10:22

Hi, I don't know if it is the right place to ask the following question: When using DeepSleep (ESPEasy_ESP82xx_mega-20210503.zip) with Sleep awake time=20 and Sleep time= 7200, the real sleep time is less than one hour.
I tried to change sleep time to 9000 or 12000. No change. The max sleep time stays shorter than expected.
Any idea?

This behaviour is also true when I call DeepSleep from a rule (command).
When in deep sleep, power is 18 µA (normal).

Many thanks

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Different power consumption in sleep-modes !?

#25 Post by TD-er » 13 Jun 2021, 10:35

I did revert the code that was added a few months ago to put the ESP in deep sleep.
It is not yet included in a nightly build yet, but I did create a build for another PR yesterday which does have this code present:
https://www.dropbox.com/s/c6rdpo58spjna ... M.bin?dl=0

Maybe you can test to see if this also affects the deep sleep duration?
Make sure the "Deep Sleep Alternative" checkbox on the tools->Advanced page is unchecked.
See: https://espeasy.readthedocs.io/en/lates ... lternative

Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests