Won't wake up from Deep Sleep

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
dhust
Posts: 40
Joined: Sun Jul 11, 2021 10:59 pm

Won't wake up from Deep Sleep

Post by dhust » Sun Jul 25, 2021 7:26 pm

I'm using a D1 Mini. GPIO 16 is always at 3.3V and so is RST. When the board is supposed to wake up GPIO 16 does indeed go low to around 0V, which should trigger RST to wake up the board, but it doesn't. If I connect RST to Ground it wakes it up. I just don't get it. It seems like everything is behaving properly, except for the board actually waking up. Any thoughts?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Won't wake up from Deep Sleep

Post by davef » Sun Jul 25, 2021 7:45 pm

Can you post your code?

This might help: https://www.electronicshub.org/esp8266- ... er_Wake-up I am just reading through it.

Maybe

Code: Select all

I used the automatic or timer wake-up system. So, the GPIO16 and RST pins are connected together (only after uploading the code).
I wonder what the max time that you can go into deep_sleep() is.

dhust
Posts: 40
Joined: Sun Jul 11, 2021 10:59 pm

Re: Won't wake up from Deep Sleep

Post by dhust » Sun Jul 25, 2021 7:57 pm

I read through it. Seems to match what I'm doing. The weird thing is that I've had this work many times before the board went bad. So I switched to another D1 Mini and now it's not working.

Here is my code:

Code: Select all

import network
from esp import espnow
from machine import Pin, ADC
import time


print("ESP SETUP")
######### ESP-Now SETUP ##########
# A WLAN interface must be active to send()/recv()
w0 = network.WLAN(network.STA_IF)  # Or network.AP_IF
w0.active(True)
e = espnow.ESPNow()
e.init()
# peer = b'\x84\xCC\xA8\xB0\xC5\x93'
peer = b'\x24\xA1\x60\x2E\x0F\x99'   # MAC address of the other device
e.add_peer(peer)

print("PINS SETUP")
########## BATTERY ##########
moisture_sensor = ADC(0)
moisture_power = Pin(4, Pin.OUT) # D2
moisture_power.on()


########## MOISTURE SENSOR ##########
time.sleep(2)
print(moisture_sensor.read())

if moisture_sensor.read() < 450:
    e.send(peer, b'wet')
    print("Wet")
if moisture_sensor.read() >= 450:
    e.send(peer, b'dry')
    print("DRY")

moisture_power.off()
print("DEEP SLEEPY")
########## DEEP SLEEP ##########
# configure RTC.ALARM0 to be able to wake the device
rtc = machine.RTC()
rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)

# set RTC.ALARM0 to fire after 10 seconds (waking the device)
rtc.alarm(rtc.ALARM0, 5000)

# put the device to sleep
machine.deepsleep()
I used the automatic or timer wake-up system. So, the GPIO16 and RST pins are connected together (only after uploading the code).
I have to disconnect those pins to get the code to be able to upload.
I wonder what the max time that you can go into deep_sleep() is.
I believe it's about 71 minutes.

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Won't wake up from Deep Sleep

Post by davef » Sun Jul 25, 2021 8:04 pm

Has the D1 Mini got the UART to USB chip on the board? What is your deep_sleep current?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Won't wake up from Deep Sleep

Post by davef » Sun Jul 25, 2021 8:16 pm

before the board went bad.
The move from 5V tolerant on GPIO to devices that no longer have 5V tolerant GPIO can be a gotcha. On one of my projects I put 3v3 TVS diodes on every GPIO as I was paranoid about blowing an expensive micro up.

dhust
Posts: 40
Joined: Sun Jul 11, 2021 10:59 pm

Re: Won't wake up from Deep Sleep

Post by dhust » Sun Jul 25, 2021 8:25 pm

davef wrote:
Sun Jul 25, 2021 8:16 pm
before the board went bad.
The move from 5V tolerant on GPIO to devices that no longer have 5V tolerant GPIO can be a gotcha. On one of my projects I put 3v3 TVS diodes on every GPIO as I was paranoid about blowing an expensive micro up.
I believe I accidently touched the 5V pin to Ground and that's what made it go bye bye.

dhust
Posts: 40
Joined: Sun Jul 11, 2021 10:59 pm

Re: Won't wake up from Deep Sleep

Post by dhust » Sun Jul 25, 2021 9:54 pm

Has the D1 Mini got the UART to USB chip on the board? What is your deep_sleep current?
I'm not sure how to find that out. I guess since I'm using a CH340 the it must have it? It looks like I'm getting 10µA in deep sleep. Here's something interesting though, when looking at the current it shows that it's no longer in deep sleep because it goes up to 13mA. But when I was using the CH340 USB to TX and RX it was showing that it never reset. Basically the print statements weren't showing up again as though the program was running again. So how can it be getting out of deep sleep while also not resetting the board? I'm connecting the D0 and RST like I've done before but it doesn't wake it up. Thoughts?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Won't wake up from Deep Sleep

Post by davef » Sun Jul 25, 2021 10:15 pm

Yup, the CH340 is the chip.

I wonder if supplying 5V through USB to that board causes an automatic reset. I have seen some schematics with a transistor pair that do some toggling on the reset/enable/boot lines. Post a link to the schematic.

dhust
Posts: 40
Joined: Sun Jul 11, 2021 10:59 pm

Re: Won't wake up from Deep Sleep

Post by dhust » Sun Jul 25, 2021 10:41 pm

davef wrote:
Sun Jul 25, 2021 10:15 pm
Yup, the CH340 is the chip.

I wonder if supplying 5V through USB to that board causes an automatic reset. I have seen some schematics with a transistor pair that do some toggling on the reset/enable/boot lines. Post a link to the schematic.
Not sure what you mean but I'm powering the board and uploading to the board using a 5V USB. I stopped using the USB to TTL link because I wanted to reduce the number of variable.

Another interesting thing is that the board does reset, but only once, because the LED on the board flashes after the amount of time I set for deep sleep. I've changed it from 3 seconds to 15 seconds and the LED flashes at the correct time. So why would the board reset but the program not run again? It makes me think that either the D0 pin is not going LOW, but it is, or that the RST pin is not able to go low to reset, but it can because I can reset it through grounding it. Is 0.4mV not low enough from D0 to reset the RST pin?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Won't wake up from Deep Sleep

Post by davef » Sun Jul 25, 2021 10:59 pm

I would expect a low to somewhere around <1V. I think my NodeMCU have arrived, so next week I'll get some relevant experience on ESP8266 and deep sleep.

Good luck.

Just checked datasheet, it looks like Vil is from -0.3V to 0.25 * Vio, ie 0.8V.

Post Reply