Post on 02-Dec-2014
transcript
ACKNOWLEDGEMENT
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.
All with God’s grace….!!!
PROJECT TEAM
Temperature PID Controller 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
Temperature PID Controller 2010 - 2011
CONTENTS
1. INTRODUCTION 1
2. BLOCK DIAGRAM 4
3. BLOCK DIAGRAM DESCRIPTION 5
4. OVERALL CIRCUIT DIAGRAM
5. COMPONENT LIST
6. OVERALL CIRCUIT DIAGRAM WORKING
7. DESIGNING OR DESCRIPTION OF EACH BLOCK
POWER SUPPLY DESCRIPTION
BLOCK DIAGRAM
CIRCUIT AND EXPLANATION
MICROCONTROLLER
PIN DIAGRAM
THE MAJOR FEATURES OF PIC
MICROCONTROLLER CIRCUIT
EXPLANATION
ADVANTAGES
APPLICATION
ARCHITECTURE
WHY PIC?
8. WHY PID?
9. TEMPERATURE SENSOR
FEATURES OF LM 35
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
10. LIQUID CRYSTAL DISPLAY
11. PCB
PCB DESIGNING
PCB LAYOUT
12. FIRMWARE IMPLEMENTATION
13. CONCLUSION
14. FUTURE SCOPE
15. BIBILIOGRAPHY
16. APPENDIX
Dept of Electronics CASK
Temperature PID Controller 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
Temperature PID Controller 2010 - 2011
BLOCK DIAGRAM
Dept of Electronics CASK
Micro-controller
PIC16F873A
Temperature sensor
(LM35)
Power supply
Micro keys
SET UP DOWN
RELAY
Heater
Fan
LCD Display
Temperature PID Controller 2010 - 2011
BLOCK DIAGRAM DESCRIPTION
The block diagram for “temperature PID controller” circuit consist of
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
Temperature PID Controller 2010 - 2011
OVERALL CIRCUIT DIAGRAM
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
LIST OF COMPONENTS
REGULATOR 7805
PIC 16F873A
LM35
LCD DISPLAY – LM020L
RELAYS (2)
CRYSTAL – 4MHz
MICROSWITCHES (4)
DIODES – 1N4007 (4)
CAPACITORS
C1 - 1000µF
C2 – 100µF
C3, C4 – 33pF
RESISTORS
R1 – 10k (4)
R2, R3 – 1k
TRANSFORMER
TRANSISTORS – BC548 (2)
OVERALL CIRCUIT DIAGRAM WORKING
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
The circuit shows microcontroller based temperature PID controller using temperature
sensor.
Microcontroller PIC 16F873A is the heart of the circuit. It is available in
RISC architecture. The PIC 16F873A is a mid-range 8-bit CPU optimized for Control
Applications. It has 35 instructions on chip flash program memory.
LM35 used as the temperature sensor. It sense the current temperature of a closed
loop and converts into corresponding voltage as it is a transducer. It is connected to
pin 2 (RA0/AN0) of microcontroller. The microcontroller circuit is connected with
reset circuit and crystal oscillator circuit. 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.
To set up the desired temperature value, we use the micro keys such as SET, UP,
DOWN. And also the tolerance value is set in the firmware using embedded C
language.
According to the comparison of desired temperature (here we say as ‘Set point’) with the
current temperature, the relay - Heater or Fan is worked.
Dept of Electronics CASK
Temperature PID Controller 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 ‘SP’can 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
Temperature PID Controller 2010 - 2011
DESCRIPTION OF EACH BLOCK
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
POWER SUPPLY DESCRIPTION
BLOCK DIAGRAM
The ac voltage, typically 220V ms, is connected to a transformer, which steps
that ac voltage down to the level of the desired dc output. A diode rectifier then
provides a full-wave rectified voltage that is initially filtered by a simple capacitor
filter to produce a dc voltage, this resulting dc voltage usually has some ripple or ac
voltage variation.
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.
Block diagram (Power Supply)
Dept of Electronics CASK
Transformer(Step down)
Rectifier Filter IC Regulator
Load
Temperature PID Controller 2010 - 2011
CIRCUIT AND EXPLANATION
WORKING PRINCIPLE
TRANSFORMER
The transformer will step down the power supply voltage (0 – 230 V) to (0-
6V) 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 one-
side 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
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
output 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 pre-
filter 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.
For ICs, microcontroller, LCD ---------- 5volts.
For relay circuits ------------ 12volts.
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
MICRONTROLLER
PIN DIAGRAM
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
THE MAJOR FEATURES OF PIC 16F873A MICROCONTROLLER
High-Performance RISC CPU:
• Only 35 single-word instructions to learn.
• All single-cycle instructions except for program branches, which are two-cycle.
• Operating speed: DC – 20 MHz clock input.
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
DC – 200 ns instruction cycle.
• Up to 8K x 14 words of Flash Program Memory,
Up to 368 x 8 bytes of Data Memory (RAM),
Up to 256 x 8 bytes of EEPROM Data Memory.
• Pinout compatible to other 28-pin or 40/44-pin PIC16FXXX microcontrollers.
Peripheral Features:
• Timer0: 8-bit timer/counter with 8-bit prescaler.
• Timer1: 16-bit timer/counter with prescaler can be incremented during Sleep via
external crystal/clock.
• Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler.
• Two Capture, Compare, PWM modules.
- Capture is 16-bit, maximum resolution is 12.5 ns.
- Compare is 16-bit, maximum resolution is 200 ns.
- PWM maximum resolution is 10-bit.
• Synchronous Serial Port (SSP) with SPI™ (Master mode) and I2C™ (Master/Slave).
• Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit
address detection.
• Parallel Slave Port (PSP) – 8 bits wide with external RD, WR and CS controls (40/44-
pin only).
• Brown-out detection circuitry for Brown-out Reset (BOR).
Analog Features:
• 10-bit, up to 8-channel Analog-to-Digital Converter (A/D).
• Brown-out Reset (BOR).
• Analog Comparator module with:
- Two analog comparators
- Programmable on-chip voltage reference (VREF) module.
- Programmable input multiplexing from device inputs and internal voltage reference.
- Comparator outputs are externally accessible.
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
Special Microcontroller Features:
• 100,000 erase/write cycle Enhanced Flash program memory typical.
• 1,000,000 erase/write cycle Data EEPROM memory typical.
• Data EEPROM Retention > 40 years
• Self-reprogrammable under software control
• In-Circuit Serial Programming™ (ICSP™) via two pins.
• Single-supply 5V In-Circuit Serial Programming
• Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation.
• Programmable code protection.
• Power saving Sleep mode.
• Selectable oscillator options.
• In-Circuit Debug (ICD) via two pins.
CMOS Technology:
• Low-power, high-speed Flash/EEPROM technology.
• Fully static design.
• Wide operating voltage range (2.0V to 5.5V).
• Commercial and Industrial temperature ranges.
• Low-power consumption.
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
MICROCONTROLLER CIRCUIT
o MICROCONTROLLER
o RESET CIRCUIT
o OSCILLATOR
Dept of Electronics CASK
Temperature PID Controller 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
Temperature PID Controller 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
Temperature PID Controller 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
Discrete and continuous process control
In missile guidance and control
In medical instrumentation
Oscilloscopes
Telecommunication
Automobiles
For scanning a keyboard
Driving an LCD
For frequency measurements
Period measurements
Machinery
Aerospace designs
And other high tech devices
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
ARCHITECTURE OF PIC 16F873A
o RESET CIRCUIT
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
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.
WHY PIC?
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
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 Microchip’s 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
.
WHY PID ?
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
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).
To achieve optimum temperature control whether using on-off, P, PD or PID
techniques, ensure that:
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.
Control functions simply described:
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
Temperature PID Controller 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
Temperature PID Controller 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):
Fast Tune PID Control
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
Temperature PID Controller 2010 - 2011
Auto Tune PID Control
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
Temperature PID Controller 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 ±1⁄4°C at room temperature and ±3⁄4°C over a
full −55 to +150°C temperature range. Low cost is assured by trimming and calibration at
the wafer level. The LM35’s 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.1°C in still air. The LM35 is
rated to operate over a −55° to +150°C temperature range, while the LM35C is rated for
a −40° to +110°C 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 8-lead surface mount small outline package and a plastic TO-220
package.
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
FEATURES OF LM35
Calibrated directly in ° Celsius (Centigrade)
Linear + 10.0 mV/°C scale factor
0.5°C accuracy guaranteeable (at +25°C)
Rated for full −55° to +150°C 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.08°C in still air
Nonlinearity only ±1⁄4°C 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
Temperature PID Controller 2010 - 2011
LIQUID CRYSTAL DISPLAY
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.
The LCDs have long life and a wide operating temperature range.
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
Changing the display size or the layout size is relatively simple which makes the LCDs
more customer’s 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
Temperature PID Controller 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. HOT AIR LEVELING
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
PCB LAYOUT
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
FIRMWARE IMPLEMENTATION
/*
* Author : PROJECT TEAM
* File : PID.c
* Year : 2010
* Overview : Temperature PID Controller means to control the temperature in
a fixed range, which is achieved with the help of a fan/cooler as
well as a heater. User can Set the required level by using three
switches namely UP, DOWN and SET.
*/
#include <pic.h>
#include "lcd.h"
#include "delay.h"
#include <stdio.h>
_CONFIG(WDTDIS & HS);
#define SW_SET RB0
#define SW_UP RB1
#define SW_DN RB2
#define RLY_HEATER RB6
#define RLY_FAN RB7
#define ON 1
#define OFF 0
#define TRUE 1
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
#define FALSE 0
#define TOLERENCE 5 // Allowable Temp. Range SET_POINT +/
TOLERENCE
int SET_POINT = 40; // Default Set Point 40 Degree Celcius
bit SET; // Flag to indicate the Status of settings
char msg[16] = "0\0";
unsigned int read_adc(void)
{
ADGO = 1;
while(ADGO);
return((ADRES);
}
// temp = (5/256)*adcval/10mv
// ~ (5*adcval*1000)/(256*10)
// ~ adcval*2
unsigned int get_temp(void)
{
return(2*read_adc());
}
void main(void)
{
char i;
unsigned int temp = 0;
Dept of Electronics CASK
Temperature PID Controller 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
Temperature PID Controller 2010 - 2011
lcd_puts("HEATER ON,FAN OF");
}
else if(temp >= (SET_POINT + TOLERENCE))
{
RLY_HEATER = OFF;
RLY_FAN = ON;
lcd_puts("HEATER OF,FAN ON");
}
else
{
RLY_HEATER = OFF;
RLY_FAN = OFF;
lcd_puts("HEATER OF,FAN OF");
}
for(i = 0; i < 10; i++)
{
if(!SW_SET)
{ // Set Key Pressed
while(!SW_SET); // Wait for Key Release
SET = FALSE; // Ready to Enter into Settings
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) // Set Key Pressed
{
while(!SW_SET); // Wait for Key Release
SET = TRUE; // Settings Over
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
DelayMs(250); // Wait a while
}
else if(!SW_UP) // Up Key Pressed
{
while(!SW_UP); // Wait for Key Release
SET_POINT = SET_POINT + 2; // Increment Set Point by 2
}
else if(!SW_DN) // Down Key Pressed
{
while(!SW_DN); // Wait for Key Release
SET_POINT = SET_POINT - 2; // Decrement Set Point by 2
}
}
}
else
DelayMs(10);
}
}
}
Dept of Electronics CASK
Temperature PID Controller 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
Temperature PID Controller 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 user’s decision.
We can use in a wide variety of applications like:
Poultry farm
Industries
Thermal furnace
Boiler
Medical applications
And in all temperature controlling areas
Dept of Electronics CASK
Temperature PID Controller 2010 - 2011
BIBLIOGRAPHY
Electronics For You (EFI) – www.efy.com
www.microchip.com
www.mikroe.com
www.datasheetcatalog.com
Dept of Electronics CASK