Professional Documents
Culture Documents
Temperature
Temperature
PROJECT REPORT
ON
“TEMPERATURE SENSOR”
IN CONTEXT WITH “WESTERN MODELS”
BHILAI(C.G)
Submitted in the partial fulfillment for the award of degree
OF
DIPLOMA IN ELECTRICAL
Of
CHATTISGARH SWAMI VIVEKANANDA TECHNICAL UNIVERSITY
Session 2009-2010
Submitted by GUIDED
BY
ABHISHEK KUMAR
6TH SEM
DEPARTMENT OF ELECTRICAL
DURG POLYTECHNIC
1
Declaration
I Abhishek kumar student of sixth semester at
“Govt. polly durg “ her by declare that these
research report under the title is the record of
my original work under the guidance of
These report has never been submitted
anywhere for award of any diploma.
Place:
Date:
2
Certificate
Index
Page no
5
Chapte Introduction 7-8
r -1 Temperature
Chapte sensor
r -2 Software
Chapte aspects
r -3 HD44780U
Chapte (LCD)
r -4 8-bit Micro
Chapte controller
r -5 AD Converter
Chapte Coding
r -6
Conclusion
Chapte
Bibliography
r -7
Chapte
r- 8
Chapte
6
r -9
7
Introduction
How to select a controller?
The following items should be considered when
selecting a controller:
8
– Type of input sensor (thermocouple, RTD) and
temperature range
– Type of output required (electromechanical relay
or analog output)
– Control algorithm needed (on/off, proportional,
PID)
– Number and type of outputs (heat, cool, alarm,
limit)
9
Topics of Discussion
Introduction
Temperature sensors
Software aspects
HD44780U (LCD-II)
8-bit Microcontroller
A/D Converters
Coding
10
11
Temperature
sensors
Temperature Sensors are the devices which are used
to measure the temperature of an object.
Non-Contact type:
These infer temperature by measuring the thermal
radiations emitted by the material.
12
Contact type sensors:
Thermocouple
IR thermometers
-These measure the temperature by detecting the
infrared energy emitted by the material.
-This consists of a lens which senses the IR signal and
converts it into electrical signal which is displayed in
temperature units.
-These are applied when the object is moving,
surrounded by EM field or when a fast response is
required.
Thermocouple Temperature
Measurement Sensors
Principle of operation:
Thermocouples work on the principle of
Seebeck effect.
They are available in bead type or probe type
construction.
They consist of two junctions: cold junction and
hot junction.
13
The voltage developed between two junctions
is called Seebeck voltage.
Voltage is in the order of mill volts.
They generate energy in the order of microwatts-
mill watt
14
Thermocouples
Theory of operation:
– Figure 1 shows the typical Type-J
thermocouple.
– The emf shown in the figure is the Seebeck
voltage which is developed because of the
temperature difference.
– Figure 2 shows the cold junction
compensation (CJC).
15
Calculations:
The voltage generated by the thermocouple is
given by the equation:
V= S* ΔT
Where, V= voltage measured (V)
S= Seebeck coefficient (V/°C)
ΔT= difference in temperature between
two junctions
Hence the unknown temperature can be calculated
using the equation,
T= Tref + V/S in °C
16
17
Resistance Temperature Detectors
(RTDs)
Disadvantages:
• Smaller temperature range when
compared to thermocouples
• High initial cost and less rugged to
environmental vibrations
• Not self-powered
• Self heating
Applications:
• They are used for precision process
temperature control.
• Widely used in industrial applications.
19
• Directly used in recorders, temperature
controllers, transmitters and digital
ohmmeters
Thermistors
These are similar to RTDs.
Variation is non-linear.
Thermistors are used to measure the
temperatures ranging from -45 to 260 deg C or
(-50 to 500 deg Fahrenheit).
20
Advantages:
• High output
• Fast response
• Two wire ohms measurement
Disadvantages:
• Non-linear
• Limited temperature range
• Not self-powered
Self heating
Applications:
• Can be used as a liquid level indicator or as a
liquid level controller
• To measure temperature in Medical Applications
21
• Temperature Control
22
Software aspect
Proportional controller:
• It eliminates the cyclic problem of on-off
controller.
• This slows down the time at which heater
approaches the set point by decreasing the
average power supplied.
• This time proportioning phenomenon controls
the ON time and OFF time of the controller.
24
• Proportioning action occurs within a
proportional band.
• Output is ON within the band (below set point)
and OFF outside the band (above the set
point).
25
HD44780U (LCD-II)
(Dot Matrix Liquid Crystal Display Controller/Driver
Description
.
The HD44780U dot-matrix liquid crystal display controller and
driver LSI displays alphanumeric, Japanese kana characters, and
symbols.
It can be configured to drive a dot-matrix liquid crystal display
under the control of a 4- or 8-bit microprocessor. Since all the
functions such as display RAM, character Generator, and liquid
crystal driver, required for driving a dot-matrix liquid crystal
display are internally provided on one chip, a minimal system
can be interfaced with this controller/driver.
29
30
31
8-bit Microcontroller
32
Features
• A/D Converters
Description
33
The AT89C51 is a low-power, high-performance CMOS 8-
bit microcomputer with 4k Bytes of Flash programmable
and erasable read only memory (PEROM). The device is
manufactured using Atmel’s high-density nonvolatile
memory technology and is Compatible with the industry-
standard MCS-51 instruction set and pin out.
The on-chip Flash
allows the program memory to be reprogrammed in-
system or by a conventional Nonvolatile memory
programmer. By combining a versatile 8-bit CPU with
Flash on a monolithic chip, the Atmel AT89C51 is a
powerful microcomputer which provides a highly-flexible
and cost-effective solution to many embedded.
34
Pin Functions
35
COM12 to COM16 are non-selection waveforms at 1/11 duty factor. SEG1
to SEG40 40 O LCD Segment signals V1 to V5 5 — Power supply Power
supply for LCD drive VCC –V5 = 11 V (max) VCC, GND 2 — Power supply
VCC: 2.7V to 5.5V, GND: 0V OSC1, OSC2 2 — Oscillation resistor clock
When crystal oscillation is performed, a resistor must be connected
externally. When the pin input is an external clock, it must be input to
OSC1.
Control applications.
36
VCC
Supply voltage.
GND
Ground.
Port 0
Port 1
Port 1 is an 8-bit bi-directional I/O port with internal
pullups. The Port 1 output buffers can sink/source four
TTL inputs. When 1s are written to Port 1 pins they are
pulled high by the internal pullups and can be used as
inputs. As inputs, Port 1 pins that are externally being
pulled low will source current (IIL) because of the internal
pullups. Port 1 also receives the low-order address bytes
during Flash programming and verification.
Port 2
37
Port 2 is an 8-bit bi-directional I/O port with internal
pullups. The Port 2 output buffers can sink/source four
TTL inputs. When 1s are written to Port 2 pins they are
pulled high by the internal pullups and can be used as
inputs. As inputs Port 2 pins that are externally being
pulled low will source current (IIL) because of the internal
pullups. Port 2 emits the high-order address byte during
fetches from external program memory and during
accesses to external data memories that use 16-bit
addresses (MOVX @ DPTR). In this application, it uses
strong internal pullups when emitting 1s. During accesses
to external data memories that use 8-bit addresses
(MOVX @ RI), Port 2 emits the contents of the P2 Special
Function Register.
Port 2 also receives the high-order address bits and some
control signals during Flash programming and verification.
Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pull-
ups. The Port 3 output buffers can sink/source four TTL
inputs. When 1s are written to Port 3 pins they are pulled
high by the internal pull-ups and can be used as inputs. As
inputs, Port 3 pins that are externally being pulled low will
source current (IIL) because of the pull-ups. Port 3 also
serves the functions of various special features of the
AT89C51 as listed below:
38
Port Pin Alternate Functions
P3.0 RXD (serial input port)
P3.1 TXD (serial output port)
P3.2 INT0 (external interrupt 0)
P3.3 INT1 (external interrupt 1)
P3.4 T0 (timer 0 external input)
P3.5 T1 (timer 1 external input)
P3.6 WR (external data memory write strobe)
Port 3 also receives some control signals for Flash
programming and verification
RST
Reset input. A high on this pin for two machine cycles
while the oscillator is running resets the device.
ALE/PROG
Address Latch Enable output pulse for latching the low
byte of the address during accesses to external memory.
This pin is also the program pulse input (PROG) during
Flash programming. In normal operation ALE is emitted at
a constant rate of 1/6 the oscillator frequency, and may be
used for external timing or clocking purposes. Note,
however, that one ALE pulse is skipped during each
access to external Data Memory. If desired, ALE operation
can be disabled by setting bit 0 of SFR location 8EH. With
the bit set, ALE is active only during a MOVX or MOVC
instruction. Otherwise, the pin is weakly pulled high.
Setting the ALE-disable bit has no effect if the
microcontroller is in external execution mode.
PSEN
Program Store Enable is the read strobe to external
program memory. When the AT89C51 is executing code
from external program memory, PSEN is activated twice
39
each machine Cycle, except that two PSEN activations
are skipped during each access to external data memory.
EA/VPP
External Access Enable. EA must be strapped to GND in
order to enable the device to fetch code from external
program memory locations starting at 0000H up to
FFFFH. Note, however, that if lock bit 1 is programmed,
EA will be internally latched on reset. EA should be
strapped to VCC for internal program executions. This pin
also receives the 12-volt programming enable voltage
(VPP) during Flash programming, for parts that require 12-
volt VPP.
XTAL1
Input to the inverting oscillator amplifier and input to the
internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
40
The AT89C51 is normally shipped with the on-chip Flash memory array in
the erased state (that is, contents = FFH) and ready to be programmed.
The programming interface accepts either a high-voltage (12-volt) or a low-
voltage (VCC) program enable signal. The low-voltage programming mode
provides a convenient way to program the AT89C51 inside the user’s
system, while the high-voltage programming mode is compatible with
conventional third party Flash or EPROM programmers. The AT89C51 is
shipped with either the high-voltage or low-voltage programming mode
enabled. The respective top-side marking and device signature codes are
listed in the following table.
Every code byte in the Flash array can be written and the
Entire array can be erased by using the appropriate
43
combination of control signals. The write operation cycle is
self timed and once initiated, will automatically time itself
to Completion. All major programming vendors offer
worldwide support for The Atmel microcontroller series.
Please contact your local Programming vendor for the
appropriate software revision
44
A/D Converters
45
Potentiometric ladder and are designed to operate with
the 8080A control bus via three-state outputs.
These converters
Appear to the processor as memory locations or I/O ports,
and hence no interfacing logic is required. The differential
analog voltage input has good common mode- Rejection
and permits offsetting the analog zero-input voltage Value.
In addition, the voltage reference input can be adjusted to
allow encoding any smaller analog voltage span to the full
8 bits of resolution.
46
47
48
Understanding A/D Error Specs
Digital Operation
50
The converter is started by having CS and WR
simultaneously Low. This sets the start flip-flop (F/F) and
the resulting “1” level Resets the 8-bit shift register, resets
the Interrupt (INTR) F/F and inputs a “1” to the D flip-flop,
DFF1, which is at the input end of the 8-bit shift register.
Internal clock signals then transfer this “1” to the Q output
of DFF1. The AND gate, G1, combines this “1” output with
a clock signal to provide a reset signal to the start F/F. If
the set signal is no longer present (either WR or CS is a
“1”), the start F/F is reset and the 8-bit shift register then
can have the “1” clocked in, which starts the conversion
process. If the set signal were to still be present, this reset
pulse would have no effect (both outputs of the start F/F
would be at a “1” level) and the 8-bit shift register would
continue to be held in the reset mode. This allows for
Asynchronous or wide CS and WR signals. After the “1” is
clocked through the 8-bit shift register (which Completes
the SAR operation) it appears as the input to DFF2. As
soon as this “1” is output from the shift register, the AND
gate, G2, causes the new digital word to transfer to the
Three-State output latches. When DFF2 is subsequently
clocked, the Q output makes a high-to-low transition which
causes the INTR F/F to set. An inverting buffer then
supplies the INTR output signal. When data is to be read,
the combination of both CS and RD being low will cause
the INTR F/F to be reset and the three state output latches
will be enabled to provide the 8-bit digital outputs.
Analog Operation
52
Coding
For LCD
53
//#include<reg51.h>
#ifndef LCD_PORT_DEF
#define LCD_DATA_PORT P3
#endif
//Defines
#define MAX_LCD_COL 16
#define MAX_LCD_ROW 2
54
#define LCD_CMD_DISP_NO_SHIFT_CURSOR_LEFT 0x10
#define lcd_displayOn
lcd_command(LCD_CMD_DISP_ON_CURSOR_OFF_BLINK_ON)
#define lcd_cursorOnBlinkOn
lcd_command(LCD_CMD_DISP_ON_CURSOR_ON_BLINK_ON)
#define lcd_cursorOnBlinkOff
lcd_command(LCD_CMD_DISP_ON_CURSOR_ON_BLINK_OFF)
#define lcd_cursorRight
lcd_command(LCD_CMD_DISP_NO_SHIFT_CURSOR_RIGHT)
//Function Prototypes
55
void lcd_command ( unsigned char command );
/***************************************************************************
* Function: lcd_putUBYTE
* Parameters: number
* Returns: None
***************************************************************************/
/***************************************************************************
* Function: lcd_putUPBCD
* Parameters: number
56
* on lcd as 59
* Returns: None
***************************************************************************/
/***************************************************************************
* Function: lcd_putUINT16
* Parameters: number
* NOTE:!! Leading Zeros will be displayed ... implement other function for disp
* zero as space and a master function that will call either the leading zero or
* Returns: None
***************************************************************************/
/***************************************************************************
* Function: lcd_put2udigDecimal
* Parameters: number
57
* If number is greater than 99 it is not displayed
* Returns: None
***************************************************************************/
For display
#include <reg51.h>
#include <lcd.h>
58
#include <delay.h>
#define ADC_DATA P2
#define ON 1
#define OFF 0
char digitalData=0;
59
//Make ADC Intr Input
ADC_INTR = 1;
lcd_init();
lcd_cursorOffBlinkOff;
ADC_CS=0;
ADC_RDBAR=1;
ADC_WRBAR=1;
FAN=OFF;
while(1)
lcd_home;
ADC_WRBAR=0;
ADC_WRBAR=1;
while(ADC_INTR==1);
ADC_RDBAR=0;
DelayUs(10);
digitalData=ADC_DATA;
lcd_puts(&tempC[0]);
lcd_put2udigDecimal(digitalData);
//lcd_putUBYTE(digitalData);
lcd_putch(' ');
lcd_puts(°C[0]);
lcd_puts(&cel[0]);
ADC_RDBAR=1;
if(digitalData>40)
60
{
FAN=ON;
else
FAN=OFF;
61
Conclusion
The Perfect Temperature Sensor:
62
Has no effect on the medium it
measures
Is precisely accurate
Responds instantly (in most
cases)
Has an easily conditioned output
Temperature sensors are used in embedded systems for
both thermal monitoring and management applications.
We must evaluate the trade-offs of the sensor,
conditioning circuitry and sensor output in order to
maximize the measurement accuracy while easing the
interface to the microcontroller.
The following sensor guidelines can be used as a starting
point to select a temperature sensor. If our application
requires for a high-temperature measurement,
thermocouples are a good choice because of their wide
temperature operating range. Thermocouples are typically
used as remote sensors and, therefore, the circuit must
provide noise immunity by using good grounding and
shielding methods. If our application required precision,
RTDs set the standard with their superior repeatability and
stability characteristics. For applications such as the
temperature measurement on a thermistors or silicon IC
sensors should be considered. Thermistors are available
in more packages, are lower in cost and have a faster
thermal response time than silicon sensors. However,
thermistors require additional signal-conditioning circuitry,
while silicon sensors provide both the sensor and circuitry
on a single IC that can be interfaced directly to the
63
microcontroller. The output of the sensor is selected by
the available microcontroller hardware and software
resources, in addition to the complexity of the sensor
circuit. The sensor output can consist of an analog,
frequency, ramp rate, duty cycle, serial or logic format that
is proportional to temperature.
64
65