DHT22 / RHT03
Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

DHT22 / RHT03

by Worcester on Sun Sep 09, 2012 6:40 pm

Been trying to get the RPi to read the output from the DHT22 using the ciruit and code here:
http://learn.adafruit.com/dht-humidity- ... cs-logging

However I'm getting nothing back from the port, I've posted infor on the RPi forum, ( http://www.raspberrypi.org/phpBB3/viewt ... 37&t=15755 ) however still waiting for answers.

1) Yes I have a Pull up resistor in Place,
2) Yes I have an Oscilloscope,

Using the code in
$ sudo ./Adafruit_DHT, the responce I get back is:

Code: Select all | TOGGLE FULL SIZE
pi@raspberrypi ~/Adafruit-Raspberry-Pi-Python-Code/Adafruit_DHT_Driver $ sudo ./Adafruit_DHT 22 4
Using pin #4
Data (0): 0x0 0x0 0x0 0x0 0x0

Here are the oscillsope traces:
https://picasaweb.google.com/1132605127 ... directlink

So clearly the pin goes low and then comes back up high, though the routine doesn't appear to pul back the data

I've tried different pins - no different, and I;ve tried other routines to do other things using the same pin and they work OK.

I've tried 5V and linked both pins 3 and 4 to gnd (see comments here: https://www.sparkfun.com/products/10167 )

Any ideas?

Thanks, Worcester
Posts: 1
Joined: Sun Sep 09, 2012 6:26 pm

Re: DHT22 / RHT03

by Dwali on Mon Sep 24, 2012 1:24 am

I'm having the same issue with the AM2302. Glad I'm not alone. I've found no solution to this problem yet.
Posts: 7
Joined: Sun Sep 23, 2012 4:55 pm

Re: DHT22 / RHT03

by cynikal on Mon Sep 24, 2012 1:58 am


I've been running this thing in a loop (sleep 3 seconds before polling), and in the last 5 minutes it's answered me maybe twice.. what gives??
Posts: 7
Joined: Sun Sep 09, 2012 9:38 pm

Re: DHT22 / RHT03

by cynikal on Mon Sep 24, 2012 2:31 am

Found the solution at the bottom:

http://www.raspberrypi.org/phpBB3/viewt ... 5&p=179399

basically it involves changing the timing 100 to 500000 and recompiling. It's still not working 100% (e.g. it still returns 0 data) but it's like non-responsive once in 20 times instead of it working once every 20 times
Posts: 7
Joined: Sun Sep 09, 2012 9:38 pm

Re: DHT22 / RHT03

by outspoken on Mon Sep 24, 2012 8:54 am

How did you recompile it?

When I try I get:

Code: Select all | TOGGLE FULL SIZE
gcc -c -o Adafruit_DHT.o Adafruit_DHT.c -std=c99 -I. -lbcm2835
Adafruit_DHT.c:24:21: fatal error: bcm2835.h: No such file or directory
compilation terminated.
make: *** [Adafruit_DHT.o] Error 1

I can't seem to find bcm2835.h

EDIT: found it, google hides this page quite well - http://www.open.com.au/mikem/bcm2835/index.html
Posts: 2
Joined: Tue Sep 18, 2012 8:23 pm