1

I have a project where I put an ESP32 to deep sleep for a certain amount of time, eg: 1h

To be able to self-awaken a cable must be connected from GPIO 16 to the reset pin, so basically the ESP pulls down pin 16 and causes itself to reset.

I also need the possibility to manually waken up the ESP, so in parallel to this cable I connect a button to GND, so I can manually reset the ESP and waken it up.

However I need to be able to tell if the ESP has awaken itself because one hour has passed or if it has been manually awaken.

I cannot connect the ESP to a internet time provider to check the time, so my first though wasto connect the button also to an input and read it when the ESP starts.

However the ESP won't start until the button forcing RST low is released and then it's too late to read it and see if it was pressed.

Is there a way that I can tell if the ESP was manually reset or if it woke up by itself?

3

I think you're getting confused between the ESP32 and the ESP8266. There is no need to connect GPIO16 to reset on the ESP32.

Instead the ESP32 has the "ULP" - Ultra Low-power Processor in it (essentially the RTC processor) which is what sends wakeup signals to the ESP32 cores. It is this which wakes the system up after an hour.

The ULP can also trigger a wakeup from other sources - most often used to wake up from an external signal, such as your button. But this only works if that signal is connected to one of the RTC input pins (GPIOs 34 to 39), or certain interrupt enabled pins (you can read more about what can wake the system up here).

Once a wakeup has happened you can then query the ULP to find out why it woke the ESP32 up using the esp_sleep_get_wakeup_cause() function.

3
  • the esp8266 has the RTC too, only there is some design bug and it can't wakeup internally. the io 16 connection to reset is a workaround – Juraj Sep 14 '20 at 16:48
  • Another reason to not bother with the esp8266 and go straight for the ESP32... – Majenko Sep 14 '20 at 16:49
  • Thanks. looks like that's what I needed. – Sembei Norimaki Sep 14 '20 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.