0

I have the strange pb. My esp8266 was working fine with my DHT22 and then failed every time. I loaded an example sketch in a other ESP8266 and I have the same pb.... until I shut down -> up the DHT22 when the ESP8266 is working. To check more, I added this at the setup before dht.begin() :

      digitalWrite(0, LOW); // turn the LED on (HIGH is the voltage level)
  delay(1000); // wait for a second
  digitalWrite(0, HIGH);

And it works. But I don't know why I need to do this "pull up". PS : I already tried with or without the 10K resistor, same pb. PS2 : I already tried with 3.3v or 5V for DHT22. Same pb.

Any idea ?

  • how is the DHT22 wired and what esp8266 module you use? – Juraj Nov 2 '18 at 19:51
  • I use a nodeMCU (Bangood, Geekcreit). The DHT22 is wired like this : learn.adafruit.com/adafruit-io-basics-temperature-and-humidity/… – Cocorico Nov 2 '18 at 20:24
  • to which pin of NodeMcu is the DHT data pin 2 connected? to D2 (io 0)? – Juraj Nov 2 '18 at 20:27
  • I connected it to pin D4. But the pb is I can see the data AFTER the pullUp trick. So why ? – Cocorico Nov 2 '18 at 20:34
  • 1
    Cocorico, when you use @Jot in your answer, I will get notified. There are also timing issues with the esp8266 and the dht11 / dht22 sensors, and library incompatibilities. That was already a problem, but since this year many have issues. So please use a i2c humidity and temperature sensor. – Jot Nov 3 '18 at 13:48
3

I answer my own question in case someone has the same issue. The ADAFRUIT_DHT lib DOESN'T WORK WITH ESP8266. It keep saying Failed to read from DHT sensor! until you unplug/plug the VCC on the DHT.

But the DHTesp (link) works very well at first try !

Thx @Juraj and @Jot for their support.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.