0% found this document useful (0 votes)
19 views

Embedded Systems

Uploaded by

sulerohit11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Embedded Systems

Uploaded by

sulerohit11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

e-ISSN: 2582-5208

International Research Journal of Modernization in Engineering Technology and Science


Volume: 02/Issue: 07/July-2020 www.irjmets.com

TEMPERATURE MONITORING SYSTEM USING LM35 AND PIC


MICROCONTROLLER
Mya Thandar Phyu*1, Nan Myint Myint Htwe*2, Nan Sandar Thin*3
*1,2,3
FCST(Hpa-An), kayin, FCST(Thaton),Mon, FCST(Hpa-An), kayin, Myanmar.

ABSTRACT
Today, with the development of industry, overheating and fire can occur in the industrial environment, so it is
important to check and control the temperature. Sensors are widely used to measure temperature. Normally,
temperature conversation, temperature sensor with the same voltage. The IC LM35 is one such sensor. This
paper presents a simple temperature check system depends on the LM35 sensor and PIC16F877A
microcontroller. This system displays the temperature obtained by measuring the temperature on a 16x2 LCD.
In this paper, Proteus software is used for simulation and programming language is Micro C.
KEYWORDS: LM35, PIC16F877A, 16x2 LCD, Power Supply.

I. INTRODUCTION
Nowadays, Temperature monitoring and maintenance is important for many control applications. Example:
Industrial zone domains such as processes, Automobile, industrial space, or storage, Adjust to get the desired
temperature with office buildings is. This is the essential concerns [2]. Temperature measured using temperature
The sensor divided into two Broad category, first analog temperature Sensors, which sensors produce analog
The output voltage, which is proportional to These temperatures and sensors require a second type of analog-to-
digital converter (A / D). Including digital temperature sensors in which Digital production sensors and all of
this. The sensor can be connected directly to Microprocessor or microcontroller without A / D converter is
needed.
The structures of this paper are following: Section I introduces of the system. Section II shows the proposed
system. This section describes the brief about of system. Section III discusses the methodology of the system.
This system also presents the messaging of the PIC16F877A, Temperature sensor (LM35), LCD and power
supply. Section IV presents software simulation of the system. Section V presents the implementation of the
system to implement the system. Then it explains the design and the system process. Section VI presents the
coding which is use in simulation. Section VII brings up the conclusion which also discusses the
recommendations for further extension to improve this system.

II. PROPOSED SYSTEM

Fig-1: Process of this system


In Figure: 1, the LM35 sensor converts the temperature into an analog voltages. This analog voltage value is
process in microcontroller (PIC16F877A) and shows the output display on LCD.

www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science


[777]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
Volume: 02/Issue: 07/July-2020 www.irjmets.com
III. METHODOLOGY
A microcontroller is a computer control system on a IC. It has various ICs develops into it, which can decrypt
write instructions and change to electrical waves. The microcontroller will follow these instructions and process
each word one by one [4]. As an example of this a microcontroller could be used to control the temperature.
a) LM35 sensor
In Figure: 2 show the pin configuration of the LM35.It is a high-precision centigrade temperature sensor which
has a linearly proportional output voltage that corresponds to the Celsius temperature. The LM35 has more
advantages about the linear temperature sensor that is calibrated in degrees Kelvin. Win, because the user does
not need to remove a big continuous voltage from the output to get a convenient centigrade scale for
temperature changes in each degree Celsius, the sensor output will change to 10mV. The sensor can measure the
temperature within range 0 to 100.C, for example, the sensor output will vary from 0 to 1000mV. LM35
operates in the temperature range -55 ° to + 150 ° C, the LM35 is within the -40 ° C to range + 110 ° C [1].

Fig-2: LM35 Temperature sensor


b) PIC16F877A microcontroller
The IC PIC16F877A is an 8-bit microcontroller with 8k x14 bit flash program memory, 368 bytes of RAM, and
many other peripherals such as ADC, universal asynchronous synchronous transmitters, the main synchronous
serial port and analog comparators. This set of instruction depends on the computer architecture (RISC). The
PIC16F877A works the sensor output to calculate the temperature in degrees. The ADC inside the
microcontroller is used to change the analog output of the sensor to an equivalent digital value.
The microcontroller's internal ADC has 8 analog inputs and provides 10-bit digital signals. In this project, the
reference voltage of the ADC is equal to the voltage supplied to the microcontroller, such as 5V.The resolution
of the ADC can be calculated as follows:

