I was playing with a DHT11 sensor module and ESP Easy 147RC8 on a Wemos D1 mini, with Mosquitto & Node-Red. I was getting about 5% NaN readings for temperature and humidity so I did a bit of research and came across this thread about the Adafruit code that seems to be the basis for the ESPEasy DHT plugin:
"DHT init sequence wrong" : https://github.com/adafruit/DHT-sensor- ... /issues/48
"...after you pulled the data line low for the at least 18 milliseconds to signal the DHT11 a start, you should NOT actively pull it up. As soon as the DHT does see the low-high transition on the data line ( Well "as soon is around 12 usec later) it tries to pull it down. If the data line is still held "high" by the uC at that time, you have more or less a short circuit on the data line with the uC pulling up and the DHT pulling down."
In code, this means commenting out one line in the plugin (_P005_DHT.ino) around line 98:
Code: Select all
pinMode(Plugin_005_DHT_Pin, OUTPUT);
// DHT start condition, pull-down i/o pin for 18ms
digitalWrite(Plugin_005_DHT_Pin, LOW); // Pull low
delay(18);
//digitalWrite(Plugin_005_DHT_Pin, HIGH); // Pull high <<< COMMENT OUT THIS LINE
delayMicroseconds(20); // was 40
I'd appreciate thoughts and additional testing!
Cheers
L3K