Devices & Components
Arduino Uno Rev3
9V Battery Clip
Male/Male Jumper Wires
9V battery (generic)
Male/Female Jumper Wires
Trimmer Potentiometer, 10 kohm
DHT11 Temperature & Humidity Sensor (3 pins)
RGB Backlight LCD - 16x2
Software & Tools
Arduino IDE
Project description
Code
My LC displays temp & humidity rate
arduino
code for displaying temperature and humidity from DHT-11
1#include <SimpleDHT.h> 2 3// for DHT11, 4// VCC: 5V or 3V 5// GND: GND 6// DATA: 2 7int pinDHT11 = 2; 8SimpleDHT11 dht11; 9 10// include the library code: 11#include <LiquidCrystal.h> 12 13// initialize the library with the numbers of the interface pins 14LiquidCrystal lcd(7, 8, 9, 10, 11, 12); 15 16void setup() { 17 // set up the LCD's number of columns and rows: 18 lcd.begin(16, 2); 19} 20 21void loop() { 22 23 // read with raw sample data. 24 byte temperature = 0; 25 byte humidity = 0; 26 byte data[40] = {0}; 27 if (dht11.read(pinDHT11, &temperature, &humidity, data)) { 28 lcd.print("Read DHT11 failed"); 29 return; 30 } 31 32 for (int i = 0; i < 40; i++) { 33 if (i > 0 && ((i + 1) % 4) == 0) { 34 35 } 36 } 37 38 lcd.print("temp.: ");lcd.print((int)temperature); lcd.print(" *C "); 39 lcd.setCursor(0,2);lcd.print("humidite: ");lcd.print((int)humidity); lcd.println(" % "); 40 41 // DHT11 sampling rate is 1*10-² HZ. 42 delay(100000);lcd.clear(); 43}
Downloadable files
Breadboarding
Fritzing image of project
Breadboarding

Breadboarding
Fritzing image of project
Breadboarding

Documentation
Wiring
Using fritzing program
Wiring

Wiring
Using fritzing program
Wiring

Comments
Only logged in users can leave comments