Comments on: MicroPython: ESP32 Deep Sleep and Wake Up Sources https://randomnerdtutorials.com/micropython-esp32-deep-sleep-wake-up-sources/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Mon, 28 Jul 2025 13:27:12 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Tim https://randomnerdtutorials.com/micropython-esp32-deep-sleep-wake-up-sources/#comment-1075627 Mon, 28 Jul 2025 13:27:12 +0000 https://randomnerdtutorials.com/?p=85320#comment-1075627 I need to replace a momentary on/off switch with a latching switch. Im using a xiao esp32c3 and an adafruit mosfet driver to send momentary pulses to mimic the momentary switch. That all works fine but I want to enable deep sleep when the switch is changed. That is – detect switch change (high), wake up, send one pulse, wait, go to sleep, detect switch change (low), wake up, send two pulses, go to sleep. I can get it to go to sleep, but not wake. I suspect its because my switch reads as high when physically closed and have it wired between the gpio and gnd. You have your switch wired between 3v3 – gpio and gpio – resistor – ground. So my wiring is keeping the pin floating so cant read the state to wake up?

]]>
By: Bruno https://randomnerdtutorials.com/micropython-esp32-deep-sleep-wake-up-sources/#comment-866014 Mon, 16 Oct 2023 16:18:40 +0000 https://randomnerdtutorials.com/?p=85320#comment-866014 Hi,
thx for your tutorial but
which could be reason why
deepsleep(300000) makes my esp32 sleep for 15 minutes instead of 5 ? and this happens consistently
Thanks
Bruno

]]>
By: troy https://randomnerdtutorials.com/micropython-esp32-deep-sleep-wake-up-sources/#comment-645489 Tue, 13 Jul 2021 17:14:05 +0000 https://randomnerdtutorials.com/?p=85320#comment-645489 In reply to Robert Phillips-Legge.

Set the led pin value to 0 to turn it off, then hold the state.

Example:

run this at the beginning of your code

esp32 built in led pin==2

led = machine.Pin(2, machine.Pin.OUT, None)

run this at the end of your code before running deep sleep

led.value(0) # turn light off
led = machine.Pin(2, machine.Pin.OUT, machine.Pin.PULL_HOLD)

]]>
By: Robert Phillips-Legge https://randomnerdtutorials.com/micropython-esp32-deep-sleep-wake-up-sources/#comment-601610 Wed, 05 May 2021 15:53:48 +0000 https://randomnerdtutorials.com/?p=85320#comment-601610 No real difference in DeepSleep between the ESP32 and 8266 except that the reset pin (RST) needs to be physically connected to GPIO16 (D2 on the board).

What irritates me is that on the ESP32 the PowerLED doesn’t turn off in DeepSleep which renders it pretty much useless for long term battery operation. If anyone knows how to turn it off I’d love to know.

]]>
By: Kordi https://randomnerdtutorials.com/micropython-esp32-deep-sleep-wake-up-sources/#comment-535819 Fri, 01 Jan 2021 20:57:31 +0000 https://randomnerdtutorials.com/?p=85320#comment-535819 Hello,

Thanks for a great tutorial. I followed it and noticed my ESP8266 NodeMCU v3 is waking for a random number ot times and after that stops sending messages (mqtt). In a debug.log which I created I see the last entry just before machine.deepsleep(10000) command.

And strange thing is that in theory it should be put into sleep but I can connect it using rshell so it is waken up but not rinning the code (sending mqtt).

Have no idea what is wrong :/

]]>