DHT11 sensor problem

Hello .I have a problem with DHT11 sensor (temperature and humidity sensor).
In serial monitor ,I get 0.00 C for temperature and 0.00 % for humidity. <<<-------

The connections is good(the blue plastic of the sensor is UP and in the right position I have GND ,left I have the pin 7 and in the middle I have the VCC.

CODE:

#include "dht.h"

dht DHT;

const int temperature_humidity_sensor = 7;
unsigned long prev_Millis_temperature_humidity = 0;


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



void TEMPERATURE_HUMIDITY_SENSOR()
{
  unsigned long current_Millis_temperature_humidity = millis();
  if (current_Millis_temperature_humidity - prev_Millis_temperature_humidity >= 1000)
  {
    DHT.read11(temperature_humidity_sensor);
    float t = DHT.temperature;
    float h = DHT.humidity;
    Serial.print("Temperature : ");
    Serial.print(t);
    //Serial.print((char)223);
    Serial.println(" C");
    Serial.print("Humidity : ");
    Serial.print(h);
    Serial.print(" %");
    Serial.print("\n\n");
    prev_Millis_temperature_humidity = current_Millis_temperature_humidity;
  }
}


void loop()
{
TEMPERATURE_HUMIDITY_SENSOR();
}

Thanks...

Which DHT library are you using ?
Did it come with any examples ?

In my DHT sketches I have
DHT dht(7, DHT11); to create the dht object on pin 7

and
  dht.begin();to start the instance

I note that you have neither

I have download dht.h library from here: https://www.brainy-bits.com/dht11-tutorial/

Try the one from the library manager in the IDE....

(Or maybe it's just cold and dry where you are and the values are right :wink: )

Ok ,I will try it.

(Hahaha ,I do not think so.I'm from Greece.)

OK. That is a different library that the one I am using

the blue plastic of the sensor is UP and in the right position I have GND ,left I have the pin 7 and in the middle I have the VCC.

That is not how the pins are laid out on the sensor that I have or the one pictured in the tutorial that you linked to.

Check your wiring carefully. If you are using a breadboard check that the power strips on it does not have breaks in them in the centre. Many do

According to the instructions in the library in the IDE, these are the connections, which differ from yours. But then maybe although the chip's connections would all be the same, breakout board modules may differ in how they bring those to the edge.

// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

Nothing.
It is showing only 0.00 prices...

What led you to wire it the way you did? Is yours marked like that?

Provide a link or photo maybe....

Your pinouts do not seem right for a DHT11. I would expect the data pin to be middle pin.

It looks to me as though the instructions in the library refer to the pins on the bare DHT11, which has 4 pins (one of which is not used), whereas the image in the project is of a module board which has 3 pins.

Either way the far left and far right pins are 5V and GND respectively

Do you have a bare sensor (4 pins) or a module (3 pins) ?

The sensor I have has 3 pins.
I followed a circuit and a code that I saw in a site ,but I get only 0.00 prices

Any advices

arduiNICK:
The sensor I have has 3 pins.
I followed a circuit and a code that I saw in a site ,but I get only 0.00 prices

Any advices

OP,

Many of us suspect that the wiring is wrong. We need to see this DHT11 or please provide a link to this device.

This is my physical DHT11 sensor

, and it works fine.

I connect--
5V at Vcc-pin.
A0 channel with DATA-pin (the signal pin located at the middle).
GND at GND-pin.

Ok the description of how you wired it lead me to think that you had the data pin connected to VCC.

The DHT11 is one of the simpler devices one can use, this is why it is in just about every starter kit I have seen.

So assuming that VCC, Ground, and Data are connected correctly, we now have to determine if the sensor is faulty. Is that the only DHT11 you have?