esp8266 won't wake from sleep

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
wipity
Posts: 10
Joined: Sat Sep 09, 2017 4:35 pm

esp8266 won't wake from sleep

Post by wipity » Sat Sep 29, 2018 1:03 pm

Hi,
I have an esp8266 running micropython v1.9.3 , I'm trying to work with the deep sleep and it work, but also if I have a connection between reset and GPIO16, using the script like the example in the documentation, the chip go in sleep mode but I can wake it only with a reset to gnd.
Seems alarm0 don't work properly.
what is wrong?
thanks

ad525
Posts: 9
Joined: Tue Oct 03, 2017 12:09 pm

Re: esp8266 won't wake from sleep

Post by ad525 » Sat Sep 29, 2018 2:59 pm

Hello, please post the code to see what can go wrong :D

wipity
Posts: 10
Joined: Sat Sep 09, 2017 4:35 pm

Re: esp8266 won't wake from sleep

Post by wipity » Sat Sep 29, 2018 5:25 pm

Hi,
this one from the documentation:

Code: Select all

import machine

# configure RTC.ALARM0 to be able to wake the device
rtc = machine.RTC()
rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)

# check if the device woke from a deep sleep
if machine.reset_cause() == machine.DEEPSLEEP_RESET:
    print('woke from a deep sleep')

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

# put the device to sleep
machine.deepsleep()

wipity
Posts: 10
Joined: Sat Sep 09, 2017 4:35 pm

Re: esp8266 won't wake from sleep

Post by wipity » Sat Sep 29, 2018 5:28 pm

I disconnect gpio16 when I flash and reconnect after flashing.
when I use this script the device go to sleep but wake up only with manual reset

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: esp8266 won't wake from sleep

Post by pythoncoder » Tue Oct 02, 2018 11:06 am

How are you checking for the awake message? If you're connected via USB it's very likely that the USB interface remains down after the board wakes. I would expect the code sample only to work on a serial connected device (e.g Adafruit Huzzah rather than the Feather series).
Peter Hinch
Index to my micropython libraries.

wipity
Posts: 10
Joined: Sat Sep 09, 2017 4:35 pm

Re: esp8266 won't wake from sleep

Post by wipity » Wed Oct 03, 2018 6:48 am

Ho,
I have a led to a gpio that turn on for ten seconds in the main.py file after boot file, after this time start a script with the sleep function, so if the awake do a reset, I believe I can see the led on after wake, but it turn on only if I do a manual reset.
I’m using an esp8266 with a usb to serial, not a board, but it’s the same .
There’s maybe some issue in firmware version?
After the flash i connect gpio 16 to rst pin ( i have 10 sec to do it!) , the device go in sleep ( i can see with serial garbage after the print message in the script, but the led stay off.
Thanks

wipity
Posts: 10
Joined: Sat Sep 09, 2017 4:35 pm

Re: esp8266 won't wake from sleep[SOLVED]

Post by wipity » Fri Oct 12, 2018 5:15 pm

Hi,
I’ve found the problem: power source.
I’m using esp8266 only with resistor and cap and with an external usbtoserial converter, no nodemcu or huzzah board.
When I power device with a strong power source and not from vcc of usb, wake normally, and it’s no problem, I can see the serial message anywhere.
Thanks

ambob
Posts: 8
Joined: Mon Oct 08, 2018 11:23 pm

Re: esp8266 won't wake from sleep

Post by ambob » Wed Oct 31, 2018 1:05 am

hi
I have this problem too
change power source did not solve it

use usb power or battery power it will not wake up too

ambob
Posts: 8
Joined: Mon Oct 08, 2018 11:23 pm

Re: esp8266 won't wake from sleep

Post by ambob » Fri Nov 02, 2018 12:09 am

抱歉 我的英文是如此的匮乏,表达不来下面的意思
之前,我在程序启动时候初始化rtc 然后设置关于deepsleep的参数
rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)
rtc.alarm(rtc.ALARM0, deep_sleep_time)
这种情况下,在进入deepsleep之后不会醒来

但是当我把上面两行放到了程序结尾,在他后面就是
machine.deepsleep()

他顺利的工作了

Post Reply