Sunteți pe pagina 1din 11

AUTOMATIC TEMPERATURE

CONTROLLER

INTRODUCTION:

This project is basically a microcontroller based temperature indicator system which


displays temperature in the range of -55 to +125 degree Celsius. In this project we use the Atmel
series micro- controller, the AT89C52, which belongs to the same family of AT89C52. The
system also uses a temperature sensor chip, the DS1621 which acts as a sensor as well as
functions as an analog to digital converter. The DS1621 chip senses the temperature and converts
it into a digital output. The output is displayed on a LCD module. The program for the
microcontroller is written in assembly language.

AIM:

To measure and display the temperature of the most temperature sensitive regions, such as a
running DC motor. If the motor runs excessively the temperature raises to a level enough to
damage the coil of the motor. At that time if the circuit is placed over the surface of the motor
the system displays the temperature and if necessary it can also if the temperature is crossing a
danger level by displaying a “high” programmed in the microcontroller. Similarly, a “low” can
also be displayed.

TECHNOLOGY USED:
This automatic temperature controller using serial communication is based on embedded system
in which we operate our hardware through the software by using programming in assembly
language. This is burn in to microcontroller 89C51.
Components used

1. IC’s used:-
• IC1- 7805 Voltage Regulator
• IC2- AT89c52 microcontroller
• IC3- DS1621 temperature sensor
• IC4- MAX 232
2. Resistors:-

• R1 1 kilo-ohm
• R2 47 kilo-ohm
• R3 10 kilo-ohm
• R4,R5 4.7 kilo-ohm
• Vr1 1 kilo-ohm

3. Capacitors:-

• C1 470uF, 25V electrolytic capacitor


• C2, C3, C4 0.1 uF ceramic disk
• C5 10uF, 16V electrolytic capacitor
• C6, C7 33pF ceramic capacitor

4. Other components used:-


• Transformer 230 ac primary to 0- 9V, 250 mA secondary
• Crystal 12 MHz
• LCD 16*2 LCD module
• Diodes IN-4007
• RS 232 serial port

Fabrication Tools Required:

• Permanent Marker
• Etching Reagent
• Drilling machine
• Cutter
• Solder iron
AT89C52 Description:-

The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with


8Kbytes of Flash programmable and erasable read only memory (EPROM). The device is
manufactured using Atmel’s high density nonvolatile memory technology and is compatible with
the industry standard 80C51 and 80C52 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 AT89C52 is a powerful
microcomputer which provides a highly flexible and cost effective
solution to many embedded control applications.

Special Function Registers


A map of the on-chip memory area called the Special Func
tion Register (SFR) space is shown in Table 1. Note that not all of the addresses are occupied, and unoc-
cupied addresses may not be implemented on the chip. Read accesses to these addresses will in general
return random data, and write accesses will have an indeterminate effect.
User software should not write 1s to these unlisted locations, since they may be used in future products to
invoke

Table 2. T2CON – Timer/Counter 2 Control Registe

T2CON Address = 0C8H Reset Value = 0000


0000B
Bit Addressable
Bit TF2 EXF2 RCLK TCLK EXEN2 TR2 C/T2 CP/RL2
76 5 4 3 2 10

AT89C52

new features. In that case, the reset or inactive values of


the new bits will always be 0. Timer 2 Registers Control and status bits are contained in registers
T2CON (shown in Table 2) and T2MOD (shown in Table 4) for Timer 2. The register pair (RCAP2H,
RCAP2L) are the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode.
Interrupt Registers The individual interrupt enable bits are in the IE register. Two priorities can be set for
each of the six interrupt sources in the IP register.r

Symbol Function
TF2 Timer 2 overflow flag set by a Timer 2 overflow and must be cleared by software. TF2 will not
be set when either RCLK = 1 or TCLK = 1.
EXF2 Timer 2 external flag set when either a capture or reload is caused by a negative transition on
T2EX and EXEN2 = 1. When Timer 2 interrupt is enabled, EXF2 = 1 will cause the CPU to
vector to the Timer 2 interrupt routine. EXF2 must be cleared by software. EXF2 does not
cause an interrupt in up/down counter mode (DCEN = 1).
RCLK Receive clock enable. When set, causes the serial port to use Timer 2 overflow pulses for its
receive clock in serial port Modes 1 and 3. RCLK = 0 causes Timer 1 overflow to be used for
the receive clock.
TCLK Transmit clock enable. When set, causes the serial port to use Timer 2 overflow pulses for its
transmit clock in serial port Modes 1 and 3. TCLK = 0 causes Timer 1 overflows to be used for
the transmit clock.
EXEN2 Timer 2 external enable. When set, allows a capture or reload to occur as a result of a
negative transition on T2EX if Timer 2 is not being used to clock the serial port. EXEN2 = 0
causes Timer 2 to ignore events at T2EX.
TR2 Start/Stop control for Timer 2. TR2 = 1 starts the timer.
C/T2 Timer or counter select for Timer 2. C/T2 = 0 for timer function. C/T2 = 1 for external event
counter (falling edge triggered).
CP/RL2 Capture/Reload select. CP/RL2 = 1 causes captures to occur on negative transitions at T2EX
if EXEN2 = 1. CP/RL2 = 0 causes automatic reloads to occur when Timer 2 overflows or
negative transitions occur at T2EX when EXEN2 = 1. When either RCLK or TCLK = 1, this bit
is ignored and the timer is forced to auto-reload on Timer 2 overflow.
Data Memory
The AT89C52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address
space to the Special Function Registers. That means the upper 128 bytes have the same addresses as
the SFR space but are physically separate from SFR space.
When an instruction accesses an internal location above address 7FH, the address mode used in the
instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space.
Instructions that use direct addressing access SFR space.
For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2).
MOV 0A0H, #data

