DHT22 bug ?

Post and discuss new components that you have created.
kaqkk007
Posts: 26
http://meble-kuchenne.info.pl
Joined: Sat Feb 04, 2023 1:09 pm
Has thanked: 2 times
Been thanked: 1 time

DHT22 bug ?

Post 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 ?

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: DHT22 bug ?

Post 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?

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: DHT22 bug ?

Post by medelec35 »

Hello.
DHT22 is on our list to be looked into.
Take a look at this post for another temporary solution.
Martin

kaqkk007
Posts: 26
Joined: Sat Feb 04, 2023 1:09 pm
Has thanked: 2 times
Been thanked: 1 time

Re: DHT22 bug ?

Post 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 .

kaqkk007
Posts: 26
Joined: Sat Feb 04, 2023 1:09 pm
Has thanked: 2 times
Been thanked: 1 time

Re: DHT22 bug ?

Post by kaqkk007 »

I have withdrawn the update of the grove DTH22 , will start testing . thank you !

kaqkk007
Posts: 26
Joined: Sat Feb 04, 2023 1:09 pm
Has thanked: 2 times
Been thanked: 1 time

Re: DHT22 bug ?

Post by kaqkk007 »

What you suggested worked thanks again ! I "upgraded" the sensor component to 17 and the grove dht to 3 and it works.

kaqkk007
Posts: 26
Joined: Sat Feb 04, 2023 1:09 pm
Has thanked: 2 times
Been thanked: 1 time

Re: DHT22 bug ?

Post by kaqkk007 »

Now I just need to figure out how to display the + - sign of the temperature ?

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 508 times

Re: DHT22 bug ?

Post 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 177 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

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 508 times

Re: DHT22 bug ?

Post by mnfisher »

dht22.png
dht22.png (230.97 KiB) Viewed 2196 times
Sample output from a DHt22.

Martin

kaqkk007
Posts: 26
Joined: Sat Feb 04, 2023 1:09 pm
Has thanked: 2 times
Been thanked: 1 time

Re: DHT22 bug ?

Post by kaqkk007 »

At DHT22, what is the trick to tell if the temperature is in the - or + range ?

Post Reply