SOLVED: ESPHome - Nodemcu: Wont go Online when connected to DHT22

Hey

I got a very strange problem.

I have a NodeMCU that I have installed this code on:

esphome:
  name: garage-sensors
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: !secret ssid_garage
  password: !secret wifi_password

logger:
ota:
api:

binary_sensor:
  - platform: gpio
    pin:
      number: D1
      mode: INPUT_PULLUP
    name: "Garage Door"
    device_class: door
  - platform: gpio
    pin:
      number: D2
      mode: INPUT_PULLUP
    name: "Garage Port"
    device_class: garage_door
    
sensor:
  - platform: dht
    pin: D8  #Change this to any D-pin without pulled high
    model: DHT22
    temperature:
      name: "Garage Temperatur"
    humidity:
      name: "Garage Fuktighet"
    update_interval: 60s

I have connected two door-sensors and they work. Connected a DHT22 and it worked. Temperture and humidity came into HA, also my doorsensors working.

Then I removed the powersupply and plugged it in again (same powersupply, different location) and it wont come online again. My power supply is an apple mobilcharger 5v 1A. No problem with WiFi.

I didnt change any code after removing powersupply.

I have my NodeMCU on a board and can remove it so I removed it from the board (where all my wiring, resistor and more is located) and plugged it back to the powersupply. It came online.

With powercabel still attached to NodeMCU I put it on the board again and DHT and doorsensors are working. Removed powersupply and after a while put it back in again. It wont come online.

WHY???

I have soldered like this pic with a 4.7K resistor (my pin for data is D8)

Most DHT22 require a minimum of 3.5V to operate and work best on 5v. Their output signal is 3.3V safe so when running from 5V you don’t need a level shifter.

Could be that…

Try connecting the power to VIN

So I would place the power and ground to the DHT22 on the 5V side?

You are pulling D8 aka GPIO15 high. ESP8266 will not boot with GPIO15 pulled high.
Quick reference: ESP8266 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials

1 Like

Yes but the external pull-up resistor still needs to go to the 3.3V rail, not the 5V.

And @ClassicGOD is correct about your pin choice. Use GPIO05 (D1) like in your diagram.

I’ve run DHT22s on 3.3 V before but was plagued with occasional weird low readings.

Thanks @ClassicGOD and @zoogara

My D1 and D2 is occupied by my doorsensors but reading the link I guess that D5,D6 and D7 would work!?

Basically any other ‘D’ pin should work. You just selected the only pin that prevents boot when pulled high for application requiring a pull up :smiley:

WORKED!

D-pin with pulled high is no good! =)

Thanks guys.

Btw, readings of DHT22 is perfect.

3.3V is the bottom value for DTH22 operating voltage (but still in spec). It will work with short connections but if you have it connected by a longer cable or happen to get an out of spec unit you can have erratic readings like @zoogara mentioned. But if your reading look OK you should be fine.