-->
Page 1 of 1

Deep Sleep and Wake Up Using a Button

PostPosted: Tue Jul 26, 2016 4:12 am
by Spreewell
Hello,

I am trying to create an Amazon Dash Button Clone using ESP-12E . I have no problems in general but the deep sleep. I connected the button to GPIO16 and implemented this sleep function:
Code: Select allvoid deepSleep()
{
  yield();
  ESP.deepSleep(0);
  Serial.println("");
  Serial.println("Device sent to sleep");
  yield();
}


I am calling this function in a if statement in void loop like if button is not pushed, call the deepSleep(), else call the ESP.reset() function. The part that I confused is, on the interet some of the sources says that none of the pins(includes GPIO16) is not working during the deep sleep and we need a hard reset for wake it up. If that's true my code is unfunctional. However, some of other sources says, only GPIO16 is active during the deep sleep and it's HIGH. So I can go with my code in that situation.

Apparently, the first situation true because my device is not waking up. In that case, what should I do to wake my device up, or basically how can I do a hard reset using an external button?


I really new on ESP so my question or my logic can be little bit dummy. Sorry about that.

Thanks for helping.

Re: Deep Sleep and Wake Up Using a Button

PostPosted: Tue Jul 26, 2016 4:27 pm
by schufti
in short: do a reset

in length:
a) connect a pullup (10k) from rst to Vcc
b) connect your button from rst to gnd
c) to reset: push the button

so, to wake your device: press the button,
do whatever needs to be done,
send your device to deep sleep.

Re: Deep Sleep and Wake Up Using a Button

PostPosted: Wed Jul 27, 2016 5:05 am
by eduperez