简体   繁体   中英

wrong humidity from a DHT11 sensor w/ Nano v3

I bought a couple of humidity sensors ebay link

for cheap and tried them out. With 2 different sets of libraries and 2 different sensors, both produce very a very incorrect humidity reading off by the same 40 points.

libraries

code:

#include "DHT.h"

DHT dht;

void setup()
{
  Serial.begin(9600);
  Serial.println();
  Serial.println("Status\tHumidity (%)\tTemperature (C)\t(F)");

  dht.setup(2); // data pin 2
}

void loop()
{
  delay(dht.getMinimumSamplingPeriod());

  float humidity = dht.getHumidity();
  float temperature = dht.getTemperature();

  Serial.print(dht.getStatusString());
  Serial.print("\t");
  Serial.print(humidity, 1);
  Serial.print("\t\t");
  Serial.print(temperature, 1);
  Serial.print("\t\t");
  Serial.println(dht.toFahrenheit(temperature), 1);
}

output:

在此处输入图片说明

I have 2 other devices and weather reports of a sticky 82% humidity. The device is reporting 40% humidity. off by 40 points.

I didn't exactly buy top shelf gear but I am also new to the technology.

Is there a calibration to be performed? Am I expected to slap on 40 points for the ugly hack like the pros really do and its all really just one big lie? or are these sensors just junk?

How do I get correct humidity readings from a DHT11 sensor, or do I just need better quality gear?

The temp looks correct, humidity is not. Remotely accurate humidity readings are needed for my project.

UPDATE: Tried the 3rd and all 3 are identical in behavior. Same 40 point deficiency.

UPDATE #2:

I retried the Adafruit libraries using their test code and if I was residing on Venus, it would be dead on. But sadly I live on Earth and these readings won't help much either.

libraries and test code used

output:

在此处输入图片说明

UPDATE 3: I am attempting https://forum.mysensors.org/topic/126/calibrating-humidty If no additional updates, then either this worked or I bought something else.

LAST UPDATE: This is a CHEMISTRY issue, not a digital. The DHT11 get cut without any calibration. Solution? Swell the metal just a little. Salt aids in the oxidation process, just ask any boat. I mixed some thick salt water in a cup and suspended the sensor above the cup with a piece of paper without getting it directly wet, which also somewhat sealed/encased the sensor below cup lip level. With the sensor (and not the board) somewhat air tight, I allowed the salt water vapors to work at it for about 6 - 8 hours. On this humid day, it was still 18 points shy. So I heated the salt water a little because I'm impatient. That shot the humidity up from ~50% to 95% instantly. Let it sit for about an hour, sensor was still reporting high. After 1 hour it is now holding at about -3% off target. Which is fine.

The DHT11 has to be calibrated chemically (salt water) to become accurate...

FYI: calibration info

After the update I was certain that the Adafruit library is actually not working for you, just that you have not uncommented the right sensor definition.

It is like this in the example.

//#define DHTTYPE DHT11   // DHT 11
#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

Should be like this for DHT11

#define DHTTYPE DHT11   // DHT 11
//#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

This should give you humidity in the 30 to 40% range if DHT22 was giving you humidity in the 800% range.

I faced the same issue earlier.

The only conclusion you can derive at this point is that you have bad sensors.

I hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM