DHT 22 library on other than 16 mhz systems

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
duckie
 
Posts: 11
Joined: Sun Jul 10, 2011 10:35 am

DHT 22 library on other than 16 mhz systems

Post by duckie »

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

User avatar
adafruit_support_bill
 
Posts: 88136
Joined: Sat Feb 07, 2009 10:11 am

Re: DHT 22 library on other than 16 mhz systems

Post by adafruit_support_bill »

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

Re: DHT 22 library on other than 16 mhz systems

Post by duckie »

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

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”