ESP32 DHT11 Sensor Problem

Helllo everyone !
i have a problem that i could use some help with , i installed home assistant and using ESPHOME to control relays using my ESP32 , the relays code works very well , but then i decided to add a DHT11 sensor to my yaml and problems started showing :

INFO Uploading /data/bitanas/.pioenvs/bitanas/firmware.bin (890512 bytes)
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.1.200 using esphome API
INFO Connecting to 192.168.1.200:6053 (192.168.1.200)
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error connecting to 192.168.1.200: timed out). Re-Trying in 1 seconds
INFO Connecting to 192.168.1.200:6053 (192.168.1.200)
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error connecting to 192.168.1.200: [Errno 111] Connection refused). Re-Trying in 1 seconds
INFO Connecting to 192.168.1.200:6053 (192.168.1.200)
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error connecting to 192.168.1.200: [Errno 111] Connection refused). Re-Trying in 2 seconds
INFO Connecting to 192.168.1.200:6053 (192.168.1.200)
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error connecting to 192.168.1.200: [Errno 111] Connection refused). Re-Trying in 3 seconds
INFO Connecting to 192.168.1.200:6053 (192.168.1.200)

it gets stuck there , but once i remove the sensor code , everything goes back to normal and working.
i removed my relay code and left only the sensor code , the error shows up again.

i really wish i had more knowledge in order to fix this by my self but i’m stuck :frowning: can anyone help me ?

here is the code for my yaml file :


esphome:
  name: bitanas
  platform: ESP32
  board: nodemcu-32s

wifi:
  ssid: "something"
  password: "something"
  manual_ip:
    static_ip: 192.168.1.200
    gateway: 192.168.1.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Bitanas Fallback Hotspot"
    password: "something"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

sensor:
  - platform: dht
    pin: 14
    model: AUTO_DETECT
    temperature:
      name: "Temperature"
    humidity:
      name: "Humidity"
    update_interval: 20s
    
switch:
    
  - platform: gpio
    name: "Relay_1"
    pin: 27
    inverted: True
    restore_mode: RESTORE_DEFAULT_OFF
    
  - platform: gpio
    name: "Relay_2"
    pin: 25
    inverted: True
    restore_mode: RESTORE_DEFAULT_OFF
    
  - platform: gpio
    name: "Relay_3"
    pin: 26
    inverted: True
    restore_mode: RESTORE_DEFAULT_OFF

Have you tried moving your dht to a different pin? Sometimes pins have side effects. See this reference https://randomnerdtutorials.com/esp32-pinout-reference-gpios/

1 Like

Try using a different pin on the ESP.

If it’s a pin problem, you shouldn’t get the error if you disconnect the DHT and restart the board.

Hello sorry for the late reply , i have spent the last several hours trying to figure out what is wrong , until i reached the point where it uploaded the firmware but it’s stuck in a loop that i can’t get out from , here is my output :

