Professional Documents
Culture Documents
We have great pleasure in acknowledging our sincere gratitude to all who have been
given the helping hands in the successful completion of our project.
First of all, always we are thankful to Almighty GOD who had showered his blessings on
us and gave us strength for doing our project.
Next, we would like to extend out thanks to the Principal; Prof. Mohammad Ebrahim,
College of Applied Science, Kottayi for providing us best facilities and atmosphere
according to our interest for the successful completion and presentation of our project.
Then, we are most like to give our sincere gratitude to Miss Simi S and Mr Sooraj K B,
guides of our project for all valuable advice and good instruction provided to us. We
would like to extend our sincere gratitude to other lectures in Electronics department who
had been the strength and also for good guidance of our project.
We would like to thanks Mrs. Sukanya & Mr. Hashim, Laboratory Assistants, for all the
help given to us.
Last but not least we express our sincere thanks to our parents, our friends and all others
who gave valuable suggestions, constructive criticism and constant encouragement for
presenting this project as a valuable one.
PROJECT TEAM
2010 - 2011
ABSTRACT
Through our project we are showing the control of constant temperature according to the
desired value (set point) in a closed loop using PID controller system. For this, we are
using a microcontroller, a temperature sensor for sensing the temperature of the closed
loops. By using the microcontroller we compare the desired value with current value and
it is displayed in the LCD. Also to provide the constant temperature, Fan or Heater is
turned On or Off according with the variations of current temperature in oC from desired
setpoint.
Dept of Electronics
CASK
2010 - 2011
CONTENTS
1. INTRODUCTION
2. BLOCK DIAGRAM
Dept of Electronics
CASK
2010 - 2011
Dept of Electronics
CASK
2010 - 2011
INTRODUCTION
The objective of our project TEMPERATURE PID CONTROLLLER is
maintaining the constant temperature in a particular area using PID controller.
Whatever the process or the parameter (temp, flow, speed, ..) the principles of control are
similar. Input and output signals are specified in this project is digital. Control of a
process is achieved by means of a closed loop circuit. This project is prepared in order to
control the temperature of a furnace in the best and easiest possible way.
The control system is that means by which any quantity of interest in a machine,
mechanism or other equipment is maintained or altered in accordance with a desired
manner. Here we have used the closed loop system; that is the feedback system. The
feedback signal is derived from the output of the system. This signal gives the capability
to act as self correcting mechanism. The beneficial effects of the feedback in the system
with high loop gain. The controlled variable accurately follows the desired value and
also feedback in a control system greatly improves the speed of its response.
One of the primary purposes of using feedback in control system is to reduce the
sensitivity of the system to parameter variations.
The project deals with a simple aspect of giving information about the controlling of
temperature in a furnace. In this project we are developing a system, which can control
temperature of a furnace automatically. The system is be capable of taking decisions
accordingly of overheating of blast furnace and cooling of a furnace.
This project is done by using microcontroller (PIC 16F873A) which was developed by
microchip company with several features than processors with cheap cost. A temperature
LM 35 is used in sensing the temperature and relays like heater or fan are used for
adjusting the temperature with desired temperature value. The functions occurring are
displayed on the liquid crystal display.
In this system, it can implement any applications about controlling or monitoring the
temperature without any human effort.
Dept of Electronics
CASK
2010 - 2011
BLOCK DIAGRAM
Temperature
sensor
(LM35)
Power supply
Microcontroller
P
I
C
1
6
F
8
7
3
A
Micro keys
SET
R
E
L
A
Y
UP
DOWN
Heater
Fan
LCD Display
Dept of Electronics
CASK
2010 - 2011
IC LM 35
PIC 16F873A
POWER SUPPLY
RELAY
DISPLAY SECTION
A fixed three terminal voltage regulator has a regulated dc output voltage of 5v and
provide it to IC LM 35, PIC 16f873A, micro keys, relays and display section
Temperature sensing section consists of an IC LM 35 which acts as a transducer. It senses
the temperature and converts it into voltage as a scale of 1oC into 10mv.
At the heart of the circuit is microcontroller PIC 16F873A with many advantages and it is
available in RISC architecture.
The output of the microcontroller is give to the relays and display section.
Relays we used here are Heater and Fan; they are used for adjusting the obtained
temperature with the desired temperature value.
The display section, through the IC LM020L, that displays temperature. It is the main
observable part of this whole system.
Dept of Electronics
CASK
2010 - 2011
Dept of Electronics
CASK
Dept of Electronics
2010 - 2011
CASK
2010 - 2011
LIST OF COMPONENTS
REGULATOR 7805
PIC 16F873A
LM35
RELAYS (2)
CRYSTAL 4MHz
MICROSWITCHES (4)
CAPACITORS
C1 - 1000F
C2 100F
C3, C4 33pF
RESISTORS
R1 10k (4)
R2, R3 1k
TRANSFORMER
Dept of Electronics
CASK
2010 - 2011
Dept of Electronics
CASK
2010 - 2011
Case I:
If the current temperature is greater than desired temperature (including tolerance) then
turn off the heater and turn on the fan.
Case II:
If the current temperature is less than the desired temperature (including tolerance), then
turn on the heater and turn off the fan.
Case III:
Else turn off both heater and fan.
The relays such as heater connected to pin 25 (RB4) and fan is connected to pin 26
(RB5).
The processing of controller will display in the LCD. The current temperature as CT
and the set point as SPcan be observed on the first line of LCD. And also, the present
conditions of the relays are displayed on the second line of the LCD.
Dept of Electronics
CASK
2010 - 2011
Dept of Electronics
CASK
2010 - 2011
A regulator circuit removes the ripples and also remains the same dc value
even if the input dc voltage varies, or the load connected to the output dc voltage
changes. This voltage regulation is usually obtained using one of the popular voltage
regulator IC units.
Transformer
(Step down)
Rectifier
Filter
IC
Regulator
Load
Dept of Electronics
CASK
2010 - 2011
WORKING PRINCIPLE
TRANSFORMER
The transformer will step down the power supply voltage (0 230 V) to (06V) level. Then the secondary of the potential transformer will be connected to the
center-tapped full-wave rectifier; where diodes are working in the property of oneside conduction capability.
CENTER-TAPPED RECTIFIER
In a rectifier, a center-tapped transformer and two diodes can form a full-wave
rectifier that allows both half-cycles of the AC waveform to contribute to the direct
current, making it smoother than a half-wave rectifier. A center-tapped rectifier is
preferred to the full bridge rectifier when the output DC current is high and the output
Dept of Electronics
CASK
2010 - 2011
voltage is low. The advantages of using precision rectifier are it will give peak
voltage output as dc; rest of the circuits will give only RMS output.
FILTERS
Pre-filter and post-filter are connected to the regulator IC. Distance between prefilter and post-filter should be 5cm. High frequency post-filters are used.
IC VOLTAGE REGULATOR
Voltage regulators comprise a class of widely used ICs. Regulator IC units
contain the circuitry for reference source, comparator amplifier, control device, and
overload protection all in a single IC. IC units provide regulation of either a fixed
positive voltage, a fixed negative voltage, or an adjustably set voltage. The regulators
can be selected for operation with load currents from hundreds of milliamperes to tens of
amperes, corresponding to power ratings from milli watts to tens of watts.
A fixed three terminal voltage regulator has an unregulated dc input voltage, Vi,
applied to one input terminal, a regulated dc output voltage, Vo, from a second terminal,
with the third terminal connected to ground.
The series 78 regulators provide fixed positive regulated voltages from 5 to 24
volts.
Dept of Electronics
CASK
2010 - 2011
MICRONTROLLER
PIN DIAGRAM
Dept of Electronics
CASK
2010 - 2011
Dept of Electronics
CASK
2010 - 2011
Dept of Electronics
CASK
2010 - 2011
Dept of Electronics
CASK
2010 - 2011
MICROCONTROLLER CIRCUIT
o MICROCONTROLLER
o RESET CIRCUIT
o OSCILLATOR
Dept of Electronics
CASK
2010 - 2011
EXPLANATION:
The microcontroller circuit is connected with reset circuit, crystal oscillator, LCD
circuit; the reset circuit is the one which is an external interrupt which is designed to reset
the program. And the crystal oscillator circuit is the one used to generate the pulses to
the microcontroller and it also called as the heart of the microcontroller.
The Liquid Crystal Display which is used to display the what we need the LCD
has fourteen pins in which three pins for the command and eight pins for the data. If the
data is given to LCD it is write command which is configured by the programmer
otherwise it is read command in which data read to microcontroller the data pins are
given to the port 0 and command pins are given to the port 2.
Other than these pins a one pin configured for the contrast of the LCD. Thus the
microcontroller circuit works.
o MICROCONTROLLER
A microcontroller is a complete microprocessor built on a single IC.
Microcontrollers were developed to meet a need for microprocessors to be put
into low cost products.
To solve the problem in microprocessor system is implemented with a single chip
microcontroller. This could be called microcomputer, as all the major part are in
the IC. Most frequently they are called microcontroller because they are used to
perform control functions.
The microcontroller contains full implementation of a standard
MICROPROCESSOR, ROM, RAM, I/O, CLOCK, TIMERS, and also SERIAL
PORTS. Microcontroller also called system on a chip or single chip
microprocessor system or computer on a chip.
Another term to describe a microcontroller is embedded controller, because the
microcontroller and its supports circuits are often built into or embedded in the
devices they control.
Dept of Electronics
CASK
2010 - 2011
ADVANTAGES:
o If a system is developed with a microprocessor, the designer has to go for external
memory such as RAM, ROM or EPROM and peripherals and hence the size of
the PCB will be large enough to hold all the required peripherals. But, the
microcontroller has got all these on a single chip so development of a similar
system with a microcontroller reduces PCB size and cost of the design.
o One of the major differences between a microcontroller and microprocessor is
that a controller often deals with bits, not bytes as in the real world application.
o It has only 35 instructions, so it is easy to learn.
o Design complexity is small.
o It has eight level stacks. And also addresses are in vectored form (pre-defined).
Dept of Electronics
CASK
2010 - 2011
APPLICATIONS:
A microcontroller is a kind of miniature computer that you can find in all kinds of
Gizmos. Some examples of common, every-day products that have microcontrollers are
built in. if it has buttons and a digital display, chances are it also has a programmable
microcontroller brain.
Microcontrollers are designed for use in sophisticated real time applications such as
1. Industrial Control
2. Instrumentation and
3. Intelligent computer peripherals
They are used in industrial applications to control
Motor
Robotics
In medical instrumentation
Oscilloscopes
Telecommunication
Automobiles
Driving an LCD
Period measurements
Machinery
Aerospace designs
Dept of Electronics
CASK
2010 - 2011
Dept of Electronics
CASK
2010 - 2011
o RESET CIRCUIT
The reset circuitry consist capacitor in series with 10K resistor. When switch on
the supply the capacitor is changed and discharged gives high low pulse.
When power is turned on the circuit holds the RST pin high for an amount of time
that depends on the capacitor value and the rate at which it charges.
To ensure a valid reset, the RST pin must be held high long enough to allow the
oscillator to start up plus two machine cycles. On power up, Vcc should rise
within approximately 10ms. The oscillator start-up time depends on the oscillator
frequency. For a 10 MHz crystal, the startup time is typically 1ms. Within the
given circuit, reducing Vcc quickly to zero causes the RST pin voltage to
momentarily fall below zero volt. However, this voltage is internally limited and
will not harm the device.
o OSCILLATOR
Crystal oscillator is the one used to generate the pulses to the microcontroller and
it is also called as the heart of microcontroller. Here we have used 4 MHz crystal
which generates pulses. It offers the highest precision (exactness/accuracy) and
stability. Even the microcontroller has an internal RC oscillator with a maximum
frequency of 4 MHz, noise affect it easily. Because of increasing of aging of
oscillator, resonant frequency varies and cannot get the fixed frequency. So we use
crystal oscillator externally for accuracy.
Dept of Electronics
CASK
2010 - 2011
WHY PIC?
Microchip provides solutions for the entire performance range of 8-bit, 16-bit, and 32-bit
microcontrollers, with a powerful architecture, flexible memory technologies,
comprehensive easy-to-use development tools, complete technical documentation and
post design-in support through a global sales and distribution network. Benefits realized
by selecting Microchips microcontroller solutions are:
Easy migration across product families
Low-risk product development & faster time to market
Lower total system cost
24/7 support and Regional Training Centers worldwide
Production programming services
Certified quality
Convenient ordering using microchip DIRECT
.
Dept of Electronics
CASK
2010 - 2011
WHY PID ?
1) PID Explained:
Only very control of temperature can be achieved by causing heater power to be
simply switched on and off according to an under or over temperature condition
respectively.
Ultimately, the heater power will be regulated to achieve a desired system temperature
but refinement can be employed to enhance the control accuracy.
Such refinement is available in the form of proportional (P), integral (I), and derivative
(D) functions applied to the control loop. These functions, referred to as control terms
can be used in combination according to system requirements. The desired temperature is
usually referred to as the set-point (SP).
a) Adequate heater power is available (ideally control will be achieved with 50% power
applied!)
b) The temperature sensor, be it thermocouple or PRT, is located within reasonable
thermal distance of the heaters such that it will respond to changes in heater
temperature but will be representative of the load temperature (the thing being heated).
c) Adequate thermal mass in the system to minimize its sensitivity to varying load or
ambient conditions.
d) Good thermal transfer between heaters and load.
e) The controller temperature range and sensor type are suitable try to choose a range
that results in a mid-scale set-point.
a) On Off Usually simplest and cheapest but control may be oscillatory. Best
confined to alarm functions only or when thermostatic type control is all that is
required, but this may be the most suitable means of control in some applications.
Dept of Electronics
CASK
2010 - 2011
b) Proportional (P) A form of anticipatory action which slows the temperature rise
when approaching set-point. Variations are more smoothly corrected but an offset will
occur (between set and achieved temperatures) as conditions very.
Average heater power over a period of time is regulated and applied power is
proportional to the error between sensor temperature and set-point (usually by time
proportioning relay switching). The region over which power is thus varied is called the
Proportional Band (PB) it is usually defined as a percentage of full scale.
Offset is the deviation of the sensor temperature from the desired value (set-point).
This can be adjusted out manually by means of a potentiometer adjustment (Manual
reset) or automatically (Integral Action).
c) Proportional + Derivative (PD) The Derivative term when combined with
proportional action improves control by sensing changes and correcting for them quickly.
The proportional is effectively intensified (its gain is increased) to achieve a quicker
response.
PD action is commonly employed in general applications. Its use can help to minimize or
even eliminate overshoot on system start up, especially when an approach (overshoot
inhibition) feature is incorporated.
d) Proportional + Integral + Derivative (PID)
Adding an integral term to PD control can provide automatic and continuous elimination
of any offset. Integral action operates in the steady state condition by shifting the
Proportional Band upscale or downscale until the system temperature and set-point
coincide.
e) Choosing P, PD or PID
Although superior control can be achieved in many cases with PID control action, values
of the PID terms inappropriate to the application can cause problems.
If an adequately powered system with good thermal response exists and the best possible
control accuracy is required, full PID control is recommended.
Dept of Electronics
CASK
2010 - 2011
If somewhat less critical precision is demanded, the simpler PD action will suffice and
will suit a board range of applications.
If simple control is all that is required, for instance to improve upon thermostatic
switching, Proportional (P) or on-off action will suffice.
Adjustable PID Values?
If the controller specified offers adjustable PID values, the opportunity exists to optimize
or tune the control loop to achieve the best possible accuracy in each case.
Various tuning methods exist but the following technique provides a simple approach.
2) Optimizing Control Terms (Tuning):
Firstly adjust P to minimum, D to off and I to off (or some very large value if not to off).
Full power is applied to the heaters and is switched off when the measured temperature
rises to set-point. The resultant overshoots T0 and the time taken to attain the maximum
overshoot t0 (mins), allow suitable P, I and D values to be calculated.
These or similar values should then be set on the controller and good result will be
achieved.
For critical processes there are alternative more precise methods for obtaining optimum
PID values. Such methods are more time consuming and Auto Tune
Techniques described below provide an attractive solution in most applications, simple or
complex.
Dept of Electronics
CASK
2010 - 2011
Auto tune controllers utilize PID terms and an approach feature which are all
optimized automatically. During the first process warm-up the controller familiarizes
itself with the system dynamics and performs self-optimization. No user adjustments are
required for PID values. Some instruments include an approach feature to minimize or
eliminate start-up overshoot, also automatically.
3) Control Outputs:
Accurate and reliable energy regulations are essential for good control loop performance
if it is assumed that suitable PID values have been determined and applied.
Depending on the method of applying energy to the process, for example electrical
energy to a resistive heating element, a suitable type of controller output arrangement
must be specified. In some cases, more than one output may be required (e.g. for
multizone heaters, heating-cooling applications).
Dept of Electronics
CASK
2010 - 2011
TEMPERATURE SENSOR
The LM35 series are precision integrated-circuit temperature sensors, whose
output voltage is linearly proportional to the Celsius (Centigrade) temperature. The
LM35 thus has an advantage over linear temperature sensors calibrated in Kelvin, as
the user is not required to subtract a large constant voltage from its output to obtain
convenient Centigrade scaling. The LM35 does not require any external calibration or
trimming to provide typical accuracies of 14C at room temperature and 34C over a
full 55 to +150C temperature range. Low cost is assured by trimming and calibration at
the wafer level. The LM35s low output impedance, linear output, and precise inherent
calibration make interfacing to readout or control circuitry especially easy. It can be used
with single power supplies, or with plus and minus supplies. As it draws only 60 A from
its supply, it has very low self-heating, less than 0.1C in still air. The LM35 is rated to
operate over a 55 to +150C temperature range, while the LM35C is rated for a 40 to
+110C range (10 with improved accuracy). The LM35 series is available packaged in
hermetic TO-46 transistor packages, while the LM35C, LM35CA, and LM35D are also
available in the plastic TO-92 transistor package. The LM35D is also available in an 8lead surface mount small outline package and a plastic TO-220 package.
Dept of Electronics
CASK
Dept of Electronics
2010 - 2011
CASK
2010 - 2011
FEATURES OF LM35
Calibrated directly in Celsius (Centigrade)
Linear + 10.0 mV/C scale factor
0.5C accuracy guaranteeable (at +25C)
Rated for full 55 to +150C range
Suitable for remote applications
Low cost due to wafer-level trimming
Operates from 4 to 30 volts
Less than 60 A current drain
Low self-heating, 0.08C in still air
Nonlinearity only 14C typical
Low impedance output, 0.1 W for 1 mA load
The output voltage is converted to temperature by a simple conversion factor.
Dept of Electronics
CASK
2010 - 2011
LIQUID CRYSTAL DISPLAY (LCDs) has materials, which combines the properties of
both liquids and crystals. Rather than having a melting point, they have a temperature
range within which the molecules are almost as mobile as they would be in a liquid, but
are grouped together in an ordered form similar to a crystal.
An LCD consists of two glass panels, with the liquid crystal material sandwiched in
between them. The LCDs are lightweight with only a few millimeters thickness. Since
the LCDs consume less power, they are compatible with low power electronic circuits
and can be powered for long durations.
The LCD does not generate light and so light is needed to read the display. By using
backlighting, reading is possible in the dark. The LCDs have long life and a wide
operating temperature range.
Dept of Electronics
CASK
2010 - 2011
The LCDs have long life and a wide operating temperature range.
Changing the display size or the layout size is relatively simple which makes the LCDs
more customers friendly.
The LCDs used exclusively in watches, calculators and measuring instruments are the
simple seven segment displays, having a limited amount of numeric data. The recent
advances in technology have resulted in better legibility, more information displaying
capability and a wider temperature range. These have resulted in the LCDs being
extensively used in telecommunications and entertainment electronics. The LCDs have
been started replacing the cathode ray tube (CRTs) used for the display of text and
graphics and also in small TV applications.
Dept of Electronics
CASK
2010 - 2011
PCB DESIGNING
Printed circuit boards sometimes abbreviated PCB. A flat board made of non-conducting
material, such as plastics or fiber glass on which chips and other electronic components
are mounded usually in pre-drilled holes designed to hold them.
The components on a PCB or more specifically the holes that hold them are connected
electrically by pre-defined conductive metal pathways that are printed on the surface of
the board. The metal leads protruding from the electronic components are soldered to the
conductive metal pathways to form a connection. A PCB should be held by the edges
and protected from dirt and static electricity to avoid damage.
PCB forms the core of electronic equipment domestic and industrial. Some of the areas
where PCBs are intensively used are computers, process control, telecommunication and
instrumentation.
The manufacturing process consists of two methods; print and etch, and plate and
etch.
The software used in our project to obtain;
The schematic layout is PROTEUS 7 PROFESSIONAL.
The software for stimulating is ISIS 7 PROFESSIONAL.
The software for wiring on PCB board is ARES 7 PROFESSIONAL.
STEPS IN DESIGNING:
i. PENALIZATION
ii.
DRILLING
iii.
PLATING
iv.
ETCHING
v.SOLDER MASK
vi.
Dept of Electronics
CASK
2010 - 2011
PCB LAYOUT
Dept of Electronics
CASK
2010 - 2011
FIRMWARE IMPLEMENTATION
/*
* Author
PROJECT TEAM
* File
PID.c
* Year
2010
* Overview
#include
<pic.h>
#include
"lcd.h"
#include
"delay.h"
#include
<stdio.h>
SW_SET
RB0
#define
SW_UP
RB1
#define
SW_DN
RB2
#define
RLY_HEATER
RB6
#define
RLY_FAN
RB7
#define
ON
#define
OFF
#define
TRUE
Dept of Electronics
CASK
2010 - 2011
#define
FALSE0
#define
TOLERENCE 5
TOLERENCE
int
SET_POINT = 40;
bit
SET;
~ (5*adcval*1000)/(256*10)
//
~ adcval*2
void main(void)
{
char i;
unsigned int temp = 0;
Dept of Electronics
CASK
2010 - 2011
TRISA = 0XFF;
TRISB = 0X07;
TRISC = 0X00;
ADCON0 = 0XC1;
ADCON1 = 0X00;
RLY_HEATER = OFF;
RLY_FAN = OFF;
lcd_init();
lcd_puts("TEMP PID CONTRLR");
lcd_Secline(0);
lcd_puts(" CAS KOTTAYI ");
//10 sec delay
for(i = 0; i < 4; i++)
DelayMs(250);
while(1)
{
lcd_goto(0);
temp = get_temp();
sprintf(msg,"C.T: %2u S.P: %2u ",temp,SET_POINT);
lcd_puts(msg);
lcd_Secline(0);
if(temp <= (SET_POINT - TOLERENCE))
{
RLY_HEATER = ON;
RLY_FAN = OFF;
Dept of Electronics
CASK
2010 - 2011
while(!SW_SET);
SET = FALSE;
while(SET == FALSE)
{
lcd_clear();
sprintf(msg,"S.P:%2u",SET_POINT);
lcd_puts(msg);
while(SW_SET && SW_UP && SW_DN);// wait for a key depression
if(!SW_SET)
{
while(!SW_SET);
SET = TRUE;
// Settings Over
Dept of Electronics
CASK
DelayMs(250);
2010 - 2011
// Wait a while
}
else if(!SW_UP)
// Up Key Pressed
{
while(!SW_UP);
SET_POINT = SET_POINT + 2;
}
else if(!SW_DN)
{
while(!SW_DN);
SET_POINT = SET_POINT - 2;
}
}
}
else
DelayMs(10);
}
}
Dept of Electronics
CASK
2010 - 2011
CONCLUSION
We are pleasure to conclude our project on the topic Temperature PID Controller. The
detail of this project has been made by members of our team sincerely with the
inspiration of out tutors.
Through this project we have done, sensing and maintaining the temperature using IC
LM35, which is very sensitive. This IC is ideal for interfacing with microcontroller
PIC16F873A.
According to the program installed in the PIC, it regulates or works the relays based on
the comparison of current temperature with set point. And the working of the system can
be observed in the LCD.
Dept of Electronics
CASK
2010 - 2011
FUTURE SCOPE
Now-a-days also these types of circuits can be used in large farms and in certain places
where we want to measure the current temperature and also to maintain the temperature
constant according to the users decision.
We can use in a wide variety of applications like:
Poultry farm
Industries
Thermal furnace
Boiler
Medical applications
Dept of Electronics
CASK
2010 - 2011
BIBLIOGRAPHY
Electronics For You (EFI) www.efy.com
www.microchip.com
www.mikroe.com
www.datasheetcatalog.com
Dept of Electronics
CASK