DS1621 DIGITAL THERMOMETER AND


THERMOSTAT

FEATURES PIN ASSIGNMENT


§ Temperature measurements require no SDA
DD
external components § Measures temperatures from -55°C to +125°C SCL
0
in 0.5°C increments. Fahrenheit equivalent is
1
-67°F to 257°F in 0.9°F increments T § Temperature
OUT

is read as a 9-bit value (2-byte GND


2

transfer)
DS1621S 8-PIN SO (150mil)

§ Wide power supply range (2.7V to 5.5V) DS1621V 8-PIN SO (208mil) § Converts temperature to digital
word in less than 1 second § Thermostatic settings are user definable and SDA

1 8

DD

nonvolatile
27
0

§ Data is read from/written via a 2-wire serial SCL


36

1
interface (open drain I/O lines) T § Applications
OUT

include thermostatic controls,


45

industrial systems, consumer products, GND


thermometers, or any thermal sensitive DS1621 8-PIN DIP (300mil)
system § 8-pin DIP or SO package (150mil and
208mil) PIN DESCRIPTION
SDA - 2-Wire Serial Data Input/Output
SCL - 2-Wire Serial Clock
GND - Ground
TOUT - Thermostat Output Signal
A0 - Chip Address Input
A1 - Chip Address Input
A2 - Chip Address Input
VDD - Power Supply Voltage
DESCRIPTION
The DS1621 Digital Thermometer and Thermostat provides 9-bit temperature readings,
which indicate the temperature of the device. The thermal alarm output, TOUT, is active
when the temperature of the device exceeds a user-defined temperature TH. The output
remains active until the temperature drops below user defined temperature TL, allowing
for any hysteresis necessary.

User-defined temperature settings are stored in nonvolatile memory so parts may be


programmed prior to insertion in a system. Temperature settings and temperature
readings are all communicated to/from the DS1621 over a simple 2-wire serial interface.
ORDERING PACKAGE DESCRIPTION
NUMBER MARKING
DS1621 DS1621 DS1621 in 300 mil DIP
DS1621+ DS1621 (See DS1621 in Lead-Free 300 mil DIP
Note)
DS1621S DS1621 DS1621 in 150 mil SOIC
DS1621S+ DS1621 (See DS1621 in Lead-Free 150 mil SOIC
Note)
DS1621S/T&R DS1621 DS1621 in 150 mil SO, 2500 Piece Tape-and-Reel
DS1621S+T&R DS1621 (See DS1621 in Lead-Free 150 mil SO, 2500 Piece Tape-
Note) and-Reel
DS1621V DS1621V DS1621 in 208 mil SOIC
DS1621V+ DS1621V (See DS1621 in Lead-Free 208 mil SOIC
Note)
DS1621V/T&R DS1621V DS1621 in 208 mil SO, 2500 Piece Tape-and-Reel
DS1621V+T&R DS1621V (See DS1621 in Lead-Free 208 mil SO, 2500 Piece Tape-
Note) and-Reel

Note: A “+” symbol will also be marked on the package


near the Pin 1 indicator.

Table 1. DETAILED PIN DESCRIPTION


PIN SYMBOL DESCRIPTION
1 SDA Data input/output pin for 2-wire serial communication port.
2 SCL Clock input/output pin for 2-wire serial communication port.
3 TOUT Thermostat output. Active when temperature exceeds TH; will
reset when temperature falls below TL.
4 GND Ground pin.
5 A2 Address input pin.
6 A1 Address input pin.
7 A0 Address input pin.
8 VDD Supply voltage input power pin. (2.7V to 5.5V)
OPERATION
Measuring Temperature
A block diagram of the DS1621 is shown in Figure 1.

The DS1621 measures temperature using a bandgap-based temperature sensor. A delta-


sigma analog-to-digital converter (ADC) converts the measured temperature to a digital
value that is calibrated in °C; for °F applications, a lookup table or conversion routine
must be used.

The temperature reading is provided in a 9-bit, two’s complement reading by issuing the
READ TEMPERATURE command. Table 2 describes the exact relationship of output
data to measured temperature. The data is transmitted through the 2-wire serial interface,
MSB first. The DS1621 can measure temperature over the range of -55°C to +125°C in
0.5°C increments.

Table 2. TEMPERATURE/DATA RELATIONSHIPS


TEMPERATURE DIGITAL OUTPUT DIGITAL OUTPUT (Hex)
(Binary)
+125°C 01111101 00000000 7D00h
+25°C 00011001 00000000 1900h
+½°C 00000000 10000000 0080h
+0°C 00000000 00000000 0000h
-½°C 11111111 10000000 FF80h
-25°C 11100111 00000000 E700h
-55°C 11001001 00000000 C900h

Since data is transmitted over the 2-wire bus MSB first, temperature data may be
written to/read from the DS1621 as either a single byte (with temperature
resolution of 1°C) or as two bytes. The second byte would contain the value of the least
significant (0.5°C) bit of the temperature reading as shown in Table

1. Note that the remaining 7 bits of this byte are set to all "0"s.

Temperature is represented in the DS1621 in terms of a ½°C LSB, yielding the following

9-bit format:

Figure 2. TEMPERATURE, TH, and TL FORMAT

MSB LSB

T = -25°C

Major applications:
• In industry purpose
• Production field
• Research centre
• To measure temperature of volcano