dht11 and Arduino Uno

Is not first with this problem but i can not find solution.

I take code from this link:

this is error:

Read failFailed to read from DHT
Humidity: 0.00 % Temperature: 0.00 *C
Humidity: 0.00 % Temperature: 0.00 *C
Humidity: 0.00 % Temperature: 0.00 *C

I think you need to post YOUR code and a photo of how you have it all connected.

Telling us where you got the code from doesn't tell us that you copied it completely and correctly!

Okey,

this is program code

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain

#include "DHT.h"

#define DHTPIN 2     // what pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT11   // DHT 11 
//#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +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

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600); 
  Serial.println("DHTxx test!");
 
  dht.begin();
}

void loop() {
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  // check if returns are valid, if they are NaN (not a number) then something went wrong!
  if (isnan(t) || isnan(h)) {
    Serial.println("Failed to read from DHT");
  } else {
    Serial.print("Humidity: "); 
    Serial.print(h);
    Serial.print(" %\t");
    Serial.print("Temperature: "); 
    Serial.print(t);
    Serial.println(" *C");
  }
}

thanks

i have some problem with picture, i hope now is okey

I don't know who's module you are using, but ground is normally the fourth pin - pin three has no connection.

The Data sheet (in Chinese!), http://www.adafruit.com/datasheets/DHT11-chinese.pdf - look at the diagram on page 2 and check against your module.

i can not find data sheet but my modul have 3 pins only.

that is mine!

Hmm! I can't find a lot out about that. I can guess how the pins are connected but that's not always a good idea. Do you have a multimeter to confirm how they are connected?

However, I would suspect that the resistor on the board means that you don't need to add one - the one you have between pins 1 and 2, so you can remove that.

Which version of the IDE are you using?

Do you get any errors when you compile the program? I have downloaded it and it compiles and works with a plain DHT11, but I am using 0022!

there must be a delay of 2 seconds between readings

void loop()
{
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)

  delay(2000);

  float h = dht.readHumidity();
  float t = dht.readTemperature();

  // check if returns are valid, if they are NaN (not a number) then something went wrong!
  if (isnan(t) || isnan(h)) 
  {
    Serial.println("Failed to read from DHT");
  } else {
    Serial.print(millis());
    Serial.print("\t");
    Serial.print("Humidity: "); 
    Serial.print(h);
    Serial.print(" %\t");
    Serial.print("Temperature: "); 
    Serial.print(t);
    Serial.println(" *C");
  }
}

furthermore the DHT11 does return integers, no floats (but that cannot cause the problem)

you can try my DHT lib, it tells something about error conditions if they occur - Arduino Playground - DHTLib -

I find the problem, wired is wrong. I set 5V on first pin but he is signal pin,

this is good pictures.

thanks everyone, now i will test more and enjoy.

Not the order I would have guessed, but looking at it now one pin is marked 'S' (signal?) and another '-' (ground?).