adafruit / adafruit/DHT-sensor-library
ASAIR DHT11 sensor type, wrong temperature values below 0C
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
The current DHT11 section of the DHT code -- to my understanding -- handles negative temperatures strangely:
it FIRST transforms the integral part into negative by subtracting from -1, and THEN simply adds the decimals.
Not sure this is how it should be, as the original DHT11 sensor is not certified for negative temperatures.
However, the ASAIR made DHT11, which is now the dominant version on the market, handles the negative values exactly the same way as the DHT12, i.e. the decimal part has the highest bit set to 1 (value & 0x80)=0x80 but no other transforms.
maybe a section could be added to the code, like a new type of DHT11 to accommodate this.
The current code with the ASAIR DHT11 reads wrong numbers below 0C.
Contributor guide
Research direction
Start by reading the DHT11 section of the DHT code and compare its negative-temperature handling with the DHT12 behavior described in the issue. The change is complete when ASAIR DHT11 sensors report negative temperatures correctly while the original DHT11 behavior remains supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100