Page 1 of 5

DHT22 bug ?

Posted: Wed Jan 03, 2024 9:00 am
by kaqkk007
Since the latest update, the dht22 component is only willing to produce a 000 value or an incorrect readout , what is the cause ?

Re: DHT22 bug ?

Posted: Wed Jan 03, 2024 9:32 am
by Steve-Matrix
If you roll back the DHT22 component to an earlier version (via Library Updates), does it work then? Which latest version of the component is working for your project?

Re: DHT22 bug ?

Posted: Wed Jan 03, 2024 10:00 am
by medelec35
Hello.
DHT22 is on our list to be looked into.
Take a look at this post for another temporary solution.

Re: DHT22 bug ?

Posted: Wed Jan 03, 2024 10:06 am
by kaqkk007
I have tried both components (dth22 and grove dth22) and 4-16-20 Mhz quartz frequency as well . The update was done about 2 weeks ago , the project before that worked in simulation and in reality .

Re: DHT22 bug ?

Posted: Wed Jan 03, 2024 10:22 am
by kaqkk007
I have withdrawn the update of the grove DTH22 , will start testing . thank you !

Re: DHT22 bug ?

Posted: Wed Jan 03, 2024 1:59 pm
by kaqkk007
What you suggested worked thanks again ! I "upgraded" the sensor component to 17 and the grove dht to 3 and it works.

Re: DHT22 bug ?

Posted: Wed Jan 03, 2024 2:23 pm
by kaqkk007
Now I just need to figure out how to display the + - sign of the temperature ?

Re: DHT22 bug ?

Posted: Sun Jan 07, 2024 9:52 pm
by mnfisher
Found a DHT22 and had a play. Wired up to an esp32 and an oscilloscope - interesting trace!

I couldn't understand why pulling the pin low for 3ms (actually this only needs to be 1ms) would start a 'sensor' reading in the component - but my pulling a pin low for a period didn't (just a low for 3ms) I didn't get a reading using the component though - and wasn't sure why.

So - a little time later - I came up with this. Tested and working on an esp32 - it uses a slightly different approach to the component (making the code slightly simpler?) I also time in 10us lumps - making the delays slightly more achievable for some MCUs..

If anyone would like a play...
dht22.fcfx
(22.77 KiB) Downloaded 243 times
It's not a component (sorry) - and Temp and Humidity are saved as 10 times the actual value (so currently displaying 12.8C and 64.3% humidity which are saved as 128 and 643)

As an aside - if there is a timeout error - and less than 40 bits are received - it is necessary to check that there isn't an error before calculating temp - otherwise there is a compilation error (data may be used uninitialised) - that compiler is very neat!

Martin

Re: DHT22 bug ?

Posted: Sun Jan 07, 2024 11:04 pm
by mnfisher
dht22.png
dht22.png (230.97 KiB) Viewed 2317 times
Sample output from a DHt22.

Martin

Re: DHT22 bug ?

Posted: Fri Jan 12, 2024 10:00 am
by kaqkk007
At DHT22, what is the trick to tell if the temperature is in the - or + range ?