Pages: [1]   Go Down
Author Topic: DHT11 - temp ok, but RH values wildly off  (Read 3280 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 2
Posts: 53
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Full Member
***
Karma: 4
Posts: 218
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Jr. Member
**
Karma: 2
Posts: 53
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Code:
//
//   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);
return Td;
}


#include <dht11.h>

dht11 DHT11;

#define DHT11PIN 12

void setup()
{
  Serial.begin(115200);
  Serial.println("DHT11 TEST PROGRAM ");
  Serial.print("LIBRARY VERSION: ");
  Serial.println(DHT11LIB_VERSION);
  Serial.println();
}

void loop()
{
  Serial.println("\n");

  int chk = DHT11.read(DHT11PIN);

  Serial.print("Read sensor: ");
  switch (chk)
  {
    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;
  }
  delay(2000);
 
  Serial.print("Humidity (%): ");
  Serial.println((float)DHT11.humidity, 2);

  Serial.print("Temperature (oC): ");
  Serial.println((float)DHT11.temperature, 2);

  Serial.print("Temperature (oF): ");
  Serial.println(Fahrenheit(DHT11.temperature), 2);

  Serial.print("Temperature (K): ");
  Serial.println(Kelvin(DHT11.temperature), 2);

  Serial.print("Dew Point (oC): ");
  Serial.println(dewPoint(DHT11.temperature, DHT11.humidity));

  Serial.print("Dew PointFast (oC): ");
  Serial.println(dewPointFast(DHT11.temperature, DHT11.humidity));

  delay(2000);
}
//
// END OF FILE
//
Logged

0
Offline Offline
Jr. Member
**
Karma: 2
Posts: 53
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Jr. Member
**
Karma: 2
Posts: 53
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 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!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

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)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 didn`t find it usefull at all.
Logged

Pages: [1]   Go Up
Jump to: