Hey people, are you ok ? I hope so !
I have a DHT11 Module sensor and there is a very big difference in the measured values.
For example:
Humidity: 17% when it is 93% actually.
Temperature: 21 C when it's actually 13.
Is there any way to get closer?
Here is my current sketch:
#include "DHT.h"
#define DHTPIN A1 // pino que estamos conectado
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
Serial.begin(9600);
Serial.println("DHTxx test!");
dht.begin();
}
void loop()
{
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(t) || isnan(h))
{
Serial.println("Failed to read from DHT");
}
else
{
Serial.print("Umidade: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperatura: ");
Serial.print(t);
Serial.println(" *C");
delay(5000);
}
}
temp_hum.ino (578 Bytes)
The best way to get better readings is to get a halfway decent sensor. The DHT11 can hardly be called a toy, it's pretty hopeless. Even the DHT22 will give you much better results, and then of course there are the venerable BME280 for humidity and pressure, and the DS18B20 for temperature..
DHT 11:
Relative Humidity
Resolution:16Bit
Repeatability:±1%RH
Accuracy:25℃ ±5%RH
Interchangeability:Fully interchangeable
Response time:1/e (63%)25℃ 6s
1m/s Air 6s
Hysteresis:<±0.3%RH
Long-term stability:<±0.5%RH/yr
Not really very good considering a RH of 75% can read anywhere between 70% & 80% and be in tolerance. If you want to be able to check sensors of RH for accuracy learn about Saturated Salt solutions for RH.
"Humidity: 17% when it is 93% actually".
How were you measuring the 93%?
Ron
Just realised that 93% humidity is out of range of what the DHT11 can measure, which is 20-90%.