Sei sulla pagina 1di 15

ABSTRACT

Device Features:
Continuous monitoring of temperature with 1-second update interval (which can be
varied in the program)
Temperature measurement using LM35 precision integrated-circuit sensor
Precise analogue-to-digital conversion using in-built 10-bit analogue-to-digital converter
(ADC) of PIC16F877A microcontroller.
16X2 LCD display

Technical specifications:
Range: -55 to +150C
Accuracy: 0.01 % F.S.
Power Supply: 5 V
Sensor: LM35
Microcontroller: PIC16F877

Applications:
Industrial applications
Laboratories

1
Chapter 1. Introduction

1.1 Background Review

A temperature sensor is a device that gathers data concerning the temperature from a source and
converts it to a form that can be understood either by an observer or another device. Temperature
sensors come in many different forms and are used for a wide variety of purposes, from simple
home use to extremely accurate and precise scientific use. They play a very important role almost
everywhere that they are applied; knowing the temperature helps people to pick their clothing
before a walk outside just as it helps chemists to understand the data collected from a complex
chemical reaction.
The best known example of a temperature sensor is the mercury-in-glass thermometer. Mercury
expands and contracts based on changes in temperature; when these volume changes are
quantified, temperature can be measured with a fair degree of accuracy. The outside temperature
is the source of the temperature measurements and the position of the mercury in the glass tube is
the observable quantification of temperature that can be understood by observers. Typically,
mercury-in-glass thermometers are only used for nonscientific purposes because they are not
extremely accurate. In some cases, they can be used in high school or college chemistry labs
when a very accurate measurement of temperature is not important.

Temperature monitoring and control is important in industrial environments. Sensors are widely
used for measurement of temperature. Usually, a temperature sensor converts the temperature into
an equivalent voltage output. IC LM35 is such a sensor. Here we describe a simple temperature
measurement and display system based on LM35 sensor and PIC16F877A microcontroller. The
temperature in degrees Celsius is displayed on a 162 LCD.

Fig. 1 Block diagram of the PIC16F877A-based temperature monitoring system

2
The key features of this system are:
1. Continuous monitoring of temperature with 1-second update interval
2. Temperature measurement using LM35 precision integrated-circuit sensor
3. Precise analogue-to-digital conversion using in-built 10-bit analogue-to-digital converter
(ADC) of PIC16F877A microcontroller.

1.2 Scope of work

To successfully do this project, there will be some scope of work:


The information on temperature sensor, types of sensors and microcontroller.
Designing a temperature sensor and temperature sensor circuit, the required components
and software and the tachometer connections to LCD display and motor.

1.3 Objective
To prepare a prototype of a temperature sensor using LM35 sensor. Thus, the project is proposed
to solve the problems by designing a low cost digital tachometer.
1.4 Components list

Fig. 2 Components List

3
1.5 Components description

LM35 SENSOR

Fig. 3 Pin configuration of LM35

It is a precision integrated-circuit centigrade temperature sensor whose output voltage is linearly


proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage over
linear temperature sensors calibrated in degree Kelvin, as the user is not required to subtract a
large constant voltage from its output to obtain convenient Centigrade scaling. For each degree
Celsius change in temperature, the sensor out-put changes by 10 mV.
The sensor can measure temperature in the range of 0 to 100C, i.e., the output of the sensor
varies from 0 to 1000mV. The LM35 operates over the temperature range of -55 to +150C,
while the LM35C is rated for a -40C to +110C range (-10C with improved accuracy).
Pin layout of the sensor is as follows:
Pin 1-VDD
Pin 2-Output of the sensor
Pin 3-VSS

Why Use LM35s to Measure Temperature?

You can measure temperature more accurately than a using a thermistor.


The sensor circuitry is sealed and not subject to oxidation, etc.
The LM35 generates a higher output voltage than thermocouples and may not require that
the output voltage be amplified.

4
Chapter 2. Block Diagram

2.1 System Block Diagram

Fig. 4 Block diagram of the PIC16F877A-based temperature monitoring system

The key features of this system are:


1. Continuous monitoring of temperature with 1-second update interval
2. Temperature measurement using LM35 precision integrated-circuit sensor
3. Precise analogue-to-digital conversion using in-built 10-bit analogue-to-digital converter
(ADC) of PIC16F877A microcontroller.

5
Chapter 3. Specifications

3.1 PIC16F877A microcontroller

IC PIC16F877A is an 8-bit microcontroller with 8k14-bit flash program memory, 368 bytes of
RAM and many other extra peripherals like ADC, universal synchronous asynchronous receiver
transmitter, master synchronous serial port, timers, compare capture and pulse-width modulation
modules, and analogue comparators. It is based on the reduced instruction set computer (RISC)
architecture.
The microcontroller processes the sensor output to compute the temperature in degree Celsius.
The internal ADC of the microcontroller is used to convert the analogue output of the sensor into
its equivalent digital value.

