You are on page 1of 8

POST-LAB ESPUA (4109) ASSIGNMENT Date:

Aim of the Experiment: Experiment – 8


Interfacing of Temperature and humidity sensor (DHT 11) with Arduino uno and LCD.

Objective:

1) Introduction to Liquid Crystal Display (LCD). Interfacing LCD with Arduino.


2) To create and display custom characters in LCD using Arduino
3) Make a simple calculator with lcd display
4) Familiarization of Temperature and humidity sensor (DHT 11) and interfacing DHT11
with Arduino uno.
5) Interfacing of Temperature and humidity sensor (DHT 11) with Arduino uno and LCD.

Components/Equipment Required:

Sl No. Name of the Specification Quantity


Component/Equipement
1 Arduino UNO R3 16MHz 1
2 Arduino UNO cable USB Type A to B 1
3 Potentiometer 10k 1
4 LCD with bread board 16 x 2 1
connector (Presoldered
Male Header Pins)
5 Temperature and DHT11 1
Humidity sensor module
6 Breadboard 840 Tie points 1
7 Jumper Wire ----------------------- As per requirement

Circuit/Schematic Diagram:

Objective 1

EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)


Interfacing of Temperature and humidity sensor (DHT 11) with Arduino uno and LCD.
POST-LAB ESPUA (4109) ASSIGNMENT Date:
Experiment – 8

Objective 2

Objective 3

Code:

Objective 1
PART A
#include<LiquidCrystal.h>
LiquidCrystal Lcd(12,11,5,4,3,2);
int count;
void setup()
{
Lcd.begin(16,2);

}
void loop()
{
Lcd.setCursor(0,0);
Lcd.print("Hello World");
delay(1000);
EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)
Interfacing of Temperature and humidity sensor (DHT 11) with Arduino uno and LCD.
POST-LAB ESPUA (4109) ASSIGNMENT Date:
Lcd.setCursor(0,0); Experiment – 8
Lcd.print("I AM SHUBHAM");
delay(1000);
}
PARTB
#include<LiquidCrystal.h>
LiquidCrystal Lcd(12,11,5,4,3,2);
int count;
void setup()
{
Lcd.begin(16,2);
Lcd.print("I AM COUNTING");
}
void loop()
{
for(count = 1;count<10; count++)
{
Lcd.setCursor(0,1);
Lcd.print(count);
delay(1000);
}
}
Objective 2
#include<LiquidCrystal.h>
int rs = 12;
int eb = 11;
int d4 = 5;
int d5 = 4;
int d6 = 3;
int d7 = 2;
int delayTime = 1000;
LiquidCrystal Lcd = LiquidCrystal(rs,eb,d4,d5,d6,d7);

byte Heart[]={B00000, B01010,B11111,B11111,B01110, B00100, B00000, B00000};


byte Bell[]= {B00100, B01110, B01110, B01110,B11111,B00000, B00100, B00000};
byte Alien[]={B11111,B10101,B11111,B11111,B01110, B01010,B01010,B11011};
byte Check[] = {B00000, B00001, B00011, B10110, B11100, B01000,
B00000,B00000};
byte Speaker[]={B00001, B00011, B01111,B01111, B01111, B00011, B00001,
B00000};
byte Sound[]={B00001, B00011,B00101,B01001,B01001,B01011,B11011,B11000};
byte Skull[] = {B00000, B01110,B10101,B11011,B01110, B01110, B00000,
B00000};
byte Lock[] = {B01110,B10001,B10001,B11111,B11011, B11011,B11111,B00000};

void setup() {
Lcd.begin(16,2);
Lcd.createChar(0,Heart);
Lcd.createChar(1,Bell);
Lcd.createChar(2,Alien);
Lcd.createChar(3,Check);
Lcd.createChar(4,Speaker);
Lcd.createChar(5,Sound);
Lcd.createChar(6,Skull);
Lcd.createChar(7,Lock);
Lcd.clear();
Lcd.print("CUSTOM CHARACTER");
}
void loop() {
Lcd.setCursor(0,1);
Lcd.write(byte(0));
EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)
Interfacing of Temperature and humidity sensor (DHT 11) with Arduino uno and LCD.
POST-LAB ESPUA (4109) ASSIGNMENT Date:
Lcd.setCursor(2,1); Experiment – 8
Lcd.write(byte(1));
Lcd.setCursor(4,1);
Lcd.write(byte(2));
Lcd.setCursor(6,1);
Lcd.write(byte(3));
Lcd.setCursor(8,1);
Lcd.write(byte(4));
Lcd.setCursor(10,1);
Lcd.write(byte(5));
Lcd.setCursor(12,1);
Lcd.write(byte(6));
Lcd.setCursor(14,1);
Lcd.write(byte(7));

}
Objective 3
#include<LiquidCrystal.h>
int rs = 12;
int eb = 11;
int d4 = 5;
int d5 = 4;
int d6 = 3;
int d7 = 2;
int delayTime = 1000;
LiquidCrystal Lcd = LiquidCrystal(rs,eb,d4,d5,d6,d7);
int firstNum;
int secNum;
int answer;
String op;
void setup() {
Lcd.begin(16,2);
Serial.begin(9600);
}
void loop() {
Lcd.setCursor(0,0);
Lcd.print("IN First Num");
Serial.println("IN First Num");
while(Serial.available()==0)
{
}
firstNum = Serial.parseInt();
Lcd.clear();

Lcd.setCursor(0,0);
Lcd.print("IN Sec Num");
Serial.println("Input Sec Num");
while(Serial.available()==1)
{
}
secNum = Serial.parseInt();
Lcd.clear();

Lcd.setCursor(0,0);
Lcd.print("+,-,*,/");
Serial.println("+,-,*,/");
while(Serial.available()==1)
{
}
op = Serial.readString();
Lcd.clear();
if(op=="+")
{
EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)
Interfacing of Temperature and humidity sensor (DHT 11) with Arduino uno and LCD.
POST-LAB ESPUA (4109) ASSIGNMENT Date:
answer = Experiment – 8
firstNum + secNum;
}
if(op=="-")
{
answer = firstNum - secNum;
}
if(op=="*")
{
answer = firstNum * secNum;
}
if(op=="/")
{
answer = firstNum / secNum;
}
Lcd.clear();
Lcd.setCursor(0,0);
Lcd.print(firstNum);
Serial.print(firstNum);
Lcd.print(op);
Serial.print(op);
Lcd.print(secNum);
Serial.print(secNum);
Lcd.print("=");
Serial.print("=");
Lcd.print(answer);
Serial.print(answer);
Serial.println();
Lcd.setCursor(0,1);
Lcd.print("DHANIYAWAD");

delay(delayTime);
}

Objective 4
#include "DHT.h"
#define Type DHT11
int sensePin=2;
DHT HT(sensePin,Type);
float humidity;
float tempC;
float tempF;
int setTime=500;
int dt=1000;
void setup() {
// put your setup code here, to run once: Serial.begin(9600);
HT.begin(); delay(setTime);
}
void loop() {
humidity=HT.readHumidity();
tempC=HT.readTemperature();
tempF=HT.readTemperature(true);
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print("% Temperature ");
Serial.print(tempC);
Serial.print(" C ");
Serial.print(tempF);
Serial.println(" F ");
delay(dt);
}
EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)
Interfacing of Temperature and humidity sensor (DHT 11) with Arduino uno and LCD.
POST-LAB ESPUA (4109) ASSIGNMENT Date:
Experiment – 8
Objective 5

#include "DHT.h"
#define Type DHT11
#include <LiquidCrystal.h>
int rs=7;
int en=8;
int d4=9;
int d5=10;
int d6=11;
int d7=12;
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
int sensePin=2;
DHT HT(sensePin,Type);
float humidity;
float tempC;
float tempF;
int setTime=500;
int dt=1000;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
HT.begin();
delay(setTime);
lcd.begin(16,2);
}
void loop() {
humidity=HT.readHumidity();
tempC=HT.readTemperature();
tempF=HT.readTemperature(true);
lcd.setCursor(0,0);
lcd.print("Temp F= ");
lcd.print(tempF);
lcd.setCursor(0,1);
lcd.print("Humidity= ");
lcd.print(humidity);
lcd.print(" %");
delay(500);
lcd.clear();
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print("% Temperature ");
Serial.print(tempC);
Serial.print(" C ");
Serial.print(tempF);
Serial.println(" F ")
}

EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)


Interfacing of Temperature and humidity sensor (DHT 11) with Arduino uno and LCD.
POST-LAB ESPUA (4109) ASSIGNMENT Date:
Experiment – 8
Observation:
Objective 1

Objective 2

EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)


Interfacing of Temperature and humidity sensor (DHT 11) with Arduino uno and LCD.
POST-LAB ESPUA (4109) ASSIGNMENT
Experiment – 8

Objective 3

Objective 4

Objective 5

EMBEDDED SYSTEM PROJECT USING ARDUINO (EET 4109)


Interfacing of Temperature and humidity sensor (DHT 11) with Arduino uno and LCD.

You might also like