[23:01:15][I][logger:156]: Log initialized
[23:01:15][C][ota:364]: There have been 8 suspected unsuccessful boot attempts.
[23:01:15][I][app:028]: Running through setup()...
[23:01:15][C][dht:011]: Setting up DHT...
[23:01:15][C][wifi:033]: Setting up WiFi...
[23:01:15][D][wifi:304]: Starting scan...
[23:01:15][D][dht:048]: Got Temperature=19.0°C Humidity=55.0%
[23:01:15][D][sensor:092]: 'Temperature': Sending state 19.00000 °C with 1 decimals of accuracy
[23:01:15][D][sensor:092]: 'Humidity': Sending state 55.00000 % with 0 decimals of accuracy
[23:01:15]Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
[23:01:15]Core 1 register dump:
[23:01:15]PC      : 0x4008b9a6  PS      : 0x00060634  A0      : 0x4008b994  A1      : 0x3ffb1cf0  
WARNING Decoded 0x4008b9a6: vPortYield at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/portasm.S:542
[23:01:15]A2      : 0x3ffb8058  A3      : 0x00000000  A4      : 0x3ffbdb4c  A5      : 0x3ffbdb4c  
[23:01:15]A6      : 0xfffbfff0  A7      : 0x3ffb8058  A8      : 0x8015c8fc  A9      : 0x3ffb1cd0  
[23:01:15]A10     : 0x3ffb8768  A11     : 0x000001f4  A12     : 0x80089f09  A13     : 0x3ffb1cc0  
[23:01:15]A14     : 0x00000003  A15     : 0x00060623  SAR     : 0x00000018  EXCCAUSE: 0x00000006  
[23:01:15]EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffff  
[23:01:15]
[23:01:15]Backtrace: 0x4008b9a6:0x3ffb1cf0 0x4008b991:0x3ffb1d10 0x400db6f5:0x3ffb1d30 0x400dd162:0x3ffb1d80 0x400e7833:0x3ffb1fb0 0x400890f5:0x3ffb1fd0
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x4008b9a6: vPortYield at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/portasm.S:542
WARNING Decoded 0x4008b991: vPortYield at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/portasm.S:533
WARNING Decoded 0x400db6f5: esphome::Application::setup() at /config/esphome/anas/src/esphome/core/application.cpp:54
WARNING Decoded 0x400dd162: setup() at /config/esphome/anas/src/main.cpp:151
WARNING Decoded 0x400e7833: loopTask(void*) at /root/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:14
WARNING Decoded 0x400890f5: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
[23:01:16]
[23:01:16]Core 0 register dump:
[23:01:16]PC      : 0x4015d0f2  PS      : 0x00060d34  A0      : 0x800ea866  A1      : 0x3ffbc050  
WARNING Decoded 0x4015d0f2: esp_pm_impl_waiti at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c:492
[23:01:16]A2      : 0x00000000  A3      : 0x00000001  A4      : 0x80089308  A5      : 0x3ffb5b30  
[23:01:16]A6      : 0x00000000  A7      : 0x3ffbbd40  A8      : 0x800e97da  A9      : 0x3ffbc020  
[23:01:16]A10     : 0x00000000  A11     : 0x00000001  A12     : 0x80089308  A13     : 0x3ffbbf50  
[23:01:16]A14     : 0x00000000  A15     : 0x3ffbbd40  SAR     : 0x00000000  EXCCAUSE: 0x00000006  
[23:01:16]EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
[23:01:16]
[23:01:16]Backtrace: 0x4015d0f2:0x3ffbc050 0x400ea863:0x3ffbc070 0x4008a8d9:0x3ffbc090 0x400890f5:0x3ffbc0b0
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x4015d0f2: esp_pm_impl_waiti at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c:492
WARNING Decoded 0x400ea863: esp_vApplicationIdleHook at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/freertos_hooks.c:108
WARNING Decoded 0x4008a8d9: prvIdleTask at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:3507
WARNING Decoded 0x400890f5: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
[23:01:16]
[23:01:16]Rebooting...
[23:01:16]ets Jun  8 2016 00:22:57
[23:01:16]
[23:01:16]rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[23:01:16]configsip: 0, SPIWP:0xee
[23:01:16]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[23:01:16]mode:DIO, clock div:2
[23:01:16]load:0x3fff0018,len:4
[23:01:16]load:0x3fff001c,len:1044
[23:01:16]load:0x40078000,len:8896
[23:01:16]load:0x40080400,len:5828
[23:01:16]entry 0x400806ac
[23:01:16][I][logger:156]: Log initialized
[23:01:16][C][ota:364]: There have been 9 suspected unsuccessful boot attempts.
[23:01:16][I][app:028]: Running through setup()...
[23:01:16][C][dht:011]: Setting up DHT...
[23:01:16][C][wifi:033]: Setting up WiFi...
[23:01:16][D][wifi:304]: Starting scan...
[23:01:16][W][dht:160]: Requesting data from DHT failed!
[23:01:16][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[23:01:16][D][sensor:092]: 'Temperature': Sending state nan °C with 1 decimals of accuracy
[23:01:16][D][sensor:092]: 'Humidity': Sending state nan % with 0 decimals of accuracy
[23:01:16]Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
[23:01:16]Core 1 register dump:
[23:01:16]PC      : 0x40081f68  PS      : 0x00060234  A0      : 0x80082c5e  A1      : 0x3ffb1b60  
WARNING Decoded 0x40081f68: esp_timer_impl_get_time at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/esp_timer_esp32.c:340
[23:01:16]A2      : 0x025defff  A3      : 0x00000000  A4      : 0x00000050  A5      : 0xefffffff  
[23:01:16]A6      : 0x00000000  A7      : 0x00000000  A8      : 0x00000000  A9      : 0x3ffc1750  
[23:01:16]A10     : 0x00000000  A11     : 0x00000004  A12     : 0x00000050  A13     : 0x3f404b52  
[23:01:16]A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x0000000a  EXCCAUSE: 0x00000006  
[23:01:16]EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffff  
[23:01:16]
[23:01:16]Backtrace: 0x40081f68:0x3ffb1b60 0x40082c5b:0x3ffb1b80 0x4008175b:0x3ffb1ba0 0x400d9539:0x3ffb1bc0 0x400d9b10:0x3ffb1cd0 0x4015c8f9:0x3ffb1cf0 0x4015c9c5:0x3ffb1d10 0x400db6c9:0x3ffb1d30 0x400dd162:0x3ffb1d80 0x400e7833:0x3ffb1fb0 0x400890f5:0x3ffb1fd0
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x40081f68: esp_timer_impl_get_time at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/esp_timer_esp32.c:340
WARNING Decoded 0x40082c5b: esp_timer_get_time at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/esp_timer.c:443
WARNING Decoded 0x4008175b: millis at /root/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-misc.c:170
WARNING Decoded 0x400d9539: esphome::wifi::WiFiComponent::check_scanning_finished() at /config/esphome/anas/src/esphome/components/wifi/wifi_component.cpp:579
WARNING Decoded 0x400d9b10: esphome::wifi::WiFiComponent::loop() at /config/esphome/anas/src/esphome/components/wifi/wifi_component.cpp:579
WARNING Decoded 0x4015c8f9: esphome::Component::call_loop() at /config/esphome/anas/src/esphome/core/component.cpp:111
WARNING Decoded 0x4015c9c5: esphome::Component::call() at /config/esphome/anas/src/esphome/core/component.cpp:111
WARNING Decoded 0x400db6c9: esphome::Application::setup() at /config/esphome/anas/src/esphome/core/application.cpp:49 (discriminator 2)
WARNING Decoded 0x400dd162: setup() at /config/esphome/anas/src/main.cpp:151
WARNING Decoded 0x400e7833: loopTask(void*) at /root/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:14
WARNING Decoded 0x400890f5: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
[23:01:17]
[23:01:17]Core 0 register dump:
[23:01:17]PC      : 0x4015d0f2  PS      : 0x00060f34  A0      : 0x800ea866  A1      : 0x3ffbc050  
WARNING Decoded 0x4015d0f2: esp_pm_impl_waiti at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c:492
[23:01:17]A2      : 0x00000000  A3      : 0x00000001  A4      : 0x80089308  A5      : 0x3ffb5b30  
[23:01:17]A6      : 0x00000000  A7      : 0x3ffbbd40  A8      : 0x800e97da  A9      : 0x3ffbc020  
[23:01:17]A10     : 0x00000000  A11     : 0x00000001  A12     : 0x80089308  A13     : 0x3ffbbf50  
[23:01:17]A14     : 0x00000000  A15     : 0x3ffbbd40  SAR     : 0x00000000  EXCCAUSE: 0x00000006  
[23:01:17]EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
[23:01:17]
[23:01:17]Backtrace: 0x4015d0f2:0x3ffbc050 0x400ea863:0x3ffbc070 0x4008a8d9:0x3ffbc090 0x400890f5:0x3ffbc0b0
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x4015d0f2: esp_pm_impl_waiti at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c:492
WARNING Decoded 0x400ea863: esp_vApplicationIdleHook at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/freertos_hooks.c:108
WARNING Decoded 0x4008a8d9: prvIdleTask at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:3507
WARNING Decoded 0x400890f5: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
[23:01:17]
[23:01:17]Rebooting...
[23:01:17]ets Jun  8 2016 00:22:57
[23:01:17]
[23:01:17]rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[23:01:17]configsip: 0, SPIWP:0xee
[23:01:17]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[23:01:17]mode:DIO, clock div:2
[23:01:17]load:0x3fff0018,len:4
[23:01:17]load:0x3fff001c,len:1044
[23:01:17]load:0x40078000,len:8896
[23:01:17]load:0x40080400,len:5828
[23:01:17]entry 0x400806ac
[23:01:17][I][logger:156]: Log initialized
[23:01:17][C][ota:364]: There have been 10 suspected unsuccessful boot attempts.
[23:01:17][E][ota:369]: Boot loop detected. Proceeding to safe mode.
[23:01:17][I][app:028]: Running through setup()...
[23:01:17][C][wifi:033]: Setting up WiFi...
[23:01:17][D][wifi:304]: Starting scan...
[23:01:17][D][wifi:319]: Found networks:
[23:01:17][I][wifi:365]: - 'TOPNET_AA58' [redacted]▂▄▆█
[23:01:17][D][wifi:366]:     Channel: 11
[23:01:17][D][wifi:367]:     RSSI: -73 dB
[23:01:17][D][wifi:369]: - [redacted] [redacted]▂▄▆█
[23:01:17][I][wifi:193]: WiFi Connecting to 'TOPNET_AA58'...
[23:01:19][W][wifi_esp32:336]: Event: Disconnected ssid='TOPNET_AA58' bssid=[redacted] reason='Auth Expired'
[23:01:19][W][wifi:451]: Error while connecting to network.
[23:01:19][W][wifi:488]: Restarting WiFi adapter...
[23:01:19][I][wifi:193]: WiFi Connecting to 'TOPNET_AA58'...
[23:01:20][W][wifi_esp32:336]: Event: Disconnected ssid='TOPNET_AA58' bssid=[redacted] reason='Auth Expired'
[23:01:20][W][wifi:451]: Error while connecting to network.
[23:01:20][W][wifi:488]: Restarting WiFi adapter...
[23:01:25][D][wifi:304]: Starting scan...
[23:01:27][D][wifi:319]: Found networks:
[23:01:27][I][wifi:365]: - 'TOPNET_AA58' [redacted]▂▄▆█
[23:01:27][D][wifi:366]:     Channel: 11
[23:01:27][D][wifi:367]:     RSSI: -75 dB
[23:01:27][D][wifi:369]: - [redacted] [redacted]▂▄▆█
[23:01:27][I][wifi:193]: WiFi Connecting to 'TOPNET_AA58'...
[23:01:28][W][wifi_esp32:336]: Event: Disconnected ssid='TOPNET_AA58' bssid=[redacted] reason='Auth Expired'
[23:01:28][W][wifi:451]: Error while connecting to network.
[23:01:28][W][wifi:488]: Restarting WiFi adapter...
[23:01:28][I][wifi:193]: WiFi Connecting to 'TOPNET_AA58'...
[23:01:29][W][wifi_esp32:336]: Event: Disconnected ssid='TOPNET_AA58' bssid=[redacted] reason='Auth Expired'
[23:01:29][W][wifi:451]: Error while connecting to network.
[23:01:29][W][wifi:488]: Restarting WiFi adapter...
[23:01:34][D][wifi:304]: Starting scan...
[23:01:36][D][wifi:319]: Found networks:
[23:01:36][I][wifi:365]: - 'TOPNET_AA58' [redacted]▂▄▆█
[23:01:36][D][wifi:366]:     Channel: 11
[23:01:36][D][wifi:367]:     RSSI: -76 dB
[23:01:36][D][wifi:369]: - [redacted] [redacted]▂▄▆█
[23:01:36][I][wifi:193]: WiFi Connecting to 'TOPNET_AA58'...
[23:01:37][W][wifi_esp32:336]: Event: Disconnected ssid='TOPNET_AA58' bssid=[redacted] reason='Auth Expired'
[23:01:37][W][wifi:451]: Error while connecting to network.
[23:01:37][W][wifi:488]: Restarting WiFi adapter...
[23:01:37][I][wifi:193]: WiFi Connecting to 'TOPNET_AA58'...
[23:01:39][W][wifi_esp32:336]: Event: Disconnected ssid='TOPNET_AA58' bssid=[redacted] reason='Auth Expired'
[23:01:39][W][wifi:451]: Error while connecting to network.
[23:01:39][W][wifi:488]: Restarting WiFi adapter...

i’m sorry if it’s too long but i couldn’t be more confused … i’m losing hope to fix this

Well from what I see it looks like it booted, did the first read of the temp and humidity from the dht which was successful, and then is trying to talk to a sensor which barfs. Guess I would need to see the sensor code.

Oh i already pasted that above !

sensor:

  - platform: dht
    pin: 14
    model: AUTO_DETECT
    temperature:
      name: "Temperature"
    humidity:
      name: "Humidity"
    update_interval: 2

Btw just a side note , the relay works WELL if i replace the sensor code with the switch code , only the DHT sensor is giving me a headache

I saw the dht code. What do you do with the temperature an humidity readings?

@Anas_Hmida - this is a bug introduced in 1.14.4 and has been fixed in 1.15.0dev.

It affects one wire sensors including DHT11, DHT22 and Dallas.

You could either wait for the new version to come out, or install the dev version from the repository.

Note - if you install the dev version don’t forget to stop the 1.14.4 instance in HA supervisor.

3 Likes

@zoogara THANK YOU SO MUCH , I SWITCHED TO 1.15.0DEV AND EVERYTHING WORKS :heart: :heart: :heart:

I had the exact problem with a ESP32 DEVKIT V1, DHT11, SR501. As soon as I switched to the 1.15 DEV it worked. I had been working on this for over a week. Thanks for the information.

1 Like

Good. Can you share the procedure to switch to 1.15 DEV with us? I don’t know how to do that without breaking everything.

Answer to myself : https://esphome.io/guides/faq.html#how-do-i-use-the-latest-bleeding-edge-version
(a.k.a. RTFM)

1 Like

I use the HA Supervisor and just select the Dev version form the add-on store, so I wouldn’t have been much help for other installs - sorry.

1 Like