DHT11 temperature sensor

hy,
I have a small problem using DH11, I got the sample code from the internet and when uploading it and looking at serial monitor I am getting -999 value for both temp and humidity

#include <dht.h>

dht DHT;

#define DHT11_PIN 8

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

void loop(){
int chk = DHT.read11(DHT11_PIN);
Serial.print("Temperature = ");
Serial.println(DHT.temperature);
Serial.print("Humidity = ");
Serial.println(DHT.humidity);
delay(1000);
}

It's long ago that I worked with the DTH. You can print the value of chk; from memory it's an error code that you can find back in the source code of the library. 0 would mean "no error".

Hello
Take a look into the IDE.
There you will find a example sketch named DHTtester to check your hardware.

Hi Blue10,

Did you mount a pull up resistor? A DHT11 needs 10k pull up.

Wiring scheme is available on (1) Bare DHT11 temperature and relative humidity sensor - Zonnestroompanelen in Nederland

success, Photoncatcher

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.