DHT22 Sensor - sync timeout

I've wired up a DHT22 Sensor and am using Arduino 1.0 with ringerc's library

I've loaded up the example and although it works - its very intermittent. Any idea where I'm going wrong? I"m powering it from a 5V stable source.

Integer-only reading: Temperature 27.2 C, Humidity 41.5 % RH
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Got Data 27.20C 41.60%
Integer-only reading: Temperature 27.2 C, Humidity 41.6 % RH
Requesting data...Sync Timeout
Requesting data...Got Data 27.20C 41.70%
Integer-only reading: Temperature 27.2 C, Humidity 41.7 % RH

Typical - just after I post this I find a fix. :slight_smile:

Found this on Sparkfun - works like a bomb now!

I was using NetHoncho’s library, and was getting only maybe one out of ten readings correct. The rest were sync timeout errors.
I modified his library to retry up to 70 times instead of 35 times, and that did the trick. Look for this line in his lib:
if (retryCount > 35) //(Spec is 50 us, 352 == 70 us)
— and change it to this —
if (retryCount > 70) //(Spec is 50 us, 352 == 70 us)

Did some dhtlib too, you might give it a try. Interface is (of course) quite similar - http://arduino.cc/playground/Main/DHTLib -

Looking at the data sheet I'd suggest:

— and change it to this —
if (retryCount > 50) //(Spec is 80 us, 50x2 == 100 us)

(There are no mentions of 50us in the datasheet - looks like a misreading of "80" as "50")
Also all of the timing is a bit off in that library as the assumption of 2us round each loop is a poor one (each loop has several other tests in it, not just a call to delayMicroseconds(2) - probably more like 2.5 to 3us round each loop, and worse on an 8MHz board like the Lilypad...

Did you ever find out a solution to this problem? I'm trying to use the same sensor and encountering problems. I'm using a Arduino Fio and getting the following from the serial port after uploading:

DHT22 Library Demo
Requesting data...Polled to quick
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Data Timeout
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Sync Timeout
Requesting data...Data Timeout

After updating the .cpp file, I still get the same output. Any suggestions?

Thanks for your help