Resolution = (as it is a 10-bit ADC)

This means that for a change to a 4.887 mV analog input, the output of the ADC will change to 5V by the
voltage referred to in binary '1'. Analog result of the sensor that pin2 connects to the A port at RA0 for
conversion is Digital equivalent [4]. PIC16F877A’s pin diagram is shown in figure:3.

Fig-3: Pin diagram of PIC16F877A.

www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science


[778]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
Volume: 02/Issue: 07/July-2020 www.irjmets.com
c) Liquid Crystal Display(LCD)
16x2 LCD means that it can display 16 characters per line and there are 2 such lines in this LCD. Each character
will be shown as a 5x7 pixel matrix. This LCD has two registers: Command and Data command registration
stores commands that are assigned to LCD. Commands are commands assigned to LCD to perform predefined
tasks such as starting screen clearing, setting cursor position, and controlling the display. Data registration etc.
will store the information that will be displayed on the LCD. The data is the ASCII value of the character that
will be displayed on the LCD. 16 x 2 LCD monitor with controller HD44780 is used for temperature display.
The EN, R / W and RS control cables of the LCD module connects to the RB3, ground, and RB2 pins of port B
of the microcontroller B port, respectively. The commands and information to be displayed are sent to the LCD
module in nibble mode from port B of the microcontroller. The bit higher than the four bits of the LCD (D4 to
D7) is connected to the higher gnawing of the B port (RB4 to RB7) [3]. The above description can be seen in
figure: 4.

Fig-4: Liquid Crystal Display(LCD)


d) Power supply unit
There are many types of power supply. Most are designed to convert high-voltage alternating current to a
suitable low-voltage power supply for electronic circuits and other devices. The power supply is divided into a
set of blocks in which each function is functional specifically. Figure: 5 show the block diagram of 5V power
supply.
230V AC mains

Transformer

Rectifier

Smoothing

Regulator

Regulated 5V DC

Fig-5: Block diagram of 5V regulated power supply


In this figure, transformer is steps down high voltage AC mains to low voltage AC. The rectifier converts AC to
DC but the DC output changes. Smoothing is the spinning of DC from a large change to a small ripple.
The controller will eliminate ripples by setting the DC output to a constant voltage. The low-voltage AC output
is suitable for temperatures, lamps, heaters and special AC motors. Not suitable for electronic circuits except
for rectifiers and smoothing capacitors [5].

www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science


[779]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
Volume: 02/Issue: 07/July-2020 www.irjmets.com
IV. SOFTWARE SIMULATION
The write of programming language is Mikro C language and compiled using proteus8.
a) Simulation Setup for Mikro C language
Simulation Setup for Mikro C PRO software is step by step the following. Open MikroC PRO, go to “Flie” then
“New” for new project or “Open” for old project. This is shows in figure: 6. then write code for the required
application.

Fig-6: Simulation Setup for Mikro C PRO software


After write the code for required application, go to “build” to compile the file and create the hex file to be
loaded into the microcontroller, then select the “run” option to start the debugging process and run the program,
b) Simulation Setup for proteus8
First of all, prepare the code with the desired function and prepare its "Hex file". Open the Proteus8 software, go
to "File" and select "New Design", then choose the template. Then place components (microcontroller and other
equipment) and make connections between them.
V. IMPLEMENTATION
The LM35 sensor changes the temperature into a proportional analog voltage value. The LM35 has three
terminals, pin one and pin three for the 5 volt supply. The second pin is an analog voltage output that regarding
the temperature value, the measured temperature is the connection between the analog output voltages is:
1oC = 10m volt
Therefore, for every 1 degree of temperature rise, the output voltage of the LM35 sensor is increased by 10m
volts. The PIC16F877A is use for measuring analog voltage values. The PIC16F877A microcontroller is built in
the ADC. Used to measure analog voltage; the PIC16F877A PORTA has seven built-in ADC channels, so one a
maximum of seven sensors can be connected with this microcontroller easily. Back at the digital thermometer,
ADC is used for reading analog voltage. After reading the ADC, the voltage and temperature will be converted
back to temperature. The conversion factor is used to convert the voltage back into temperature. All these
conversions are done through programming. LCD connected to PORTB of the PIC16F877A microcontroller.
In this paper, the operation of the system present step by step. After the system is implemented, microprocessor
calculates temperature degree Celsius from the temperature sensor senses the room temperature. Figure: 7 show
the initialize result of the system. This figure displays the initialize output result “Digital Tempe Sensor” on
LCD.

