Deep sleep wake-up triggered by low to high logic level of GPIO

beg_dk
Posts: 34
Joined: Thu Apr 06, 2017 5:57 am

Deep sleep wake-up triggered by low to high logic level of GPIO

Postby beg_dk » Tue Jun 27, 2017 8:20 pm

Hi all

I am currently integrating the ESP32 in a solar powered lamp. Basically, the ESP32 is powered by the onboard lipo battery and it actually works fine. With a Mosfet I am controlling the ESP32 so it is only active when the solar lamp is switched on ie. it is dark enough. That way, the ESP32 is not using the battery as it would if being in the deep sleep mode and the solar charging is not influenced by any current draw.

But when ESP32 is activated and boots up it checks first to see the cause for wake-up and find that it is not wake-up triggered and immidiatedly goes into deep sleep to preserve power. I set deep sleep the usual way like this...

Code: Select all

esp_deep_sleep_enable_ext0_wakeup(PIN_TO_TRIGGER_FROM, STATE_THE_PIN_SHOULD_HAVE_FOR_IT_TO_TRIGGER_WHICH_IS_HIGH)
This is approach is ok except the PIN_TO_TRIGGER_FROM maintains it high level for a period of around 40 seconds ie. it is not pulsating as would be the prefered case. This means that when ESP32 has finished its job and send back to deep sleep it will once more be triggered by a wake-up because the PIN_TO_TRIGGER_FROM is still high. It will continue like this until the PIN_TO_TRIGGER_FROM goes low. This causes the battery to be depleted sooner in an nonoptimized way in that ESP32 while it operates uses around 110 mA. So would I do is to have the ESP32 finish off what it is set to do and then wait for a predefined period of around 40 secs (to match the time it takes PIN_TO_TRIGGER_FROM to go low) by means of vTaskDelay to keep ESP32 as idle as possible.

I would like to use the power draw much more efficient than this so my question to you is - is it possible to enable the wake up triggering from a pin by means of a logic level transition from low to high only (identical to GPIO_PIN_INTR_POSEDGE basically) so that a continued high level will not trigger a wake-up over and over again?

Thanks...

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Deep sleep wake-up triggered by low to high logic level of GPIO

Postby WiFive » Tue Jun 27, 2017 8:25 pm

You could use a hardware timer or edge detector circuit to do this or use a ULP program to wait before enabling ext0 wakeup or use 2 separate deep sleep paths one is a 40s timer deepsleep which ends in a wake stub to enable ext0 deepsleep.

beg_dk
Posts: 34
Joined: Thu Apr 06, 2017 5:57 am

Re: Deep sleep wake-up triggered by low to high logic level of GPIO

Postby beg_dk » Thu Jun 29, 2017 7:04 am

So I take it that it is not possible indicate that wakeup should only be triggered if going from low to high logic level of the pin?

Thanks...

guillermop
Posts: 12
Joined: Thu Jul 06, 2017 2:52 am

Re: Deep sleep wake-up triggered by low to high logic level of GPIO

Postby guillermop » Thu Jul 06, 2017 2:56 am

Hi, I'm here for same reason. I know that it is possible to solver this behavior by hardware, like in the esp8266 with something like a monostable flip flop but as @beg_dk I would like to know if there is a firmware/software solution for that.

I've found an answer that might help, I'll post the solution if I get it: viewtopic.php?f=2&t=1813&p=8477&hilit=wake+up#p8477

beg_dk
Posts: 34
Joined: Thu Apr 06, 2017 5:57 am

Re: Deep sleep wake-up triggered by low to high logic level of GPIO

Postby beg_dk » Thu Jul 06, 2017 6:22 am

guillermop wrote:Hi, I'm here for same reason. I know that it is possible to solver this behavior by hardware, like in the esp8266 with something like a monostable flip flop but as @beg_dk I would like to know if there is a firmware/software solution for that.

I've found an answer that might help, I'll post the solution if I get it: viewtopic.php?f=2&t=1813&p=8477&hilit=wake+up#p8477
Thanks a lot, that can prove to be useful. So you plan to let code in the Wake Up Stub control an RTC GPIO and implement an logic level for a brief moment?

guillermop
Posts: 12
Joined: Thu Jul 06, 2017 2:52 am

Re: Deep sleep wake-up triggered by low to high logic level of GPIO

Postby guillermop » Thu Jul 06, 2017 7:13 am

Yes, I'm not sure if that is the solution, maybe I'm misunderstanding something, but I'm keeping searching information

beg_dk
Posts: 34
Joined: Thu Apr 06, 2017 5:57 am

Re: Deep sleep wake-up triggered by low to high logic level of GPIO

Postby beg_dk » Tue Aug 01, 2017 6:03 pm

guillermop wrote:Yes, I'm not sure if that is the solution, maybe I'm misunderstanding something, but I'm keeping searching information
Hi there, just curious to know if you have come up with a solution of some sort? I have not had much time myself looking into this but will soon...

Who is online

Users browsing this forum: Google [Bot], lxkxst and 108 guests