adafruit / DHT-sensor-library

Arduino library for DHT11, DHT22, etc Temperature & Humidity Sensors
https://learn.adafruit.com/dht
MIT License
1.97k stars 1.43k forks source link

DHT22 sensor showing abnormally high reading #170

Closed SheetLightning closed 3 years ago

SheetLightning commented 3 years ago

Thank you for opening an issue on an Adafruit Arduino library repository. To improve the speed of resolution please review the following guidelines and common troubleshooting steps below before creating the issue:

If you're sure this issue is a defect in the code and checked the steps above please fill in the following fields to provide enough troubleshooting information. You may delete the guideline and text above to just leave the following details:

The problem is that the DHT22 seems to be showing a wildly different and much higher readings to the DHT11. In an average dry home office environment the DHT11 shows 17% while the DHT22 shows 65.1%. I have tried two different DHT22 units and library versions 1.3.10 as well as the later 1.4.0. Both have the same problem.

To reproduce the issue just connect both sensors and connect to the serial port for a printout of the readings for each sensor.

NOTE: I logged this earlier but it seems to have disappeared! Logging it again but apologies for any duplicate should it show up twice due to delay!

Sketch (for UNO):

`#include

// UNO

define DHTPIN22 12

define DHTPIN11 11

// ESP8266 //#define DHTPIN 0

// Sensor DHT dhtSensor11(DHTPIN11, DHT11); DHT dhtSensor22(DHTPIN22, DHT22);

float currentTemperatureDht22; float currentHumidityDht22;

float currentTemperatureDht11; float currentHumidityDht11;

void setup() { // put your setup code here, to run once:

// Setup serial port Serial.begin(115200);

// Enable sensors dhtSensor22.begin(); dhtSensor11.begin();

}

void loop() { // put your main code here, to run repeatedly:

// Read the sensor(s) currentTemperatureDht22 = dhtSensor22.readTemperature(); currentHumidityDht22 = dhtSensor22.readHumidity();

currentTemperatureDht11 = dhtSensor11.readTemperature(); currentHumidityDht11 = dhtSensor11.readHumidity();

// Print result to serial Serial.print(F("DHT22: ")); Serial.print("\t"); Serial.print(F("Temp (°C): ")); Serial.print(currentTemperatureDht22, 2); Serial.print("\t"); Serial.print(F("Humidity (%): ")); Serial.print(currentHumidityDht22, 2); Serial.println();

Serial.print(F("DHT11: ")); Serial.print("\t"); Serial.print(F("Temp (°C): ")); Serial.print(currentTemperatureDht11, 2); Serial.print("\t"); Serial.print(F("Humidity (%): ")); Serial.print(currentHumidityDht11, 2); Serial.println();

Serial.println();

delay(1000);

}`

ladyada commented 3 years ago

contact your electronics supplier tech support for assistance! no one else has this issue, so it is probably your setup