Failed to read from DHT

Hi everyone,

I just got back to OMG after a couple of years of not playing around with home automation.
I got my old nodemcu, that was still all wired up, downloaded the current version and uploaded the sketch via the Arduino IDE. I started with a fresh install of the IDE and used all the libraries included in OMG.

Everything compiles and uploads fine. Wiring is correct. However, I get the “E: Failed to read from DHT sensor!” error in the serial monitor.

I tried using a different sketch and it reads the DHT just fine.

#include "DHT.h"
#define DHT_TYPE DHT22
const int DHT_PIN = 5;

void setup() {

void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();



Output as expected:
21:39:33.867 → 23.30
21:39:33.867 → 38.90

I did not change anything in the config_DHT.h. In the User_config.h I just uncommented the ZsensorDHT and the ZsensorADC and put in my Wifi Credentials. ADC woks fine (with a photoresistor) but DHT always fails to read.

Can anyone point me in the right direction? Since it works with the test sketch, I really don’t know where to look. I did update the DHT lib in the meantime to the current version, but that has not helped either.


I had a similar problem (unrelated to OMG) trying to read data from some "DHT22"s. I tried to open one and inside found a SHT3C that is an i2c temp/hum sensor and an unknown small chip which I think served the purpose to convert the reading on i2c from SHT3C to the protocol used in DHT22.
I had also some older “real” DHT22 so I tried to capture the data transfer with an oscilloscope and found that the timings of the new ones were a bit off (data output was a bit too fast), and finally playing around with timings in the library I managed to read data from them.