ESP8266 - deep sleep not waking up

Hi !
I am writting my question because I have been through all the forum available and none helped me.
I have a Wemos mini d1 (probably a copy) connected to a dallas temperature sensor (GPIO 14) and a ssd1306 oled screen (GPIO4, 5).
Very simple configuration, working well.
My plan is to use it outside as a pool temp sensor and power it up with a 18650 battery and solar panel.
Well, I am willing to save energy as much as possible.
That’s why I wanted to use the deep sleep option.
Below is the code I use in ESPHome

esphome:
  name: temperature-piscine
  platform: esp8266
  board: d1_mini


# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "XXX"

ota:
  password: "XXX"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Sonde-Piscine Fallback Hotspot"
    password: "XXX"

captive_portal:
    
# Temp sensor
dallas:
  - pin: GPIO14
    update_interval: 60s
# Individual sensors
sensor:
  - platform: dallas
    address: 0x2a3297271e64ff28
    name: "Sonde temperature piscine"
    id: "pool_temp"
    
  - platform: wifi_signal
    name: "WiFi Signal Sensor piscine"
    update_interval: 60s

# Screen
i2c:
  sda: GPIO4
  scl: GPIO5

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    reset_pin: D0
    address: 0x3C
    lambda: |-
      it.printf(40, 0, id(my_font), "Piscine");
      it.printf(-27, 20, id(my_font2), "%7.1f °C", id(pool_temp).state);
    update_interval: 30s  
    
font:
  - file: "fonts/arial.ttf"
    id: my_font
    size: 15
  - file: "fonts/arial.ttf"
    id: my_font2
    size: 37

deep_sleep:
  run_duration: 180s
  sleep_duration: 30s
  id: deep_sleep_control

I uploaded the code, then wired the RST and GPIO16 together.
When powering it back, the blue LED is blinking about 9 times. The OLED screen is off.
ESPHome sees the device (ONLINE) but I can’t check any log as it can’t connect to wifi ( [Errno 111] Connect call failed). My computer also detects the device, but impossible to check any log, the window is blank.

Removing the wire between RST and GPIO16 makes the device working again till it reaches the deep sleep where it never comes back (the wire is removed…). During the endless sleep, the screen is still on but the value displayed (the temperature) is not changing.
The log is:

[15:21:05][C][deep_sleep:049]: Setting up Deep Sleep...
[15:21:05][C][deep_sleep:052]:   Sleep Duration: 30000 ms
[15:21:05][C][deep_sleep:055]:   Run Duration: 180000 ms
[15:21:36][D][sensor:126]: 'WiFi Signal Sensor piscine': Sending state -71.00000 dBm with 0 decimals of accuracy
[15:21:37][D][dallas.sensor:143]: 'Sonde temperature piscine': Got Temperature=26.7°C
[15:23:47][I][deep_sleep:116]: Beginning Deep Sleep
[15:23:47][I][deep_sleep:118]: Sleeping for 30000000us
INFO Disconnected from ESPHome API for temperature-piscine.local
WARNING Disconnected from API
WARNING Can't connect to ESPHome API for temperature-piscine.local: Timeout while connecting to ('192.168.1.142', 6053)
INFO Trying to reconnect to temperature-piscine.local in the background

I’m quite confused as it was suposed to be very simple.

I’ve seen sometimes people using a schottky diode or resistors between RST and GPIO16. Just tried a 500 ohms resistor but not working.
Do you have any idea ? Would it be a board problem ?

The voltage between RST and GPIO16 is null during the awake time and 3.3V after the deep sleep, probably trying to wake something up.

I would use some help :slight_smile:
Thanks

2 Likes

Never mind, I have figured it out by myself…
I keep the topic here for noobs like me :smiley: :smiley:

I had to remove the reset pin D0 as it is the GPIO16. reset_pin: D0 from the config file in the I2C part.
Went well :slight_smile:

will try now to figure out how to switch off the screen during deep sleep
edit: How to turn off OLED peripheral in deep sleep?
found it :slight_smile:

1 Like