Temperature and Humidity Measuring using Arduino + DHT Sensor

Author: Shazin Sadakath


Oven, the somewhat correct word which can be used explain Sri Lankan climate at the moment. It becomes so hot during the day and somewhat similar in the nights. Sleeping is impossible without taking a shower. Ideal time to do a project to measure the Humidity and Temperature.

 

Had the DHT sensor and a 8x2 LCD (GDM0802A) lying around in my electronics collection and thought to put up a small project. 

 

Unfortunately the LCD didn't have pins so I had to do a bit of soldering. To be honest not the most experienced man when it comes to soldering, so was a bit worried to get started and going. But anyway went on with it and finally managed to do a pretty decent job with the hot iron and it came out well enough to work.

 

 

And managed to get the following schematic in place for the project. 

 

And a bit of Arduino coding to get the sketch done. 

#include 
#include 
#define DHT11_PIN 8   

dht DHT;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  lcd.begin(8, 2);
  Serial.begin(9600);
  lcd.clear();
}

void loop() {
  lcd.clear();
  Serial.print("DHT11, \t");
  int chk = DHT.read11(DHT11_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;
    case DHTLIB_ERROR_CONNECT:
        Serial.print("Connect error,\t");
        break;
    case DHTLIB_ERROR_ACK_L:
        Serial.print("Ack Low error,\t");
        break;
    case DHTLIB_ERROR_ACK_H:
        Serial.print("Ack High error,\t");
        break;
    default: 
        Serial.print("Unknown error,\t"); 
        break;
  }

  Serial.print(DHT.humidity, 1);
  Serial.print(",\t");
  Serial.println(DHT.temperature, 1);
  lcd.setCursor(0,0);
  lcd.print("Tem:");
  lcd.print((int) DHT.temperature);
  lcd.print("C");
  lcd.setCursor(0,1);
  lcd.print("Hum:");
  lcd.print((int) DHT.humidity);
  lcd.print("%");
  delay(2000);  
}

Finally the whole project in working mode.

 

And video of humidity changing when a cold water bottle is placed near.

References

  1. DHT Library - https://arduino-info.wikispaces.com/DHT11-Humidity-TempSensor
  2. GDM0802A Datasheet - https://www.robot-r-us.com/pololu/sensorlcd/532-gdm0802a-fl-ybw.html

 

 

 

 

 

 



Tags: Arduino DHTSensor
Views: 689
Register for more exciting articles

Comments

Please login or register to post a comment.


There are currently no comments.