You are on page 1of 6

DEPARTMENT OF BIOTECHNOLOGY & MEDICAL ENGINEERING

NATIONAL INSTITUTE OF TECHNOLOGY, ROURKELA


COURSE: BM4701 Microprocessor and Microcontroller Laboratory

NAME:- ASHWANI SINGH ROLL NO. 117BM0731

EXPERIMENT-02

AIM: -
To detect surrounding temperature in the desired area using TMP36 temperature detector and
Arduino UNO on the LCD (16*2) screen.

COMPONENTS REQUIRED:-
1. Computer with working internet connection and tinkercad website supported browser
2. LCD screen (16*2)
3. Arduino Uno development board
4. TMP 36
5. Breadboard
6. 1 KΩ resistors
7. Potential meter
8. Wires
9. USB Power supply.

THEORY:-

LCD (16*2) Screen:


16×2 LCD is named so because; it has 16 Columns and 2 Rows. There are a lot of combinations
available like, 8×1, 8×2, 10×2, 16×1, etc. but the most used one is the 16×2 LCD. So, it will
have (16×2=32) 32 characters in total and each character will be made of 5×8 Pixel Dots. A
Single character with all its Pixels is shown in the below picture.
we know that each character has (5×8=40) 40 Pixels and for 32 Characters we will have
(32×40) 1280 Pixels. Further, the LCD should also be instructed about the Position of the
Pixels. Hence it will be a hectic task to handle everything with the help of MCU, hence
an Interface IC like HD44780is used, which is mounted on the backside of the LCD Module
itself. The function of this IC is to get the Commands and Data from the MCU and process
them to display meaningful information onto our LCD Screen.
LCD 16×2 Pin Diagram

The 16×2 LCD pinout is shown below.

 Pin1 (Ground/Source Pin): This is a GND pin of display, used to connect the GND terminal
of the microcontroller unit or power source.
 Pin2 (VCC/Source Pin): This is the voltage supply pin of the display, used to connect the
supply pin of the power source.
 Pin3 (V0/VEE/Control Pin): This pin regulates the difference of the display, used to connect
a changeable POT that can supply 0 to 5V.
 Pin4 (Register Select/Control Pin): This pin toggles among command or data register, used
to connect a microcontroller unit pin and obtains either 0 or 1(0 = data mode, and 1 =
command mode).
 Pin5 (Read/Write/Control Pin): This pin toggles the display among the read or writes
operation, and it is connected to a microcontroller unit pin to get either 0 or 1 (0 = Write
Operation, and 1 = Read Operation).
 Pin 6 (Enable/Control Pin): This pin should be held high to execute Read/Write process,
and it is connected to the microcontroller unit & constantly held high.
 Pins 7-14 (Data Pins): These pins are used to send data to the display. These pins are
connected in two-wire modes like 4-wire mode and 8-wire mode. In 4-wire mode, only four
pins are connected to the microcontroller unit like 0 to 3, whereas in 8-wire mode, 8-pins
are connected to microcontroller unit like 0 to 7.
 Pin15 (+ve pin of the LED): This pin is connected to +5V
 Pin 16 (-ve pin of the LED): This pin is connected to GND.

Fig 1. LCD Screen (16*2)


CIRCUIT DIAGRAM:

Fig 3. Circuit Diagram

PROCEDURE:

1. .Computer was turn on and internet was connected to it.

2. Tinkercad account was logged in that was provided by the presenter and named as our roll
number.

3. As per our aim circuit diagram was made in Tinkercad software.

4. After completing circuit diagram, coding was done as text in coding section.

5. Code was written as per our aim of the experiment.

6. After writing the code compiled it by pressing start simulation option and we could see the
temperature value in LCD Screen (16*2).
PROGRAMMING CODE:

#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int vin;
float analog_value;
float scaled_voltage;
float actual_voltage;
double temperature;
void setup()
{
Serial.begin(9600);
lcd.begin(16,2);
pinMode(vin,INPUT);
}
void loop()
{
vin = analogRead(A1);
analog_value = (float)vin/1024;
scaled_voltage = analog_value * 5;
actual_voltage = scaled_voltage - 0.5;
temperature = (double)actual_voltage * 100;
lcd.setCursor(0,1);
lcd.print("Tem(C)=");
lcd.print(temperature);
delay(1000);
if(temperature <=45 )//if temperature under of 45 degrees
{
lcd.setCursor(1,1);
lcd.clear();
lcd.print("switched off fan");
delay(1000);
}
else if(temperature >45)//if temperature is above 45 degrees
{
lcd.setCursor(1,1);
lcd.clear();
lcd.print("switched on fan");
delay(1000);
}
}
RESULT AND OBSERVATION:
a) Temperature (T)< 45:

Fig 4. Circuit diagram when (T<45)


 When Temperature is less than 45 then the value of temperature has been displayed on the
LCD screen and also written as “switched off fan”.

b) When Temperature (T)>45:

Fig 5. Circuit Diagram when (T>45)


 When Temperature is more than 45 then the value of temperature has been displayed on
the LCD screen and also written as “switched on fan”.

DISCUSSION:

1. TMP 36 sensor has three pins, in which two end pins are joined with bread board and
middle pin is joined with analog pin of Arduino.
2. Potential meter is used which has three pins one pin is connected to the 5v supply and
middle pin is connected to the ground and middle pin is connected to the LCD screen.
3. In coding section codes are written in c language and we can write the code in multi-
language as per our knowledge.
4. In this experiment one multimeter is used for surety that our circuit diagram is write or
wrong and without multimeter this experiment can be execute.
5. In this experiment one temperature value (45 degree C) is used that has two different
condition and this condition is executed by the programming code.

You might also like