Sunday, 9 October 2016

*4 WEEK : DHT11 Coding and Circuit

So, for this week, i looking for the basic coding for my DHT11, and there it is;

#include <dht.h>
#include <LiquidCrystal.h>

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

dht DHT;

#define DHT11_PIN 7

void setup(){
  lcd.begin(16, 2);
}

void loop()
{
  int chk = DHT.read11(DHT11_PIN);
  lcd.setCursor(0,0);
  lcd.print("Temp: ");
  lcd.print(DHT.temperature);
  lcd.print((char)223);
  lcd.print("C");
  lcd.setCursor(0,1);
  lcd.print("Humidity: ");
  lcd.print(DHT.humidity);
  lcd.print("%");
  delay(1000);
}


This coding is for displaying the reading of DHT11 sensor to LCD Display. n i had build up the circuit but unfortunately there is wrong connection that i made that cause the damage of sensor, which i connect the GND and VSS in wrong port.



The reading displayed was as shown. To double confirm this damage condition of sensor, i had try to run the system on the Arduino and observe the reading on the Serial Monitor of Arduino software.



The reading was remain the same. So i need to find the new DHT11. But i was satisfied, because at least i had knew the basic coding to displaying the reading data of DHT11.

No comments:

Post a Comment