adafruit / DHT-sensor-library

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

Measured temperature is about 7-8 degrees(in Celsius) less than the real temperature #195

Open abattya opened 2 years ago

abattya commented 2 years ago

Hello, the code works for me, but i measure around 24-25 Celsius, but there is only 18 degress here. I use 3.3V supply(but i also tried with 5V) and a 10k resistor between data and VCC. What can I do?

CODE:

include

define DHTPIN 4

define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE);

float h = 0; float t = 0;

void setup() { Serial.begin(9600); dht.begin();

}

void loop() {

if (isnan(h)) { Serial.println("Failed to read Humidity from DHT sensor!"); return; }

if (isnan(t)) { Serial.println("Failed to read celsius from DHT sensor!"); return;

} h= dht.readHumidity(); t= dht.readTemperature();

Serial.print(F("Humidity: ")); Serial.print(h); Serial.print("°% "); Serial.print(F("Temperature: ")); Serial.print(t); Serial.println("°C ");

delay(3000); }

caternuson commented 1 year ago

What is measuring 18 degrees? How close together is that device and the DHT22?