-->
Page 3 of 5

Re: ESP.deepSleep(0); does not power off my ESP8266...

PostPosted: Sun Jul 12, 2020 3:51 pm
by sblantipodi
davydnorris wrote:
sblantipodi wrote:
davydnorris wrote:Remove the connection between the reset and GPIO - then when you tell it to sleep for any amount of time it will not wake up


but sometimes I need to make it sleep and sometimes I need to power it off.
any solution to the problem?


So really you want to do two different things here:
- sleep, in which case you can use the regular deep sleep routine
- shutdown, in which case you want to shut down the ESP

The NonOS documentation says that system_deep_sleep(0) should not set a wake up timer at all, and should sleep forever until you supply an external pulse on the RST pin. This is still deep sleep though - if you actually want to shut the unit down then you can toggle GPIO0. Have a look at this thread.

https://www.esp8266.com/viewtopic.php?f=11&t=4458


I don't need to power the esp off strictly. A sleep forever for me is enough but the problem is that it doesn't sleep forever.

Re: ESP.deepSleep(0); does not power off my ESP8266...

PostPosted: Mon Jul 13, 2020 12:35 am
by schufti
and did you allready try to "downgrade" to earlier versions of arduino esp core?
The versions after 4.2.4 all were pretty wonky and did not bring much improvement; definitely not for things related to wifi and stability ...

Re: ESP.deepSleep(0); does not power off my ESP8266...

PostPosted: Mon Jul 13, 2020 2:57 am
by btidey
I don't think it is anything to do with Arduino core version. ESP.deepSleep in Arduino does very little other than make a call to system_deep_sleep which is the underlying function putting the chip into deep sleep.

I just ran a test using following test sketch. It was run on an ESP-12F with GPIO16 connected to reset. Sketch was compiled using latest ESP core support for Arduino.

With the 10000000 parameter it slept / woke repeatedly for 10 seconds as monitored from the serial port. With 0 as the parameter it entered into deepSleep and has not waken up in the last 12 hours. So I conclude the ESP.deepSleep(0) is doing what it is intended to.

Code: Select all#include <ESP8266WiFi.h>
void setup() {
   Serial.begin(115200);
   Serial.println("Set up started");
   WiFi.mode(WIFI_OFF);
   delay(10);
   WiFi.forceSleepBegin();
   delay(1000);
   Serial.println("Going to sleep");
//   ESP.deepSleep(10000000);
   ESP.deepSleep(0);
}

void loop() {
   
}


I suggest OP runs this test to establish whether it is some hardware glitch or a difference in software that is causing the problem.

Re: ESP.deepSleep(0); does not power off my ESP8266...

PostPosted: Mon Jul 13, 2020 8:25 am
by schufti
for one the core does medle (various ways between versions) with the parameters for and preconditions to deepsleep() and otoh core versions do differ in version of underlying espressif sdk. Both - core and sdk - have their good and bad incarnations....