Adafruit_CircuitPython_DHT: DHT22 reports wrong negative temperatures
First off: it sounds like the bug which has been reported here: https://github.com/adafruit/Adafruit_CircuitPython_DHT/issues/9 but it happend to me with the latest version as well.
I have recently migrated from the old Adafruit lib to this one, because I hoped that the bug which occurred in the old lib as well has been fixed in the new one. Unfortunately it seems as if there is an issue with the new lib in my setup as well.
- I am running a DHT22 sensor with a Raspberry Pi
- positive temperature and humidity are reported correctly
- negative values are currently around -3276,1°C (-5865,0°F) - the decimal varies probably because the outside temp is as well
- I followed this tutorial (in German) - https://tutorials-raspberrypi.de/raspberry-pi-luftfeuchtigkeit-temperatur-messen-dht11-dht22/ basically it’s about installing it via
sudo pip3 install adafruit-circuitpython-dht
sudo apt-get install libgpiod2
Unfortunately I am not really familiar which informtation I might need to provide for this bug report nor I have no clue what I could try next.
Therefore: any help is appreciated 😃
Side note: the sensor I have in use does not require a pull up resistor - and I assume that this is correct - as said: all values except negative temperatures are pretty much accurate.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 21
Hi everyone!
I had this issue too. I just did some try&error testing and found out that with my python script I can add the wrong value at the actual -0.1˚C to the wrong number (ex: temperature_c+3276.6) and then multiply that with -1 to get the actual negative temperature.
For this you have to get your reported value at -0.1˚C and write it down. Then go into your code and add it there as the correction value.
I don’t have an other DHT22 for testing but I’m not sure if every one has the same reported value at -0.1˚C. So be aware of that.
Tested it for a week and compared it the an actual thermometer and it worked for me.
There is my code:
This gives the correct output:
-0.1 99.9
Yes, there is fog outside 😃