Unexpected deep sleep behaviour (Wemos D1 mini pro)

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
g-sam
Posts: 6
Joined: Sun Jun 04, 2017 10:12 am

Unexpected deep sleep behaviour (Wemos D1 mini pro)

Post by g-sam » 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!

User avatar
ioukos
Posts: 34
Joined: Wed Oct 19, 2016 11:31 am
Location: Alsace, Europe

Re: Unexpected deep sleep behaviour (Wemos D1 mini pro)

Post by ioukos » Sun Jun 04, 2017 6:50 pm

Did you wire pin D0 to reset ?

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: Unexpected deep sleep behaviour (Wemos D1 mini pro)

Post by devnull » Mon Jun 05, 2017 1:51 am

You need to connect RESET PIN -> GPIO 16, otherwise it will only partially wake up (approx 6ma current)

But I have discovered a problem with the Wee Mos Mini Pro, whereby the minimum supply voltage appears to be a whopping 4 volts.

This is a serious limitation if you plan (as I did) to run the device from LIPO with a voltage range of 4.2 volts -> 3 volts, which effectively means that you loose about 80% of your battery power.

I also discovered that you can reduce the deepsleep current down from about 120ua to about 30ua, however again this is now meaningless for me as being unable to support supply voltages less than 4 volts is a show-stopper for me !

g-sam
Posts: 6
Joined: Sun Jun 04, 2017 10:12 am

Re: Unexpected deep sleep behaviour (Wemos D1 mini pro)

Post by g-sam » Thu Jun 08, 2017 6:36 am

RESET PIN -> GPIO 16 / D0 ---- yes, this was already connected. I can only think it has something to do with launching deepsleep inside an interrupt handler. Is that possible?

The supply voltage requirement is not an issue in my case as my sensor requires 5v anyway, but that's good to know for future reference!

g-sam
Posts: 6
Joined: Sun Jun 04, 2017 10:12 am

Re: Unexpected deep sleep behaviour (Wemos D1 mini pro)

Post by g-sam » Mon Jun 12, 2017 6:59 am

I have resolved the second issue I mentioned by connecting my sensor to TX1 of the Wemos instead of TX0. For some reason it would appear that on entering deep sleep on the Wemos something is sent over TX0 that is enough to activate the sensor, but that this does not occur over TX1. It maybe has something to do with the webrepl, which is activated (although I removed all print statements so in theory nothing should be transmitted). Is this a bug in Micropython?

Devnull, could you tell me how you got it down to 30ua? Please don't tell me it was by prising something off the board!

Post Reply