0
\$\begingroup\$

Context :

Building a wireless sensor based on ESP8266 + DHT22 (+ "X-8266" board) + DHTtester example progam I fell on a rather strange and annoying problem :

Problem :

When powering up the board it doesn't detect the DHT22, unplugging and replugging the VCC pin of the DHT22 solves it.

My 2 cent :

Do you have any clue on this behavior and, better, a solution ? I could bind the VCC pin to a free GPIO and use it as a 3.3V power source but this wouldn't be very practical ...

PS. I have several DHT22 and the problem is the same for all. Hence I don't think this is linked to the DHT22 by itself, yet I might be wrong as they are all from the same batch

\$\endgroup\$
  • 1
    \$\begingroup\$ Do you have an oscilloscope? Check the data signal. The ESP8266 might be generating some noise on startup, borking the DHT22's communication state until a reset. \$\endgroup\$ – Makotanist May 7 '18 at 7:37
  • \$\begingroup\$ @Makotanist I don't have one on my own, I'll check with a friend next week. Meanwhile, if your assumption is right, what could be done ? \$\endgroup\$ – Cerber May 7 '18 at 12:57
  • \$\begingroup\$ A circuit diagram and some details on your implementation (PCB? Breadboard? Cable spaghetti? Cable length? etc.) would be helpful. Try adding a decoupling cap between VCC and GND of the DHT22 if you haven't already. And see to that you give it a solid connection to GND. \$\endgroup\$ – Dampmaskin May 7 '18 at 13:46
  • \$\begingroup\$ power the DHT22 from a different GPIO, that way you can turn it on and off at will. it only draws microamps, so the ESP's 20ma limit per GPIO is plenty. \$\endgroup\$ – dandavis May 7 '18 at 18:37
  • \$\begingroup\$ @dandavis, I've already done that and it's working.Yet (curse my "engineer" side) I just wan't to understand what might be the issue here... \$\endgroup\$ – Cerber May 8 '18 at 14:08
1
\$\begingroup\$

Your problem is that the DHT22 doesn't like to operate on 3.3V.

That datasheet from Adafruit says on page 5:

VCC - red wire Connect to 3.3 - 5V power. Sometime 3.3V power isn't enough in which case try 5V power.

The DHT22 uses the AM2302 module. The datasheet for the AM2302 says it is rated for 5V operation, and doesn't mention anything lower.

From the DHT22 datasheet, you can power it using 5V but it will communicate just fine with a 3.3V device like the ESP8266.

It would appear to have an open drain (or open collector) output for data. It only pulls the data line down.

So, you use a pull up to 3.3V on the data line but power the DHT22 from 5V.

\$\endgroup\$

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.