Go Down

Topic: Problem with DHT11 (Read 86 times) previous topic - next topic

teodorandrei

Apr 25, 2019, 07:21 pm Last Edit: Apr 25, 2019, 07:23 pm by teodorandrei
Hello. I am using a DHT11 sensor to measure temperature and humidity, but it doesn't work. Sometimes it shows the correct values, sometimes it shows -999 for both temperature and humidity. I posted my circuit and code below:




Code: [Select]
#include <dht.h>

dht DHT;

#define DHT11_PIN 7

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

pylon

You need a 10k pull-up resistor to Vcc for the data signal.

larryd

Believe there is a 10k PU resistor on the left side of the DHT11 PCB.

We need to see OP's actual wiring image.


No technical PMs.
The last thing you did is where you should start looking.

Go Up