Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolution reported for DHT11 temp is 2° - should be 0.1°, %RH should be 1% instead of 5% #198

Open
DaleSchultz opened this issue Jan 22, 2023 · 1 comment

Comments

@DaleSchultz
Copy link

See https://forums.adafruit.com/viewtopic.php?p=957161 for discussion thread.

The Resolution values for both Temperature and Humidity are incorrectly defined in DHT-U.cpp for DHT11 sensors.

Lines 213-217

case DHT11:
    sensor->max_value = 80.0F;
    sensor->min_value = 20.0F;
    sensor->resolution = 5.0F;
    break;

and lines 138-144

case DHT11:
    sensor->max_value = 50.0F;
    sensor->min_value = 0.0F;
    sensor->resolution = 2.0F;
    break;;

Both values are the respective accuracy values, not their resolution.

The resolution 'field' in the Adafruit Unified sensor layer is defined in Adafruit_Sensor.h
float resolution; /**< smallest difference between two values reported by this sensor */
i.e. is clearly a resolution and not 'accuracy'

The correct values should be:

Lines 213-217

case DHT11:
    sensor->max_value = 80.0F;
    sensor->min_value = 20.0F;
    sensor->resolution = 1.0F; // corrected from 5
    break;

and lines 138-144

case DHT11:
    sensor->max_value = 50.0F;
    sensor->min_value = 0.0F;
    sensor->resolution = 0.1F; // corrected from 2
    break;;

The erroneous data is visible in the output of the Adafruit DHT library sample program: DHT_Unified_Sensor.ino

Temperature Sensor
Sensor Type: DHT11
Driver Ver: 1
Unique ID: -1
Max Value: 50.00°C
Min Value: 0.00°C
Resolution: 2.00°C

The resolution for this sensor is 0.1°C according to both the spec sheet and observation. Here one can see sequential values differing by 0.1°:

Temperature: 19.90°C Humidity: 35.00%
Temperature: 19.80°C Humidity: 35.00%

The same goes for the humidity values.

The correct values are found in numerous online data sheets for the DHT11

The fix involves changing values on two lines:

143: sensor->resolution = 0.1F; // corrected from 2
216: sensor->resolution = 1.0F; // corrected from 5

@Jaorow
Copy link

Jaorow commented Jul 6, 2024

same issue here!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants