Pages: [1]   Go Down
Author Topic: Grove - Humidity & Temperature sensor  (Read 2179 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 42
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Code:
#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!
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5145
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 42
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

That's what i'm looking for.

Thanks!
Logged

Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 502
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
http://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/Humidity/Sensirion_Humidity_SHT7x_Datasheet_V5.pdf
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13734
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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 - http://arduino.cc/playground/Main/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?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Between Heaven n Hell
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 502
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: