Lab5 CSE3006 Kushagra Srivastava 19BCE1003

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

School of Electronics Engineering (SENSE)

B.Tech – Electronics & Comunication


Engineering

CSE3006 – EMBEDDED SYSTEM


DESIGN LAB RECORD
(L29+L30)
Submitted By
19BCE1003 -

Submitted To
Prof. Bala Murugan MS

Lab 5
1
19BCE1003
Task 1-
Aim:
Write an arduino program in tinkercad to interface to LCD by using the LCDcrystal library
and print "Welcome to VIT" in 1st line and "Embedded Lab" in 2nd line

API Required-
1. Arduino Uno R3
2. LCD 16X2
3. Breadboard
4. Wires

Program-
#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
void setup()
{
lcd.begin(16,2);
}

void loop()
{
lcd.setCursor(0,0);
lcd.print("Welcome to VIT");
lcd.setCursor(0,1);
lcd.print("Embedded Lab");
}

Output-

2
19BCE1003
Before Simulation-

After Simulation-

Tinkercad Link-
3
19BCE1003
https://www.tinkercad.com/things/jVTyakDDtjj-cse3006lab5q1/editel?
sharecode=Y_3jVJ8MpW5184iYG5DKF0w-a5jH21MO5SAFpUaT0LA

Inference-
I understood how to interface 16X2 LCD to Arduino and also gain information about various
pins in lcd and their connections. Gained information on LiquidCrystal.h library and its
various functions like lcd.begin(), lcd.setCursor() and lcd.print()

Result-
We have successfully interface the LCD with Arduino and printed the required text on LCD.

Task 2-
Aim:
Write an arduino program in tinkercad to interface an LCD, TMP 36 (Temperature sensor)
and Potentiometer. Read the temperature value and print it int the LCD screen and also vary
the backlight using the potentiometer.

API Required-
1. Arduino Uno R3
2. Breadboard
3. Wires
4. LCD 16X2
5. Temperature Sensor
6. Potentiometer

Program-
#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
float a, b, temperature;
void setup()
{

4
19BCE1003
lcd.begin(16,2);
}

void loop()
{
lcd.setCursor(0,0);
a=analogRead(A0);
a=a*5;
b=a/1024;
temperature=(b-0.5)*100;
lcd.print(temperature);
}

Output-
Before Simulation-

After Simulation-

5
19BCE1003
Tinkercad Link-
https://www.tinkercad.com/things/juvqElLr267-cse3006lab5q2/editel?
sharecode=GilQ16KZD2F-fOsLwmnsr92vAye7u0nTQ17flG_LvjI

Inference-
I understood how to read and send temperature sensor data to lcd for print and also learnt
how to vary the contrast of backlit of LCD using a potentiometer.

Result-
We have successfully print the temperature obtained by temperature sensor to LCD and
also varied the backlit of LCD using potentiometer.

Task 3 (Challenging Task)-

6
19BCE1003
Aim:
Write an arduino program in tinkercad to build a home alert system. Interface arduino to
LCD by using the LCDcrystal library. Connect temperature, LED and PIR Sensor. If there is
person walking into the home switch on the fan(LED) and print in the 1st row of the LCD
that a person has come in to the home. If there is no person present in home the LCD
should print that no one is present in the first row. Also print the temperature of the home
in the 2nd row of the LCD.

API Required-
1. Arduino Uno R3
2. Breadboard
3. Wires
4. LCD 16X2
5. Temperature Sensor
6. PIR Sensor
7. Resistor
8. LED

Program-
#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);

void setup()
{
lcd.begin(16,2);
pinMode(13,INPUT);
pinMode(7,OUTPUT);
}

void loop()
{
int val=digitalRead(13);
float a,b,temperature;
a=analogRead(A0);
a=a*5;
b=a/1024;
temperature=(b-0.5)*100;
lcd.setCursor(0,0);
if(val==HIGH){
digitalWrite(7,HIGH);
lcd.print("A Person has come in to the home");
lcd.setCursor(0,1);
lcd.print("Temperature = "+String(temperature));
}

7
19BCE1003
else{
digitalWrite(7,LOW);
lcd.print("No one is present");
lcd.setCursor(0,1);
lcd.print("Temperature = "+String(temperature));
}
delay(10);
}

Output-
Before Simulation-

After Simulation-

8
19BCE1003
Tinkercad Link-
https://www.tinkercad.com/things/53QO9rJfhHr-cse3006lab5q3/editel?
sharecode=QcFo9HNgfMHjxdvHZU-k3hYkX2NHp_PKw1JQwKGfy70

Inference-
I understood how to read PIR Sensor value and then send the commands to print on LCD
and to light up the LED.

Result-
9
19BCE1003
We have successfully build a home alert system which alert the user if a person is sensed in
the region of detection of PIR Sensor and thus printing its status on the LCD also providing
the current temperature of the room given by the temperature sensor on LCD.

10
19BCE1003

You might also like