I had bought this DHT22 module on AliExpress. The module looks fine, but it does not work at all. I had tried lots of sketches, I tried to change the pin, I tried to change the cables, but I always have the same result: Failed to read from DHT22 sensor!.

That's what I get if I use the standard sketch DHTtester.ino:


That's what I get if I use the standard sketch DHT_Unified_Sensor.ino:


Can you help me? Or is the module corrupted?

  • The sensor wants a pull-up resistor of about 10kΩ between DATA en VCC; does your module have one? What voltage are you giving it? Some don't work properly at 3.3V.
    – ocrdu
    Nov 19, 2020 at 12:45
  • @ocrdu, yes, it has a 103 10 kΩ SMD resistor. The voltage`s 5V since the module is connected to Arduino Uno R3 via Arduino Sensor Shield V5.0.
    – Starter
    Nov 19, 2020 at 13:46

1 Answer 1


The product page you linked to has modules of different types.

Make sure you have uncommented the matching type in the this section of the example:

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11   // DHT 11
#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

Also makers of these boards sometimes label them incorrectly or describe them incorrectly when selling them. If you're unsure what you have, try them all.

  • I wonder that it is not my case. My sensor is truly not a DHT11, since the 11s have blue cases and mine has a white one. Though I'll try to switch the code to the DHT21 option. Hope this one helps. But aren't the 21 and the 22 cross-compatible?
    – Starter
    Nov 19, 2020 at 14:48
  • **edit: **Also, the Internet says that DHT21 has a black case, they truly cannot be messed up.
    – Starter
    Nov 19, 2020 at 15:01
  • @Starter, I dunno how consistent the case is either, but it probably is useful indicator if not definitive. I believe you are correct with respect to the DHT21 and DHT22. Looking at the Adafruit library for them, they certainly seem to be treated the same way in every case. If you wind up solving the problem yourself and the answer is something entirely different, you should probably make your own answer and mark it accepted.
    – timemage
    Nov 19, 2020 at 16:47

Your Answer

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

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