DHT-sensor-library
DHT-sensor-library copied to clipboard
Measured temperature is about 7-8 degrees(in Celsius) less than the real temperature
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?
-
board: ESP32 DEVKIT C
-
Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.19
CODE:
#include <DHT.h> #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); }
What is measuring 18 degrees? How close together is that device and the DHT22?