Fig. 5 Pin Diagram

6
The internal ADC of the microcontroller has eight channels of analogue input and gives 10-bit
digital output. In this project, the reference voltage to the ADC is the same as the supply voltage
to the microcontroller, i.e., 5V. The resolution of the ADC can be calculated as follows:

Resolution = Vref
(1024-1)
(as it is a 10-bit ADC)
= 5/1023
= 4.887 mV
It means that for 4.887m change in the analogue input, the ADC output changes by binary 1
with a reference voltage of 5V.Analogue output of the sensor at its pin 2 is connected to Port A at
RA0 for conversion into digital equivalent.

3.2 16x2 LCD

Fig. 6 16x2 LCD

A 162 LCD based on HD44780 controller is used for displaying the temperature. The control
lines EN, R/W and RS of the LCD module are connected to pins RA1, RA2 and RA3 of Port A of
the microcontroller, respectively. The commands and the data to be displayed are sent to the LCD
module in the nibble mode from Port D of the microcontroller. The higher four bits of the LCD
(D4 through D7) are connected to the lower nibble of Port D (RD0 through RD3).

7
Fig. 7 Pin configuration

3.3 IC 7805
7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed linear
voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not give
the fixed voltage output. The voltage regulator IC maintains the output voltage at a constant
value. The xx in 78xx indicates the fixed output voltage it is designed to provide. 7805 provides
+5V regulated power supply. Capacitors of suitable values can be connected at input and output
pins depending upon the respective voltage levels.

Fig. 8 IC 7805

8
Chapter 4. Schematic and Results

4.1 Hardware Layout

Fig. 8 shows the circuit of the temperature monitoring system. The circuit mainly consists of the
LM35 temperature sensor, PIC16F877A microcontroller and HD44780 controller based 162
LCD.

Fig. 8 Schematic Diagram

The output of the sensor is fed to the internal ADC of the microcontroller. Pin 2 of the
microcontroller (RA0/AN0) is channel-1 of the internal ADC. The analogue voltage output of the
sensor is converted into its equivalent digital value by the ADC and then its equivalent degree
Celsius value is calculated by the software. The calculated temperature value is displayed on the
LCD.

4. 2 Software description

The software code is written in C language and compiled using Hitech C cross compiler in
MPLAB IDE. The software performs the following operations in an infinite loop:
1. Initiate analogue-to-digital conversion and obtain the result
2. Calculate the equivalent voltage value from the ADC result
3. Calculate the temperature in degree Celsius from the voltage value
4. Display the temperature on the LCD

9
The voltage output (in volts) of the sensor is:
ADC result 5
1023
The temperature in degree Celsius is:
= Sensor output 1000
10
= Sensor output 100
The Hitech C cross-compiler provides floating-point library support that is required for doing the
above calculations.

MPLAB IDE and Hitech C compiler:


MPLAB IDE is a very powerful software development tool for Microchip products
(microcontrollers). It is available for download at www.microchip.com free of cost.

It consists of tools like text editor, cross-assembler, cross-compiler and simulator.


Hitech C cross compiler is meant for Microchip PIC10/12/16 series of microcontrollers. Its Lite
edition comes free with newer versions of MPLAB IDE like MPLAB v8.2 and v8.3. It can also
be downloaded for free from www.htsoft.com. Compiling the program using MPLAB IDE. The
steps follow:

1. Create project file and add source files. In the menu bar, click ProjectProject Wizard. The
project wizard dialogue box appears. Click Next.
In Next window, select the device as PIC16F877A from the drop-down menu. Click Next
and select Hitech Universal Tool suite from the drop-down menu. Click Next, name your
project file as tempr and specify its location. The file is automatically saved with
.mcpextension. Click Next and add source files tempr.c, lcd.c and delay.c to your project. If
you want to create the source files on your own, you can skip the above step. Click
NextFinish button. Now your project is created and the source files are added to your
project.

