Arduino project

Raspberry project

Post Page Advertisement [Top]

From the date I got DHT22 humidity sensor, I always doubt about its accuracy.
As datasheet statement, DHT22 accuracy is +/- 2%RH, but it might be varied depend on each sensor.
To test DHT22, we have to make standard humidity environment, and we have to know humidity of that environment.
A seal box is perfectly to create standard humidity environment.
Hardware need for testing:
1. DHT22
2. Arduino Pro Mini
3. Hygrometer
4. Sodium Chloride NaCl
5. Silica Moisture absorber
6. Seal box, clay, small bowl
1. DHT22 sensor
2. Arduino Pro Mini

3. Hygrometer
5. Silica moisture absorber

Step 1. Reading value DHT22 from Arduino Pro Mini
How to read the value? Please visit this link for reading value

Step 2. Make 1st calibration point by Sodium Chloride
An saturation Sodium Chloride (NaCl) in water will create standard 75%RH. So we will put a lot of NaCl into small bowl, and pour some water above top of NaCl.
Put NaCl bowl, DHT22 into box, seal it with clay. Keep it there about 6 hours. Why need about 6 hours? In order to keep environment stable. Furthermore, mechanical type Hygrometer reacting very slow.
In my case, hygrometer reads 75%, but DHT22 reads 56.4% (unlucky for me when got not accurate sensor)

Step 3. Make 2nd calibration point by Silica Moisture absorber
Silica Moisture absorber will decrease humidity of nearby environment. We also put bowl of Silica Moisture absorber, DHT22 into box, keep it in 6 hours (it take so many time to test this sensor!)
Again, hygrometer reads 49.5% but DHT22 reading is 29.1%

Step 4. Make a curve
Microsoft Excel will help to make calibration curve. Make a drawing as following, display equation chart, we will got calibration factor.
This case, calibration factor is 0.9341 and 22.319

Step 5. Update calibration curve into Arduino code
#include <DHT.h>;

#define DHT_PIN 7           // Output of DHT22 to pin 7 Arduino
#define DHT_TYPE DHT22      // DHT22 (AM2302)
DHT dht(DHT_PIN, DHT_TYPE); // Initialize DHT sensor for Arduino 16MHz

int chk;
float hum;  //Stores humidity value
float temp; //Stores temperature value

void setup()

void loop()
    //Read value of Humidity and Temperature
    hum = dht.readHumidity();
    temp= dht.readTemperature();

    hum = hum*0.9341 + 22.319; //calibration
    //Print out value of Humidity and Temperature
    Serial.print("Humidity is: ");
    Serial.print("% --- Temp is: ");
    delay(5000); //Delay 2 sec.
Step 6. Test accuracy again
Make a test again with saturation NaCl and Silica Moisture absorber.
Fortunately, the reading is now 49.5% for Silica, and 77.15% for NaCl (quite good for humid sensor!)


  1. Thank you very much video of the most benefits videos .... Everyone suffers from the inaccuracy of some of the Sensors.

  2. Hi! my name is Alan, first all thanks for your article, is very interesting.... question... the calibration curve what did you get
    applies to any DHT22 sensor adding the formula to my code? or or do I have to recalibrate my DHT22 sensor?... thanks, regards

    PD. Sorry for my bad english

    1. Hi, thanks for your visit. You have to re-calibrate for your DHT22 sensor.
      Every sensor has its own characteristic, this article is show how to make calibration formular for every sensor.

  3. I don't understand were you get the numbers in the formula. Where does the 0.9x come from? where does the 22.3x come from? can you explain a bit more? thank you

    1. Hi, step 2 & 3 is for detecting two point of reading, by compare with standard hygrometer. Then step 4 is for calculating by Excel -> this step will find out factor a and b in f(x) = a*x+b, in which a = 0.9341 and b = 22.391

    2. Thank you very much for the explanation.

  4. Does it work also on dht11? just changin DHT22 to DHT11?

    1. you mean the curve in above code also work on DHT11? above curve is working for my sensor only. Each sensor will have its own character (the curve). However, above principle mention above can be applied for any sensor, DHT22 or DHT11 or others.


Bottom Ad [Post Page]