I have a button with two isolated tracks. I want to be able to wake up esp from deepSleep with this button, and also detect that it was clicked. So i can't connect it to reset, because esp won't work if i don't release a button. And if it's not at deepSleep, it will reset, and i don't want it. How to do this?

  • Can you post code that you have so far? Also, what do you mean by "two isolated tracks"?
    – MichaelT
    Oct 14 '18 at 18:07
  • Connect the button, with a pull-up to a GPIO. Also connect the button via a small capacitor to the reset pin. The arduino boards use the same trick to reset the ATMega328 via the USB to serial chips DTR-pin.
    – Gerben
    Oct 14 '18 at 18:18
  • I don't have any code that would relate to this functionality yet. By "two isolated tracks" i mean that this button has 4 pins, and 2 paths are isolated, so you can connect two separate things to same button. One path will wake up ESP, and second will be connected to one of GPIOs. Will thing with capacitor also reset it when it's running? I want it only to reset once at sleep, and don't do it while working. Oct 14 '18 at 18:33
  • Could you please draw me it in paint or something? Oct 15 '18 at 21:00
  • Possible duplicate of Deep Sleep Reset with Shock Sensor
    – Juraj
    Oct 25 '19 at 4:19

Use some other pin to hold RESET HIGH or to disconnect the button from RESET while the esp8266 is not running.


simulate this circuit – Schematic created using CircuitLab

I asked on EE SE for the missing part of the circuit.

  • It would be helpful to give a better quality picture, or better draw a proper schematic on your computer.
    – MichaelT
    Oct 16 '18 at 10:25
  • this is only a partial answer, because the control circuit attached to io X pin is missing. @MichaelT, you can edit and improve the answer or write a better one
    – Juraj
    Oct 16 '18 at 12:24
  • 1
    I could, so could you anyone else. My suggestion was for the OP to spend a little extra time on their answer.
    – MichaelT
    Oct 16 '18 at 13:36

You can't stop deepSleep, all you can do is reset the board so connect the button to the reset pin and make the appropiate set-up:

  1. Connect a pullup resistor (10k) in RST
  2. Connect the button from RST to GND

When you push, RST has GND so the ESP gets reseted.

Remember that deepsleep only works for about an hour so you have to contemplate this situation, too, maybe with a static variable...

EDIT Thanks Juraj for the comment: "from SDK API "system_deep_sleep(0): there is no wakeup timer; in order to wake up, connect a GPIO to pin RST; the chip will wake up by a falling-edge on pin RST."

  • from SDK API "system_deep_sleep(0): there is no wakeup timer; in order to wake up, connect a GPIO to pin RST; the chip will wake up by a falling-edge on pin RST."
    – Juraj
    Oct 16 '18 at 12:21
  • the reference assumes the esp8266 is used as 'coprocessor' for a main MCU, because it wasn't designed to be used standalone. so the mentioned GPIO pin is a pin of the main MCU
    – Juraj
    Oct 16 '18 at 13:46

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.