I am trying to use a DHT22 with my RasPi. I followed the Adafruit tutorial DHT Humidity Sensing on Raspberry Pi with GDocs Logging but when trying to get a reading by running sudo ./Adafruit_DHT type pin# from the command line, it can take an absolute age to get the reading back - the best I have had so far is about 5mins and the worst 71 mins!
I have connected the DHT as described and have tried both a 4.7K and 10K resistors and have loaded all the libraries. I have had a look at the C code in Adafruit_DHT.c and am guessing it is getting stuck at
Code: Select all
// wait for pin to drop?
while (bcm2835_gpio_lev(pin) == 1) {
usleep(1);
}
Below are a few typical results I have been getting (I am using port 22 but have tried others, including 4 as in the tutorial):
Code: Select all
pi@raspberrypi ~/Adafruit-Raspberry-Pi-Python-Code/Adafruit_DHT_Driver $ time sudo ./Adafruit_DHT 22 22
Using pin #22
Data (40): 0x1 0xf2 0x0 0xe2 0xd5
Temp = 22.6 *C, Hum = 49.8 %
real 5m12.403s
user 0m5.820s
sys 1m26.350s
Code: Select all
pi@raspberrypi ~/Adafruit-Raspberry-Pi-Python-Code/Adafruit_DHT_Driver $ time sudo ./Adafruit_DHT 22 22
Using pin #22
Data (40): 0x1 0xef 0x0 0xe5 0xd5
Temp = 22.9 *C, Hum = 49.5 %
real 16m50.953s
user 0m49.030s
sys 4m14.370s
Code: Select all
pi@raspberrypi ~/Adafruit-Raspberry-Pi-Python-Code/Adafruit_DHT_Driver $ time sudo ./Adafruit_DHT 22 22
Using pin #22
Data (40): 0x1 0xf0 0x0 0xe2 0xd3
Temp = 22.6 *C, Hum = 49.6 %
real 71m56.141s
user 1m8.340s
sys 20m5.480s