Help: DHT11 Temperature and Humidity Sensor values displaying 0

Hi everyone,

I'm trying to get into Arduino, this will be one little piece of a project I'm working on. I'm trying to get the DHT11 sensor (3 pin) to work to measure environmental temperature and humidity but once I open the Serial Monitor, all I get is
"Current humidity = 0.00% temperature = 0.00C"

Asking for assistance on this one, I've tried looking into the different forums and trying different codes with no luck. I'm following this tutorial this tutorial. Please help!
Could this be an issue with the sensor itself?

Here is the code I'm currently using:

#include <dht.h>


#define dht_apin A0 // Analog Pin sensor is connected to
 
dht DHT;
 
void setup(){
 
  Serial.begin(9600);
  delay(500);//Delay to let system boot
  Serial.println("DHT11 Humidity & temperature Sensor\n\n");
  delay(1000);//Wait before accessing Sensor
 
}//end "setup()"
 
void loop(){
  //Start of Program 
 
    DHT.read11(dht_apin);
    
    Serial.print("Current humidity = ");
    Serial.print(DHT.humidity);
    Serial.print("%  ");
    Serial.print("temperature = ");
    Serial.print(DHT.temperature); 
    Serial.println("C  ");
    
    delay(5000);//Wait 5 seconds before accessing sensor again.
 
  //Fastest should be once every two seconds.
 
}// end loop(

should you have

  dht.begin();

in setup()

Hi,
The link in your post doesn't seem to work so I do not know which library you are using for the dht11.
This is a good site for help/information:

1 Like

I was referring to this reference but it was actually my sensor that was completely shot. I got a DHT22 and it's working now! Thanks!

1 Like
DHT dht(DHTPIN, DHT11);     // Create Object

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