Invalid readings from DHT11 sensor

The red light only means that the sensor module is getting power.

There are a number of libraries for the DHT-11 sensor. The are not alike and code for one may not work with another. Only trust example code from the library that you have installed. Don't install multiple libraries with the same name.

You have not provided much information that we can use to help you. We usually need at least the code that you are having trouble with, a schematic or wiring diagram and technical data (data sheets) for components.

A diagram or schematic that is hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies.

Please read the how to get the most from the forum post. The post contains information on what we need to know in order to help you.


#include <dht11.h>
#define DHT11PIN 4

dht11 DHT11;

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

void loop()
{
  Serial.println();

  int chk = DHT11.read(DHT11PIN);

  Serial.print("Humidity (%): ");
  Serial.println((float)DHT11.humidity, 2);

  Serial.print("Temperature  (C): ");
  Serial.println((float)DHT11.temperature, 2);

  delay(2000);

}

i tried with this example code and my dht only sends 0 tem and humidity

The code will not compile. It is incomplete. It is missing the #include for a dht library, at least.

Which of the many dht libraries do you have installed? Please provide a link.

How was the library installed? With the IDE library manager or manually?

i found the code at this page

Hi,
Are you still using an 8266?

Is this the library you are using?
Read this link on how to install the library for ESP32 from Adafruit, you need two libraries.


#include <Adafruit_Sensor.h>
#include <DHT.h>

Post #1:

Post #9:

Post #25:

Check your wiring.

first post

picture in post #9

picture of post #23

You seem to change randomly to a different hardware without really describing it in your postings
What should I think about you? I have no idea what is the truth.
The only thing that is clear is that you do not take advice on how to communicate effectively .

Possible explanations for such a behaviour

  • beeing lazy in what info to post = un-intententioal trolling
  • mentally handicapped
  • intentional trolling

whatever is causing you to communicate like you communicate:
tips how to improve your posting style

best regards Stefan

@iceguy2022

Your duplicate topic created with a second account has been deleted and the second account has been permanently suspended

Any further violations of the forum policy of a similar nature will result in your account iceguy2022 account being suspended as well

I am not kidding

1 Like

At this point and I believe I saw mention of this earlier, add a 4.7 K Ohm resistor between your Data Out and Vcc. Some sensor boards include the 4.7 K pullup and some don't. Leave your code as is for the DHT 11 change made earlier.

Ron

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