Monitor temperature and humidity with DHT11

Hello everyone, I have a question about monitoring the temperature and humidity with the help of the ESP-01-DHT11 modules. It all runs on the HA Raspberry Pi 4 Model B - 8GB of RAM. I managed to upload ESP home to ESP and connect to HA. HA discovered the module including entity humidity and temperature. The problem is that no measured values are displayed. I read about connecting a pull resistor between the data and the power supply, but this is said to be necessary only when the DHT11 is connected separately.

sensor:
  - platform: dht
    pin: GPIO2
    temperature:
      name: "Living Room Temperature"
    humidity:
      name: "Living Room Humidity"
    update_interval: 30s

Does anyone have experience with this, please? Many thanks for any advice.

1 Like

Logs?

Link to the device?

LOGS:

INFO Reading configuration /config/esphome/test_sensor.yaml...
INFO Starting log output from test_sensor.local using esphome API
INFO Connecting to test_sensor.local:6053 (10.0.0.252)
INFO Successfully connected to test_sensor.local
[22:08:31][I][app:105]: ESPHome version 1.15.3 compiled on Dec 18 2020, 19:18:41
[22:08:31][C][wifi:443]: WiFi:
[22:08:31][C][wifi:303]:   SSID: [redacted]
[22:08:31][C][wifi:304]:   IP Address: 10.0.0.252
[22:08:31][C][wifi:306]:   BSSID: [redacted]
[22:08:31][C][wifi:307]:   Hostname: 'test_sensor'
[22:08:31][C][wifi:311]:   Signal strength: -56 dB ā–‚ā–„ā–†ā–ˆ
[22:08:31][C][wifi:315]:   Channel: 1
[22:08:31][C][wifi:316]:   Subnet: 255.255.255.0
[22:08:31][C][wifi:317]:   Gateway: 10.0.0.1
[22:08:31][C][wifi:318]:   DNS1: 10.0.0.1
[22:08:31][C][wifi:319]:   DNS2: (IP unset)
[22:08:31][C][logger:185]: Logger:
[22:08:31][C][logger:186]:   Level: DEBUG
[22:08:31][C][logger:187]:   Log Baud Rate: 115200
[22:08:31][C][logger:188]:   Hardware UART: UART0
[22:08:31][C][dht:017]: DHT:
[22:08:31][C][dht:018]:   Pin: GPIO2 (Mode: INPUT)
[22:08:31][C][dht:020]:   Auto-detected model: DHT22
[22:08:31][C][dht:027]:   Update Interval: 30.0s
[22:08:31][C][dht:029]:   Temperature 'Living Room Temperature'
[22:08:31][C][dht:029]:     Unit of Measurement: '°C'
[22:08:31][C][dht:029]:     Accuracy Decimals: 1
[22:08:31][C][dht:029]:     Icon: 'mdi:thermometer'
[22:08:31][C][dht:030]:   Humidity 'Living Room Humidity'
[22:08:31][C][dht:030]:     Unit of Measurement: '%'
[22:08:31][C][dht:030]:     Accuracy Decimals: 0
[22:08:31][C][dht:030]:     Icon: 'mdi:water-percent'
[22:08:31][C][captive_portal:169]: Captive Portal:
[22:08:31][C][ota:029]: Over-The-Air Updates:
[22:08:31][C][ota:030]:   Address: test_sensor.local:8266
[22:08:31][C][ota:032]:   Using Password.
[22:08:31][C][api:095]: API Server:
[22:08:31][C][api:096]:   Address: test_sensor.local:6053
[22:08:34][W][dht:162]: Requesting data from DHT failed!
[22:08:34][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number) and consider manually specifying the DHT model using the model option.
[22:08:34][D][sensor:092]: 'Living Room Temperature': Sending state nan °C with 1 decimals of accuracy
[22:08:34][D][sensor:092]: 'Living Room Humidity': Sending state nan % with 0 decimals of accuracy
[22:09:04][W][dht:162]: Requesting data from DHT failed!
[22:09:04][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number) and consider manually specifying the DHT model using the model option.
[22:09:04][D][sensor:092]: 'Living Room Temperature': Sending state nan °C with 1 decimals of accuracy
[22:09:04][D][sensor:092]: 'Living Room Humidity': Sending state nan % with 0 decimals of accuracy

Link to device:

Two issues:

  1. the esp-01 is rubbish. Use an esp8266 at a minimum.

  2. the DHT-11 is rubbish. Use a DHT22 at a minimum.

Having said that, it should work, try specifying the sensor model in the DHT sensor config rather than relying on ESPHome’s auto DHT sensor discovery.

  • model ( Optional , int): Manually specify the DHT model, can be one of AUTO_DETECT , DHT11 , DHT22 , DHT22_TYPE2 , AM2302 , RHT03 , SI7021 and helps with some connection issues. Defaults to AUTO_DETECT . Auto detection doesn’t work for the SI7021 chip.

Have you tried this?

Don’t waste your time with these modules. They are not reliable.

The DHT sensors reads a lot of heat from the board so your measurements are always going to be at minimum a few degrees high.

Either the bias resistor is wrong for 3V, or some other issue with the board, but the DHT sensor will stop reading at some point requiring a hard reboot. Might last hours, might last days or weeks. Sometimes will fail minutes after a reboot.

DHT11 sensors are very limited. Only reads down to 0C, and up to 80% humidity.

Yes with manual specification on DHT11, it works. Thank you.

1 Like

Thanks for the advice, I’ll try more quality sensors with NodeMCU

The DHT22 has less self heating than the BME sensors.

I wanted to use the BME280 thinking that it is a very high quality sensor .

I’ve tried both. The DHT22 is more accurate without the need for complicated sleep schemes to prevent self heating. The BME is very bad for that.

so what do you recommend for a quality weather station?

TMP117 for temperature.

All the cheap relative humidity sensors are inaccurate.

I think the reply is ā€œquality componentsā€ :slight_smile:

Yes, absolutely true. Primarily the issue here is with the design of these boards. They have a 3.3V regulator on the board which raises the board temp by 5 - 10 degrees. This wicks up the pins to the DHT sensor.

I solved this by desoldering the DHT and putting about 12" of wire between it and the board. Suddenly making the whole ā€œmoduleā€ much less convenient. Which only made the problem of the DHT sensor locking up even worse. I battled with these boards far longer than reasonable as I just wanted them to work.

hi, so i don’t know what to choose a colleague saying is BME is bad and you are saying that DHT is bad. So I don’t know which is better