ESp8266-01 and DHT11 board - configuration question

Thank you, Tom, I’ll give that a go. Yeah, my lack of Russian was a real limiting factor!

I’ll report back shortly.

Tom, thank you - that sorted it. No jumper required - it now works perfectly!

Thanks again!

1 Like

I have a bunch of these deployed but I wrote my own firmware which responds via SNMP and HTTP JSON.

Looking at my code, the DHT11 is on GPIO2.

Had these working in Tasmota as well.

One thing to note is that you’ll find the temperature measurements are wrong as the DHT11 will measure the heat generated by the board components, conducted up via the leads. I had to separate all my DHT11 sensors with a few inches of wire to prevent this.

Also, get the DHT22 version. The DHT11 humidity measurement tops out at 88%, and it doesn’t go below 0C. I’m waiting for my DHT22 sensors to arrive and will be replacing all my DHT11s.

Thank you - yes, I identified GPIO2 as the one in use and it is working.

I did wonder about the temperature rise - I’ll do as you suggest and lengthen the leads. My use case doesn’t really need >88% RH so I’ll probably stick with the DHT11s I have but any future ones will be DHT22s.

Thanks.

I am using the above configuration with model: DHT22 and I am getting these errors:

[09:54:15][W][sensor.dht:147]: Requesting data from DHT failed!
[09:54:15][W][sensor.dht:077]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[09:54:19][D][sensor.dht:067]: Got Temperature=29.4┬░C Humidity=97.7%
[09:54:23][W][sensor.dht:147]: Requesting data from DHT failed!
[09:54:23][W][sensor.dht:077]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[09:54:27][W][sensor.dht:147]: Requesting data from DHT failed!
[09:54:27][W][sensor.dht:077]: Invalid readings! Please check your wiring (pull-up resistor, pin number).

Is that normal?

It is sending correct readings on the esp_dht_sensor/sensor/living_room_humidity/state topics.

No that is not normal.

1 Like

thanks just been having the same issues saved a new thread

Personally I’m now giving up on DHTxx sensors. They suck. Doesn’t matter which library I use, randomly the sensor will stop giving data. Might run for months and then one day the sensor just returns a big negative number (max float?) and will do so until a power cycle.

Going to switch everything out with BME280s.

I have 8 of these sensors (DHT22) that have been running for over a year and have never seen that behaviour. I haven’t updated my ESPs for quite a while either though. Maybe it’s a fault with a newer version of esphome. Or maybe you are reading them too fast? I only update every 15 seconds with a 15x sample moving average. 3-4 minute update is plenty fast enough for house temperatures/humidities.

The BME is a better sensor though.

Hi all,

I am currently having a nightmare with my setup in so far as I can get 1 dht11 working with a relay and 4 other relays just to switch on off in the interface via mqtt.

If I add a second dht11 (all running individually on tasmota esp01s) then I draw a blank and can’t even switch the relay anymore (only via tasmaota web interface).

Any ideas would be welcome,

Thanks.

On these boards, I’m not using esphome (actually I don’t use esphome on anything) nor TASMOTA. I wrote my own firmware that provides temp data via SNMP and an HTTP REST API. The communication with the DHT sensor happens via the often used libraries. Have used ESP_DHT, the Adafruit libraries, etc. in troubleshooting this with the same result.

The interesting part is that it is definitely the senor which becomes unresponsive. The DHT library just returns a large negative number (maxint?), which by my code ends up being rounded to -0.1, which is returned to Home Assistant. The ESP8266 is up and running, just receiving improper values from the library. A reset of the ESP8266 via the reset button resets the processor, however the sensor continues to be unresponsive. Only a power cycle brings it back.

I’m reading the sensor every 10 seconds in code, and when queried the board simply returns the last read value.

I believe that the issue is the long wires to which I have attached the DHT sensors. Because the DHT11 was reading the temperature of the board, I added about 12" of wire between the board and DHT. I’ve had one of these sensors running for over a month on TASMOTA, unmodified (no wire) and it has been reliable. I’m thinking at this point the DHT sensor needs a capacitor across the power pins.

Have noticed that the DHT11 version of the board reads the temperature of the board, but the DHT22 version does not. Looks like the DHT22 sensor has better isolation between the thermistor and board. Yay.

Can you post a bit of info about your setup? Pictures of the relays/DHT connections, TASMOTA config, and your YAML config.

Yep. Wire length makes a huge difference. Originally I tried 1m of Cat5. So many errors. It wasn’t until I had the wire length under 5cm that they started behaving correctly 100% of the time. I tried all sorts of decoupling on the supply and every E24 resistor value between 2K and 10K for the data line resistor. The only thing that made a difference was the wire length.

Well then looks like I have some wires to shorten.

Hi Aaron,
Sorry for the late reply, I seem to have solved my dilemma with tasmota. In the console for each device I typed “setoption19 1” which turns on automatic discovery. Now they all work flawlessly!
Thanks for the offer of assistance anyway,
Cheers
Kev

Help is all i can say cant get this to work

esphome:
name: temp
platform: ESP8266
board: esp01_1m

wifi:
ssid: “Wireless”
password: “0000000”

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: “Temp Fallback Hotspot”
password: “xxxx”

captive_portal:

Enable logging

logger:

Enable Home Assistant API

api:

ota:

sensor:

  • platform: dht
    pin: GPIO0
    model: DHT11
    update_interval: 4s
    temperature:
    name: “Living Room Temperature”
    filters:
    - sliding_window_moving_average:
    window_size: 15
    send_every: 15
    send_first_at: 15
    humidity:
    name: “Living Room Humidity”
    filters:
    - sliding_window_moving_average:
    window_size: 15
    send_every: 15
    send_first_at: 15

Tried every pin number

and every DHT as the one i have is a 22

[14:21:10][C][wifi:415]: WiFi:
[14:21:10][C][wifi:283]: SSID: [redacted]
[14:21:10][C][wifi:284]: IP Address: 192.168.2.59
[14:21:10][C][wifi:286]: BSSID: [redacted]
[14:21:10][C][wifi:287]: Hostname: ‘temp’
[14:21:10][C][wifi:291]: Signal strength: -53 dB ▂▄▆█
[14:21:10][C][wifi:295]: Channel: 11
[14:21:10][C][wifi:296]: Subnet: 255.255.255.0
[14:21:10][C][wifi:297]: Gateway: 192.168.2.1
[14:21:10][C][wifi:298]: DNS1:
[14:21:10][C][wifi:299]: DNS2:
[14:21:10][C][logger:175]: Logger:
[14:21:10][C][logger:176]: Level: DEBUG
[14:21:10][C][logger:177]: Log Baud Rate: 115200
[14:21:10][C][logger:178]: Hardware UART: UART0
[14:21:10][C][dht:017]: DHT:
[14:21:10][C][dht:018]: Pin: GPIO0 (Mode: INPUT)
[14:21:10][C][dht:022]: Model: DHT11
[14:21:10](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[14:21:10](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[14:21:10][C][api:095]: API Server:
[14:21:10][C][api:096]: Address: temp.local:6053

If you have a DHT22 why are you specifying DHT11 as the model?

Do you have a 4K7 pullup resistor on the data line?

Please read this (point 11 specifically) then edit your post: How to help us help you - or How to ask a good question

thanks alot you help me out with this problem. this config work like a charm!

2 Likes