I purchased an AM2302 [1] and have it wired to a Raspberry Pi. I've been using the Adafruit DHT driver [2] to read it. My circuit is exactly as specified in the tutorials [3]. I've tried 2 different GPIO pins on the RPi just to verify I don't have a bad pin. The RPi is also brand new (running latest Raspian).
Sometimes it works. But typically, after a few minutes, it stops returning valid data (if it ever returned valid data). Debugging the C++ library's code to try to understand what's wrong, the sensor seems to be returning too few bits. Specifically, j in Adafruit_DHT.c is < 39 (failing the conditional in line 129). The bits that are received do seem to be valid (not all 0xFF or 0x00):
$ sudo ./Adafruit_DHT 2302 4
Using pin #4
Data (36): 0xc 0x80 0x6 0x45 0x5
I've checked the supply voltages and those seem to be OK. I don't have an oscilloscope to verify the data line. But the fact that the driver seems to be reading some bits seems like an indicator that I don't have a circuit problem. I've also tried an alternative library, LOL_DHT [4], with similar results. My only guess here is that I have a bad sensor. [email protected] redirected me here for help.
-Jacob
[1] http://www.adafruit.com/products/393
[2] https://github.com/adafruit/Adafruit-Ra ... DHT_Driver
[3] http://learn.adafruit.com/dht-humidity- ... cs-logging
[4] https://github.com/technion/lol_dht22
AM2302 fails to return valid data
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: AM2302 fails to return valid data
That does sound like a wonky sensor. Send a note to [email protected] with a link to this thread and we'll get you a replacement.
Please be positive and constructive with your questions and comments.