D1 mini and deep sleep

Hello guys,

I tried to use deep sleep on my D1 mini (runnind on battery) and the esp never wake up. I reduced interval to be sure measure is done.

I’m pretty sure I do somethign wrong, but I spend few hours and I didn’t find it.

My configuration :

esphome:
  name: d1-temperature
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: True
  manual_ip:
    static_ip: XXX
    gateway: 192.168.1.1
    subnet: 255.255.255.0
# Enable logging
logger:

api:
  reboot_timeout: 15min
  encryption:
    key: !secret api_key

deep_sleep:
  run_duration: 30s
  sleep_duration: 1min

ota:
  password: !secret ota_password

# DS18B20 Temperature Sensor
dallas:
  - pin: D5
    update_interval: 5s
  
sensor:
  - platform: dallas
    address: 0x85062017e066754
    name: "Temperature"

Some logs :

[18:00:22][C][deep_sleep:049]: Setting up Deep Sleep...
[18:00:22][C][deep_sleep:052]:   Sleep Duration: 60000 ms
[18:00:22][C][deep_sleep:055]:   Run Duration: 30000 ms
[18:00:23][D][dallas.sensor:143]: 'Temperature piscine': Got Temperature=24.2°C
[18:00:23][D][sensor:109]: 'Temperature piscine': Sending state 24.25000 °C with 1 decimals of accuracy
[18:00:28][D][dallas.sensor:143]: 'Temperature piscine': Got Temperature=24.2°C
[18:00:28][D][sensor:109]: 'Temperature piscine': Sending state 24.18750 °C with 1 decimals of accuracy
[18:00:33][D][dallas.sensor:143]: 'Temperature piscine': Got Temperature=24.2°C
[18:00:33][D][sensor:109]: 'Temperature piscine': Sending state 24.18750 °C with 1 decimals of accuracy
[18:00:38][D][dallas.sensor:143]: 'Temperature piscine': Got Temperature=24.1°C
[18:00:38][D][sensor:109]: 'Temperature piscine': Sending state 24.12500 °C with 1 decimals of accuracy
[18:00:43][D][dallas.sensor:143]: 'Temperature piscine': Got Temperature=24.1°C
[18:00:43][D][sensor:109]: 'Temperature piscine': Sending state 24.12500 °C with 1 decimals of accuracy
[18:00:48][D][dallas.sensor:143]: 'Temperature piscine': Got Temperature=24.1°C
[18:00:48][D][sensor:109]: 'Temperature piscine': Sending state 24.06250 °C with 1 decimals of accuracy
[18:00:51][I][deep_sleep:116]: Beginning Deep Sleep
[18:00:51][I][deep_sleep:118]: Sleeping for 60000000us
[18:00:52][W][wifi_esp8266:482]: Event: Disconnected ssid='Vxormrbi-dkXtQ7hhtc' bssid=[redacted] reason='Association Leave'

Did you tie together gpio16 (D0) and RST as per docs?

ESP32s have better deep sleep features and have less hassles.

1 Like

@Drahas were you able to figure this out? I was going to try something very similar and wondering myself how well this deep sleep mode worked.

I notice the following in the ESPHome documentation on the Deep Sleep Component

Blockquote On the ESP8266, you can only put the node into deep sleep for a duration using sleep_duration , note that on the ESP8266 GPIO16 must be connected to the RST pin so that it will wake up again.

Also wondering how you wired your temp sensor, if you care to share.

Sad that the OP didn’t respond if this worked for them - I wanted to know , hence the search here. I saw the note on ESPHome docs, but it also says “Some ESP8266s have an onboard USB chip (e.g. D1 mini) on the chips’ control line that is connected to the RST pin. This enables the flasher to reboot the ESP when required. This may interfere with deep sleep on some devices and prevent the ESP from waking when it’s powered through its USB connector”. I would bet this is the case with OP - he mentioned using a D1 mini and may in fact be using a USB connector. I am just researching deep sleep but will expect to find this behavior when I try it out on a mini. Of course I will try the USB connector first - to see - and power from the 3.3v terminal if it doesn’t work (which should be easy if there is a battery shield involved).

DaveW1,
I was just revisiting this subject. Were you successful in your testing?

I never got to that point - lost interest. Completely forgot about this post. So unlike me LOL. Good luck

So I played around with this today and pretty much got the same results as the OP.

I’m using a D1 mini with a DHT22 for a temp and humidity sensor.

Per the ESP Home docs on Deep Sleep ( Deep Sleep Component — ESPHome )

Next, tell the node how it should wakeup. On the ESP8266, you can only put the node into deep sleep for a duration using sleep_duration , note that on the ESP8266 GPIO16 must be connected to the RST pin so that it will wake up again.

I did have the RST and GPOI16 (on the d1 this is D0) jumpered.

Also, per this section:

Note
Some ESP8266s have an onboard USB chip (e.g. D1 mini) on the chips’ control line that is connected to the RST pin. This enables the flasher to reboot the ESP when required. This may interfere with deep sleep on some devices and prevent the ESP from waking when it’s powered through its USB connector. Powering the ESP from a separate 3.3V source connected to the 3.3V pin and GND will solve this issue. In these cases, using a USB to TTL adapter will allow you to log ESP activity.

I had my d1 powered via the 3.3V pin and not via the USB port.

This was my ESP Home config

esphome:
  name: d1-test-th
  friendly_name: d1-test-th

esp8266:
  board: d1_mini

*# Enable logging*
logger:

*# Enable Home Assistant API*
api:
  encryption:
    key: "k+yXFOM7BMS9TluJzexwHK4nJCeyP4hwpZb/H3Yo1JY="

ota:
  password: "d8349a90132874ccdac7cf3da771cf5c"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  *# Enable fallback hotspot (captive portal) in case wifi connection fails*
  ap:
    ssid: "D1-Test-Th Fallback Hotspot"
    password: "6YtaG8vU4iup"

deep_sleep:
  run_duration: 10s
  sleep_duration: 1min

captive_portal:

web_server:
  port: 80

sensor:
  - platform: dht
    pin: D2
    temperature:
      name: "Test Temperature"
      filters:
        - lambda: return x * (9.0/5.0) + 32;
      unit_of_measurement: "°F"
    humidity:
      name: "Test Humidity"
    update_interval: 5s

This is the exact same config I have for two other temp and humidity sensors running currently to control my AC based on temps in those rooms EXCEPT for the deep sleep section. They both work just fine and are powered via a 5 volt power block with USB cable.

This configuration will boot up, connect via wifi, report temp and humidity for 10 seconds and then you see in the logs that it goes to sleep.

The problem is the thing never wakes up. I let the thing sit for 5, 10, 15, 20 minutes but once the sensor boots and reports for the first 10 seconds, it goes to sleep and never wakes up.

That’s my testing results today. Hopefully someone else is looking into this and may have success with a different config.