www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science


[780]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
Volume: 02/Issue: 07/July-2020 www.irjmets.com

Fig-7: Firstly process of the system


When the temperature sensor sensed, microprocessor converts the room temperature and displays on LCD as
shown in figure: 8.

Fig-8: Final result of room temperature

www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science


[781]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
Volume: 02/Issue: 07/July-2020 www.irjmets.com
The result analysis of temperature changes from 1second is show in figure: 9.

Fig-9: Temperatures varies by times.

VI. CODING
In programming factors, as for the conversion, this scheme uses voltage to temperature. The conversion factor
is:
1 volt = 100 degree
mV = ( Output voltage * 100 oC/V )
Code is written in MIKRO C compiler.

// LCD module connections


sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D4 at RB4_bit;

// Pin direction
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D7_Direction at TRISB7_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB4_bit;
int temp,temp1,mV;
char temper[7];
void READ_temp(void)

www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science


[782]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
Volume: 02/Issue: 07/July-2020 www.irjmets.com
{
temp=ADC_Read(0);
mV= (temp* 5000.0)/1024.0;
temp1=mV/10.0;

//temp=temp1*5/1023;
//temp2=temp*100;
}
void data_converstion(void)
{
inttostr(temp1,temper);
}
void display1(void)
{
Lcd_Out(1,1,"Temperature=");
Lcd_Out(1,13, Ltrim (temper));
Lcd_Chr_Cp(0xdf);
Lcd_Chr_Cp('C');
//Lcd_Chr_Cp(' ');
Delay_ms (1000);
Lcd_Cmd(_Lcd_CLEAR);
FloatToStr(temp1,temper);
temper[7]=0;
Lcd_Out(2,7,temper);
}
void main()
{
ADC_Init();
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1,4,"Digital Temperature");
Lcd_Out(2,6,"Sensor");
delay_ms(3000);
Lcd_Cmd(_LCD_CLEAR);
while(1)
{
READ_temp();
data_converstion();

www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science


[783]
e-ISSN: 2582-5208
International Research Journal of Modernization in Engineering Technology and Science
Volume: 02/Issue: 07/July-2020 www.irjmets.com
display1();
}
}

VII. CONCLUSIONS and FUTURE EXTENSION


This article presents the use of temperature monitoring systems based on LM35 and microcontrollers. These
documents continuously monitor the temperature with an interval of 1 second (which can be changed in the
program). The temperature measurement uses the LM35 precision integrated circuit sensor. The LCD screen
displays the measured temperature continuously. This system is used for checking room temperatures. It is an
important job to ensure that the server performance is not disturbed by excessive room temperature. This system
comes with modern GSM systems to send and receive text messages (SMS) and relay boards to control
electronic devices.
ACKNOWLEGEMENTS
Thanks to all our teachers and friends for their support in this paper.

VIII. REFERENCES
[1] Aizahaniff, “Security and Control System”, may 2008
[2] B. LEVĂRDĂ and C. BUDACIU, "The design of temperature control system using Pic18f4620,"
Bulletin of the Polytechnic Institute of Jassy, Romania, DIN IASI, vol. 56, pp. 203-214, 2010.
[3] M. Laxmi rohini, “Security System using Wireless Alerts”
[4] Timothy D. Green, “Embedded System Programming with the PIC16F877” second edition, (2008)
[5] https://www.microcontroller based intruder position system.html

www.irjmets.com @International Research Journal of Modernization in Engineering, Technology and Science


[784]

You might also like