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 ?

asked Nov 2, 2018 at 18:38
8
  • how is the DHT22 wired and what esp8266 module you use? Commented Nov 2, 2018 at 19:51
  • I use a nodeMCU (Bangood, Geekcreit). The DHT22 is wired like this : learn.adafruit.com/adafruit-io-basics-temperature-and-humidity/… Commented Nov 2, 2018 at 20:24
  • to which pin of NodeMcu is the DHT data pin 2 connected? to D2 (io 0)? Commented Nov 2, 2018 at 20:27
  • I connected it to pin D4. But the pb is I can see the data AFTER the pullUp trick. So why ? Commented Nov 2, 2018 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. Commented Nov 3, 2018 at 13:48

1 Answer 1

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.

answered Nov 6, 2018 at 20:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.