Grove - Humidity & Temperature sensor

Hello everyone.I would like to help me if you could.
Well the problem is that i want to count temperature with accurate 1 digit.Ok until now?

I was looking Arduino's site and i found the dht11 and dht22 library.

#include <dht.h>
 
dht DHT;

 #define DHT22_PIN 16
 
void setup()
 {
   Serial.begin(9600);
   Serial.println("DHT TEST PROGRAM ");
   Serial.print("LIBRARY VERSION: ");
   Serial.println(DHT_LIB_VERSION);
   Serial.println();
   Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
 }
 
void loop()
 {
   // READ DATA
   Serial.print("DHT22, \t");
   int chk = DHT.read22(DHT22_PIN);
   switch (chk)
   {
     case DHTLIB_OK:  
                 Serial.print("OK,\t"); 
                break;
     case DHTLIB_ERROR_CHECKSUM: 
                Serial.print("Checksum error,\t"); 
                break;
     case DHTLIB_ERROR_TIMEOUT: 
                Serial.print("Time out error,\t"); 
                break;
     default: 
                Serial.print("Unknown error,\t"); 
                break;
   }
   // DISPLAY DATA
   Serial.print((float)DHT.humidity);
   Serial.print(",\t");
   Serial.println((float)DHT.temperature);
 
  delay(1000);

The dht11 library works fine but i don't have accurate result like:

23.5 C
28.7 C etc.

On the other hand dht22 works too but i'm taking results like :

e.g

Humidity %, Temperature C

1166.20 692.2
1484.60 716.8

Could you help me to corrext my problem please???

My Arduino is ATMEGA 2560

and my dht sensor is the Grove - Humidity & Temperature sensor v1

http://www.seeedstudio.com/wiki/Grove-_Temperature_and_Humidity_Sensor

An other test example which displays me the same result is the source code from this site:
http://www.ajpdsoft.com/modules.php?traducir=es-en&name=News&file=article&sid=572#programasensorarduino

I can't understand why dht22 lib displays these results.

Thanks a lot!

Although DHT11 and DHT22 are similar they are not the same. You cannot use a DHT22 library to read values from the DHT11 but also not a library which is for both and read the value for a DHT22 as you do in your posted code.

Hello again!
Is there a way which give me accuration to my temperature result???

That's what i'm looking for.

Thanks!

The accuracy spec of the Sensor you are using is shown as +- 2 D C, so its not a very accurate sensor.
If you want a more accurate answer you need a far better sensor such as a SHT75.

Although DHT11 and DHT22 are similar they are not the same. You cannot use a DHT22 library to read values from the DHT11 but also not a library which is for both and read the value for a DHT22 as you do in your posted code.

The lib here - Arduino Playground - DHTLib - supports both dht11 and dht22. It has separate read functions per sensortype which use the same handshake for the 5 bytes but interpret these differently.

Can you post actual output, including the CRC check output?

Hi sirus, can you give me the library you've used that works? because I've been trying many libraries & examples but didnt work.. I am using Grove Temperature & Humidity. Dont know what's wrong with either my sensor or the codes.

The DHT11 Sensor that you are using is a poor quality sensor that only has 1D resolution, so the best you can get
is readings like 22.0 D or 30.0 D .
You cant get fractional parts of the temperature.
You need a better sensor to get fractional readings, like a DHT22.
The DHT22 and the DHT11 are similar in pinout only, the decoding of the data is differant.