Hi all, I have 3x DHT11 temp / humidity sensors. (datasheet: http://www.micropik.com/PDF/dht11.pdf)
These are great, inexpensive, digital sensors, however I am having trouble with the RH value varying wildly between different sensors. For example, of the 3 sensors I have, one reads 11%, second one reads 27%, and 3rd reads 34%, all sitting right next to each other. The temp readings all match each other. For each of them, I can "blow on them" and watch the RH reading climb. The datasheet indicates the RH is accurate +/- 5%, which is fine, however my results are showing a 24 point spread! Beyond that, if I place any of the sensors in a known humidity environment, for example I have several cigar humidors that are held at a relatively precise 70% RH, the sensors never show anything near that, typically topping out at around 40%. Unfortunately, an inaccurate reading is completely useless.
I'm wondering if anyone else has experienced this before, and also by contrast if the supposedly more accurate DHT22 yields much better results. If so, I wouldn't mind spending the money for a better sensor, but I don't want to throw money at the problem either.
As far as code, I am testing with the DHT11 example library, I am running this on an ATmega328, and I have switched to several different digital pins, with consistent results.
I would have a good re-read of the data sheet again . It looks like a lot can go wrong
I saw that you must not send any signals to the device for 1 second to allow it to stabilise - did you delay your program?
Thanks for the reply. I re-read the datasheet, and I noticed about the polling intervals, and also how to re-calibrate the device. My code already has appropreate delays, however I have not tried their calibration method mentioned in the article. None of the other environmental concerns apply for me. Has anyone else fiddled around with these sensors before? Below is the example code. Perhaps there is another library out there?
// FILE: dht11_test1.pde
// PURPOSE: DHT11 library test sketch for Arduino
//Celsius to Fahrenheit conversion
double Fahrenheit(double celsius)
return 1.8 * celsius + 32;
//Celsius to Kelvin conversion
double Kelvin(double celsius)
return celsius + 273.15;
// dewPoint function NOAA
// reference: http://wahiduddin.net/calc/density_algorithms.htm
double dewPoint(double celsius, double humidity)
double A0= 373.15/(273.15 + celsius);
double SUM = -7.90298 * (A0-1);
SUM += 5.02808 * log10(A0);
SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
SUM += log10(1013.246);
double VP = pow(10, SUM-3) * humidity;
double T = log(VP/0.61078); // temp var
return (241.88 * T) / (17.558-T);
// delta max = 0.6544 wrt dewPoint()
// 5x faster than dewPoint()
// reference: http://en.wikipedia.org/wiki/Dew_point
double dewPointFast(double celsius, double humidity)
double a = 17.271;
double b = 237.7;
double temp = (a * celsius) / (b + celsius) + log(humidity/100);
double Td = (b * temp) / (a - temp);
#define DHT11PIN 12
Serial.println("DHT11 TEST PROGRAM ");
Serial.print("LIBRARY VERSION: ");
int chk = DHT11.read(DHT11PIN);
Serial.print("Read sensor: ");
case 0: Serial.println("OK"); break;
case -1: Serial.println("Checksum error"); break;
case -2: Serial.println("Time out error"); break;
default: Serial.println("Unknown error"); break;
Serial.print("Humidity (%): ");
Serial.print("Temperature (oC): ");
Serial.print("Temperature (oF): ");
Serial.print("Temperature (K): ");
Serial.print("Dew Point (oC): ");
Serial.print("Dew PointFast (oC): ");
// END OF FILE
Through further testing, I'm wondering how the DHT11 really detects RH. If I leave it in my cigar humidor, which is 70% RH, it reads around 35%. However, if I breathe on the sensor, it will quickly climb up to about 85%. I wonder if it needs active air circulation in order to properly detect humidity.
On that note, I will try putting a little 20mm fan inside my cigar humidor and see if that affects the readings. Will report back.
Even with the fan for circulation, the sensor reads about 42% RH. That is about 5% higher, but still nowhere near accurate. I've tried both Adafruit's DHT11 lib and examples, as well as the DHT lib, which is a combo for the DHT11 / 22 sensors, all with the same results. I guess I will order a DHT22 and see if I get better results. I'm just having a hard time believing that this sensor could be so far out of whack.
Looks like sensor resetting procedure helps me. I think it happens when sensor is used in extreme conditions like when breathing on it or placing straight under vapor stream or ultrasonic humidifier.
all you need to do:
Step one: Keep the DHT sensor at the condition of Temperature 50~60Celsius, humidity <10%RH for 2 hours;
Step two:K keep the DHT sensor at the condition of Temperature 20~30Celsius, humidity >70%RH for 5 hours.
In my case it wasn't hard to get that environment: first one can be achieved just placing sensor in air heater (water or electric), second- just cover sensor with something wet in room temperature. After resetting i have checked measurements and surprisingly humidity was both equal on DHT11 and expensive, calibrated hygrometer.
Hello, I tested the DHT11 sensor in extreme conditions (under rain hehehe).
After it get water on it the sensor reading freezes on 60ºC temperature and 75% Humidity.
I waited a few days to dry the sensor properly, put him in the sun and heater for no more than 2 hours and the Temperature reading get back to the right reading (I compare with the sensor DS18B20 which also get in the rain and doesn't get any problems in the readings). But the humidity is stuck in about 35-40%, same problem of our friend jbishop129 . =
I will try to make this resetting routine.
Thanks for the tip!
I tried the re-calibration procedure about 5 times, but the humidity still stuck in about 35 ~ 40%, any tip why? =)
If I breath on it, the reading goes up to 60% normaly.
In my case it wasn't hard to get that environment: first one can be achieved just placing sensor in air heater (water or electric), second- just cover sensor with something wet in room temperature.
Those who had success with this process, did you do this with the device powered on, or did you disconnect it before?
(Trying to guess whether the recalibration is an active, or a passive process)
Power was off while recalibrating. After few days of running in normal conditions (i even didn
t breath on it), it resumes to show abnormal humidity. I was running room humidifier until real humidity rises to 55%, while DHT11 sensor still shows 14%. Maybe you can use sensor to read changes in humidity, but not the actual value. I my case i didnt find it usefull at all.
I know I'm digging out an old thread.
But I'm experiencing the same problems.
I'll try the recalibration method and report my results.
I, too, face exactly the same problem. I wanted my Arduino + DHT11 + LCD to monitor the temp/humidity of my cigar humidor. I have an "analogical" hygrometer inside of it, and have calibrated it many times. It does work. There should be around 70-72% relative humidity inside the box. But the DHT11 keeps saying 50%.
vimtut0r, did you manage to have correct results ?
midel ... I get a 20% too low reading as well (DHT22). I had about 30% inside the house, which I found hard to believe ... sensor is now in a sealed container with water, and it doesn't go higher than 80%. Would like to find out how to calibrate - that is telling the sensor his current reading is 100% - found beautiful articles on measuring accuracy, but nothing on calibration thus far ...
So, it seems we all face the same problem... It is said that DHTxx are calibrated in the factory... But... I'm not convinced Anyway, measuring humidity is tricky, we should try to understand how the DHT11 humidity sensor works.
I made 2 tests :
DHT11 in a small closed container with a mix of salt and water. With not to much water, the purpose is to make a sort of salt paste. In this config, the humidity should reach 75%. It's a well known test to calibrate cigar humidor hygrometers. DHT11 humidity slowly reached 69%. Not so far.
Today i put the DHT in the same container but with only water, to aim 100%. I managed to reach 95% ! So it seems to be not so stupid !
I'll try to put the DHT11 back in the cigar humidor, to see if now i get a correct measure around 65/70% and if it stays this way several days/weeks or if it goes back to the abnormal 50% first measure.
oh, and jqdoumen, one way to cheat if you really think you have a constant 20 difference between reality and what the DHT outputs would be to add 20 to the sent value (serial or LCD). Something like :
But it's really really ugly not rigorous cheating and maybe you'll always wonder whether it is really correct or not.
unfortunately the sensor does not seem to be off linearly, so adding an arbitrary number might yield strange results. My test with the saturated sodium chloride solution is still running, but it looks like it is not getting any higher then 62 (after 5 hours). So, at 100% it is 20 off, at 75% it is 13 off. I'll check if I can get easy access to magnesium chloride, to have a reference at the low end as well, and then check how ugly adding numbers actually is. I don't mind being 5% off, but 20% is a little too much.
ps: what resistor do you have between your pin and ground?
I have a DHT11 module already mounted with resistor. I don't even know what are the components.
Concerning the salt test, here is the corresponding graph (legends in french, sorry ) :
at t=0min i put the sensor inside the container. Before, it was in ambiant air : 17°C 39%RH
It stayed in the container all night long, and the day after I had 67% RH
Oh, and btw, the sensor keeps on saying my home is around 17/18°C... I don't think it's this cold. I'd say at least 19°C. I should double check that. I made another temperature sensing setup with a NTC thermistor, but it also needs calibration...
And... naaaaaaa no miracle in the humidor.
After one night in the humidor, DHT11 says 64%. In fact, it's not that bad. Previously i had 50/51%, which was really far from the expected value. Maybe this long time spent in a 100% environment was good. I'll see how it goes. What will be the value in 7 days ?
Have a look at Robert Smith's experiments on the accuracy determination of humidity sensors (http://www.kandrsmith.org/RJS/Misc/calib_dht22.html). Internal heating falsifying the measurements, a broken sensor or a non stable sensor were quickly ruled out. It seems my DHT22 is just not well calibrated when it left the factory.
I've been measuring humidity in a closed jar at the speed of 1 reading every 6 seconds (minimise internal heating) over 12 to 24 hours, with three different solutions : pure water, saturated NaCl and saturated MgCl. They should be reading 100%, 75% and 33% of RH. I took the actual readings, did a tiny linear regression on it, and have now a formula for converting actual readings into a calibrated output.
It seems RH value of DHT11 depends on Vcc. Try it at Vcc=5V (Vcc=3,3V gives lower values).
I tested three different DHT11 sensors , two of them properly reported humidity at 5 volts , the third one reported less by 10%. Read value of each sensor depended on the supply voltage.