DHT11 reading at 0'C, 0% Humidity

Hi all, first time posting.

First project and I’ve been following along with a tutorial to get a DHT11 sensor reading temperature and humidity but I’ve hit a problem.

I’ve managed to get the code running, but the only readings I’m getting are Temp 0’C and Humidity 0%. The only possible problem I think I could possibly identify is the lack of a resistor or a faulty DHT11?

here is my set up:

(ScruffR: Removed irrelevant advertisement - please honor the forum rules. If you want to upload images just upload them directly here and not via “spamming” hosters)

Here is the code I’m running:

#include <Adafruit_DHT.h>

// DHT parameters
#define DHTPIN 5
#define DHTTYPE DHT11

// Variables
int temperature;
int humidity;

// DHT sensor
DHT dht(DHTPIN, DHTTYPE);

void setup() {
    
    // Start DHT sensor
    dht.begin();
}

void loop() {
    
    // Humidity measurement
    temperature = dht.getTempCelcius();
    
    // Humidity measurement
    humidity = dht.getHumidity();
    
    // Publish data
    Spark.publish("temperature", String(temperature) + " °C");
    delay(2000);
    Spark.publish("humidity", String(humidity) + "%");
    delay(2000);
    
}

This is the tutorial I’ve been following:

any suggestions would be greatly appreciated as I feel totally out of my depth
Thanks
AC

Please upload a photo to see your full circuit:

  • did you include the 4.7K resistor?
  • lets check the PIN wiring from DHT11

Did you copy the example code without manually include the Library?
#include <Adafruit_DHT.h>
Missing this: // This #include statement was automatically added by the Particle IDE.

It could be that the path is not correct:
#include "Adafruit_DHT/Adafruit_DHT.h"

Is the sensor in a cold room? :wink: