adafruit / adafruit/DHT-sensor-library

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

Open
#195 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.2k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

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
#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);
}

Contributor guide

Open the contributing guide

Research direction

Start with setup(), loop(), and the dht.readHumidity() and dht.readTemperature() calls in the supplied sketch. Reproduce the DHT22 reading with the ESP32 DEVKIT C at the reported 3.3V and 5V configurations; done means identifying a reproducible library issue or documenting that the discrepancy is outside the library.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.