10
2. Create and add source files of your own. After creating the project, proceed with typing the
code. Open a new text file by clicking New in File menu. Type the code in the text editor
and save it with .c extension. You can create source files tempr.c, delay.c and lcd.c in this
manner. After typing and saving the code, you have to add the source files to your project. In
Project menu, click Add Files to Project and then add the files by browsing them from the
location they are saved in.
3. Configure the system. To configure features like type of oscillator and WDT, click Configure
menu and then click Configuration Bits. In the configuration bits window, select the type of
oscillator as XT, and disable all other features like watchdog timer, power-up timer and
brownout detect.
4. Compile the project. To compile the software, click Build option in Project menu. The
software is compiled and Build Successful message appears in the output window. After
successful compilation of the program, the file tempr.hex is generated.
Downloading the software into the chip. After compiling the software, the hex file generated
can be downloaded into the chip either using a locally made programmer (like JMD
programmer) or Microchips programming kit (PICKit2, PICKit3, ICD2, ICD3, etc).
We have used Microchip MPLAB ICD2 (in-circuit debugger) to burn the program into
PIC16F877A microcontroller.
The programming can be done from MPLAB IDE itself by selecting the kit (MPLAB ICD2)
from Programmer menu in the menu bar. If you use a JMD programmer, the hex file can be
downloaded into the chip using WinPic800 software. The configuration bits have to be
separately configured in WinPic800.

11
4.3 Construction
A single-side, solder-side PCB layout of the temperature monitoring system is shown in Fig. 4
and its component layout in Fig. 5.

Figure 9. A single-side, actual size PCB layout for PIC16F877A-based temperature


system.

12
Figure 10. Component layout for the PCB

A 230V AC primary to 0-9V AC secondary step-down transformer is used to step down the 230V
mains supply. The output of the transformer is rectified using a bridge rectifier consisting of
diodes D1 through D4 and regulated to 5V using 7805 voltage regulator. The glowing of the LED
(LED1) indicates the presence of 5V supply in the circuit.
The analogue output of the temperature sensor LM35 (IC3) from its pin 2 is connected to
RA0/AN0 pin of PIC16F877A microcontroller (IC2). A 4MHz crystal (XTAL1) is connected to
pins 13 and 14 of the microcontroller.
The 16x2 LCD is interfaced with the microcontroller using Port A and Port D. The control signals
for the LCD are provided using Port-A pins RA1, RA2 and RA3. The command and data for the
LCD are provided using Port-D pins RD0 through RD3. The remaining power supply connections
are as shown in Fig. 2.

13
5. Conclusion

5.1 Conclusion

A PIC16F877A microcontroller based temperature sensor has been demonstrated successfully.

5.2 Future scope and enhancements

The performance of microcontroller based temperature can be analyzed suing data


tracking. And, there exists a scope for further improvement in its speed, number of
channels, power consumption, and PC interface software for post data analysis.
The system can be modified with the use of graphical LCD panel so that the analysis is
done by the system itself. The number of analog channels can be increased to monitor
more sensor outputs.
The low power requirement of this data logger makes it easy to use. The device can be
made to perform better by providing the power supply with the help of battery source
which can be rechargeable or non-rechargeable, to reduce the requirement of main AC
power.
This system can be connected to communication devices such as modems, cellular
phones, or satellite terminal to enable the remote collection of recorded data or alarming
of certain parameters. The new system will email information based upon a regular
schedule of based upon alarms.
Moreover, system can be made user friendly by interfacing it with user friendly software
and thus can support the post process analysis. There lies the scope to make the system
application specific.
The system can also be modified to change the scan time of the channels.
The performance of the system can also be improved by choosing microcontroller chip,
which performs better than 8051 chip. It differs in memory capacity, operating speed,
instruction cycle period etc .A variety of microcontroller chips are available with better
features. Thus, the system can be made more efficient and of better performance by the
use of chip having better features than 8051.

14
References

[1] Andrew J Thompson, John L Bahr and Neil R Thomson, Low power data logger,
proceedings of conference department of physics, university of otago, Dunedin.
[2] H S kalsi, Electronic instrumentation, Tata McGraw-Hill Ltd., New Delhi, 1999.
[3] Peter Roberson, Using data loggers, science teachers workshop, 2004, north Sydney.
[4] Muhammad Ali Mazidi and Janice Gillispe Mazidi, The 8051 microcontroller and
embedded systems, Pearson education ltd., India, 2004.
[5] National Semiconductor Corporation, LM35 datasheet, precision centigrade temperature
sensors, Atmel data book, November 2000 update.
[6] National Semiconductor Corporation, ADC0808/ADC 0809 data sheet, 8-bit
Microprocessor compatible A/D converters with 8-channel multiplexer, national
Semiconductor data book, October 2002 update.
[7] http://ing.pub.ro/engleza/materials/4/8051.pdf.
[8] Atmel corporation, AT89C51 data sheet, 8-bit microcontroller with 4k bytes flash, Atmel
Data book, 2000 update.
[9] 8051 tutorial, Copyright 1997 - 2005 by vault information services LLC.
[10] Rajesh Luharuka, Robert X. Gao, Sundar Krishnamurty, A microcontroller-based
portable GSR data logger for physiological sensing , proceedings of conference
department of Mechanical and Industrial Engineering ,University of Massachusetts,
Amherst.

15

Potrebbero piacerti anche