The State of DHT Libraries

All,

There is a lot going on with DHT libraries. I wanted to share a couple of things that I have discovered to hopefully save other people time.

The PietteTech_DHT library which was the go to DHT library for many people doesn’t work reliably on the Argon using 0.8.0-rc.27. It works very reliability using 0.8.0-rc.26.

There are a number of copies of the Adafruit_DHT library.

There is one copy floating around where the digitalWrite statements have been replaced with pinSetFast and p.inResetFast that works pretty reliably. I found over several hours of testing reading every 3 seconds that it failed 10% of the time. It can be found here: https://build.particle.io/shared_apps/5c2ec562e71c122067000cd4

The ADAFRUIT_DHT library in the Web IDE has not been updated to replace the digitalWrite statements which is probably good as it works with the Photon but not the Argon. A second copy ADAFRUIT_DHT_PARTICLE also appears to have not been changed from digitalWrites.

The GROVE_TEMPERATURE_AND_HUMIDITY_SENSOR library in the Web IDE has been updated from digitalWrite statements to pinSetFast and pinResetFast.

There are an additional 10 DHT libraries that I didn’t look at.

4 Likes

Thank you for the update. I put my Argon and Xenons away for a while waiting on the next update to see if it solved some of the last issues with the rc27 update. All this fiddling with libraries and stuff “jiggling the handle” is all a little over my head.
Thanks!

1 Like

That's already logged here
https://github.com/particle-iot/device-os/issues/1654

The issue with the Adafruit_DHT library is that the original contributor seems to have abandoned the library and @eugene0501 should have taken over the library and reuploaded a repaired version (@jvanier had offered to help him with that).

I agree, that over-abundance of semi-working or even broken libraries is a sore point I've addressed with Particle multiple times in the past, but it's good that it's also taken up by others :+1:

2 Likes

I have just pushed an update to the PietteTech_DHT library (now v0.0.6) to work around this issue

Thank you very much. I will give it a try.

For the project I am working on I decided to go with a BME280 using I2C but I have a number of DHT22 sensors that I plan to use on other projects.

digitalhack

1 Like