Initially DHT11 gives me around 1.50 C and 10% humidity. When I put my finger on sensor, these values go up. The problem is that after 2.50 C jumps at 1C and after 27% jumps at 1% and continue to go up.
A wiring diagram and code would help us debug your problem.
plus of sensor is connected at 5V
minus of sensor is connected at GND
OUT is connected at PIN 2
The code is the next one:
#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Error: Failed to read from sensor!");
delay(2000);
return;
}
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(6000);
}
Your code is not posted correctly
In the IDE click on Edit, then Copy for Forum, that will copy your code for the forum.
Then come back here and do a paste. You will see a difference on how the code is posted.
#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Error: Failed to read from sensor!");
delay(2000);
return;
}
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(6000);
}
I don't see anything wrong with the wiring or the code.
The DHT11 module may be faulty
