DHT 22 library on other than 16 mhz systems

by duckie on Sat Jun 01, 2013 7:55 pm

Hello,
I am working on a data logger using the DHT 22 humidity sensor. My logger runs at 8 mhz to enable running the 328 at 3v3.
I am getting read failures when I try to read the DHT. Reading the library change history it makes reference to:

" Support for non 16mhz devices

Added constructor parameter to allow for different timing needs. It has
the a default value of 6 which is the original value, so it should be
backwards compatible"

What do I need to change and what value is needed for use on an 8 mhz system?

Thanks,
duckie
duckie
 
Posts: 10
Joined: Sun Jul 10, 2011 9:35 am

Re: DHT 22 library on other than 16 mhz systems

by adafruit_support_bill on Sun Jun 02, 2013 8:34 am

Hmmm. Not a very well documented change, is it. You would need to add a third parameter to the constructor in your sketch. That is the counter for the receive timing loop which is 6 by default. From looking at the code, I think you would need a smaller number - probably between 3 and 5. That's a small enough range that it shouldn't take too long to find a value that works.
User avatar
adafruit_support_bill
 
Posts: 25526
Joined: Sat Feb 07, 2009 9:11 am

Re: DHT 22 library on other than 16 mhz systems

by duckie on Sun Jun 02, 2013 11:25 am

Hi,
Thank you. I had already determined that the third parameter was in the constructor, but was unsure of the value. I will try the values you suggest.
Thanks,
Duckie
duckie
 
Posts: 10
Joined: Sun Jul 10, 2011 9:35 am