DHT11 gives only 0% humidity en 0°C

Hello,

I’m a newbe and from Belgium(dutch). Sorry if my English is not that perfect.
For a schoolproject I’m trying to read out the Humidity and Temperature of my conseratory with LCD and alarm. Sadely I’m only on the piece of coding the DHT11 and all ready on mealtdown.

The humidity and temperature is coming in to com5 very well and in dutch but it only gives me a read out of 0% humidity and 0°C temperature. And I’ve tryed 2 DHT11 both the same read out. I don’t think they’re broken but I really don’t now what to do. Plus I have only until monday to give my project.

This is my code.

//Adjusted programma to read out in NL by MaDe

//Use the DHT Adafruit lib
#include “DHT.h”

//DHTpin11 connect to arduinopin2
#define DHTPIN 2

//Type of DHT sensor
#define DHTTYPE DHT11

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

void setup() {
//We will use the serialmonitor to read out
Serial.begin(9600);
Serial.println(“Vochtigheid en Temperatuur”)

//Start the sensor
;dht.begin();
}

void loop() {
//Waiting a few seconds to start up
delay(2000);

//Read Humidity
float h = dht.readHumidity();

//Read Temperature
float t = dht.readHumidity();

//Send data
Serial.print("Vochtigheid: “);
Serial.print(h);
Serial.print(”% Temperatuur: ");
Serial.print(t);
Serial.println(“°C”);
}

Look carefully.

1 Like

If your wire connection is OK try with different library. very simple libraries are available.

1 Like

Thanks you but not the solution.

Have you corrected the problem noted in reply #2 ?

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled “How to use this Forum”.

To add code please click this link;

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Have you got the 4K7 pullup resistor on the DHT11 signal wire?

Thanks… Tom… :smiley: :+1: :coffee: :australia:

1 Like

thank you but still after trying 3 library’s no other result, sadly

//Adjusted programma to read out in NL by MaDe

//Use the DHT Adafruit lib
#include “DHT.h”

//DHTpin11 connect to arduinopin2
#define DHTPIN 2

//Type of DHT sensor
#define DHTTYPE DHT11

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

void setup() {
//We will use the serialmonitor to read out
Serial.begin(9600);
Serial.println(“Vochtigheid en Temperatuur”)

//Start the sensor
;dht.begin();
}

void loop() {
//Waiting a few seconds to start up
delay(2000);

//Read Humidity
float h = dht.readHumidity();

//Read Temperature
float t = dht.readTemperature();

//Send data
Serial.print("Vochtigheid: “);
Serial.print(h);
Serial.print(”% Temperatuur: ");
Serial.print(t);
Serial.println(“°C”);
}

PIN “-” DHT11 to PIN arduino “GND”
PIN “S” DHT11 to PIN arduino “5V”
PIN in the middle to PIN arduino “DIGITAL 2”

Hi,

Have you got the 4K7 pullup resistor on the DHT11 signal wire?

Please a circuit diagram, draw your diagram and post an image of it.

Tom… :smiley: :+1: :coffee: :australia:

1 Like

I hope it’s good…
Newbe-action :sweat_smile: :wink: :+1: :beer: :belgium:

On the module I have here, Pin 1 is VCC (5V). then GND, then DOUT (Signal).
Swap over your middle and orange wires, and report back.

Hi,
DHT11 pinout;
DHT11–Temperature-Sensor-Pinout

Tom… :smiley: :+1: :coffee: :australia:

Hi,

For the ,I dunno how many times, have you got a 4k7 resistor between signal and 5V? ? ?

Tom… :smiley: :+1: :coffee: :australia:

1 Like

He/She appears to have a DHT module rather than a bare DHT. The sole purpose of such modules is to remove the need to add your own resistor and to make the wiring simpler

Hi,
Have you tried removing the shield and plugging everything directly into the UNO?

Tom… :grinning: :+1: :coffee: :australia:

no, but I don’t have the tools or knowledge

Pull the shield off the Uno

Plug the Vcc pin of the sensor into the Uno 5V socket
Plug the Ground pin of the sensor into one of the Uno GND sockets
Plug the sensor Data pin into the Uno pin 2 socket

Power the Uno and open the serial monitor
What do you see ?

Hello guys, Thanks for the help. A other student helpt me out. Everything was okay but my breadboard was shorted out . A total bar of + & - thats why it was not working and shorted out. + I put a pin in dubble gnd. :smiley: oops . Sorry Guys. But loved the in put. Thank you

Hi,

GND is the fourth socket along, I cannot see anything connected to the fourth socket, the orange lead looks like it is plugged into D13.

Tom… :grinning: :+1: :coffee: :australia: