DHT 22 library on other than 16 mhz systems
Moderators: adafruit_support_bill, adafruit

DHT 22 library on other than 16 mhz systems

by duckie on Sat Jun 01, 2013 8: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: 11
Joined: Sun Jul 10, 2011 10:35 am

Re: DHT 22 library on other than 16 mhz systems

by adafruit_support_bill on Sun Jun 02, 2013 9: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: 31727
Joined: Sat Feb 07, 2009 10:11 am

Re: DHT 22 library on other than 16 mhz systems

by duckie on Sun Jun 02, 2013 12:25 pm

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: 11
Joined: Sun Jul 10, 2011 10:35 am