0

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?

5
  • Can you post code that you have so far? Also, what do you mean by "two isolated tracks"?
    – MichaelT
    Commented Oct 14, 2018 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
    Commented Oct 14, 2018 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. Commented Oct 14, 2018 at 18:33
  • Could you please draw me it in paint or something? Commented Oct 15, 2018 at 21:00
  • Possible duplicate of Deep Sleep Reset with Shock Sensor
    – Juraj
    Commented Oct 25, 2019 at 4:19

2 Answers 2

1

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

schematic

simulate this circuit – Schematic created using CircuitLab

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

0
-1

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."

2
  • 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
    Commented Oct 16, 2018 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
    Commented Oct 16, 2018 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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