Unexpected deep sleep behaviour (Wemos D1 mini pro)
Posted: Sun Jun 04, 2017 10:26 am
Two things:
First, the example configuration for deep sleep in the docs does not work for me. Example given:
import machine
rtc = machine.RTC()
rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)
rtc.alarm(rtc.ALARM0, 10000)
I configure like that then call deepsleep like this:
timer = machine.Timer(-1)
timer.init(period=15000, mode=machine.Timer.ONE_SHOT, callback=lambda t:machine.deepsleep())
It goes to sleep on time but never wakes up. Now here's the strange thing. If I simply do this:
import machine
import esp
timer = machine.Timer(-1)
timer.init(period=15000, mode=machine.Timer.ONE_SHOT, callback=lambda t:esp.deepsleep(10000000))
It works exactly as expected, waiting 15 secs, sleeping, then waking up after 10 secs! What is going on?
Second thing:
I have a sensor connected to the 5v output on the Wemos D1 mini pro. When deep sleep is activated, this continues to draw power. I would have expected all pins to shut down. Is this a peculiarity of the 5v output or the D1 mini, or is there a way to avoid it in code?
Thanks!
First, the example configuration for deep sleep in the docs does not work for me. Example given:
import machine
rtc = machine.RTC()
rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)
rtc.alarm(rtc.ALARM0, 10000)
I configure like that then call deepsleep like this:
timer = machine.Timer(-1)
timer.init(period=15000, mode=machine.Timer.ONE_SHOT, callback=lambda t:machine.deepsleep())
It goes to sleep on time but never wakes up. Now here's the strange thing. If I simply do this:
import machine
import esp
timer = machine.Timer(-1)
timer.init(period=15000, mode=machine.Timer.ONE_SHOT, callback=lambda t:esp.deepsleep(10000000))
It works exactly as expected, waiting 15 secs, sleeping, then waking up after 10 secs! What is going on?
Second thing:
I have a sensor connected to the 5v output on the Wemos D1 mini pro. When deep sleep is activated, this continues to draw power. I would have expected all pins to shut down. Is this a peculiarity of the 5v output or the D1 mini, or is there a way to avoid it in code?
Thanks!