Академический Документы
Профессиональный Документы
Культура Документы
Project report
Microcontroller based temperature indicator
Submitted by: Nitin Kumar Amit Yadav Guldeep Kumar Paramjeet Singh Mukesh Kumari
2009
Mukesh
2009
Earlier we measure Voltage and this time we measure Temperature using Microcontroller AT89C52.
Submitted by: Nitin kumar Jayant mittal Amit yadav (project incharge) Guldeep kumar
MICROCONTROLLER BASED TEMPERATURE INDICATOR
Er.
ACKNOWLEDGMENT
This project is the outcome of some many peoples generosity, Co-operation and encouragement .we are delighted to have the Opportunity to express our acknowledgment and heartfelt gratitude To each and every one who have been the source of inspiration behind the completion of this project. We must express our sincere thanks to Mr. jayant mittal, Lecturer Inst. and Control for her everlasting co-operation. We extend our sincere thanks to incharges of following Labs Process control lab , electrical lab , power electronic lab, Project lab. The instruments of these labs and guidance of the teachers have been included in the making of this project. We also thank all our friends for their help and co-operation.
Submitted by: Nitin kumar Amit yadav Guldeep kumar {060415026} {060415003} {060415013}
{060415028} {060415021}
GOVERNMENT POLYTECHNIC
HISAR
Er. Jayant mittal Lecturer Department of Instrumentation and Control
--- 125001
Certificate
This is to certify that following students of instrumentation and control Have successfully completed the project on Microcontroller based Temperature Indicator in partial Fulfillment of requirement in instrumentation and control engg. During the academic year 2006-2009 and my guidance and supervision. I wish them good future in life.
MICROCONTROLLER BASED TEMPERATURE INDICATOR
Component list
Semiconductors:
IC17805 Regulator IC IC2AT89C52 Microcontroller IC3DS1621 Temperature Sensor D1-D2IN4007 Rectifier Diodes LED1..Red LED
Resistors:
R1.1-kilo-ohm R2.47-kilo-ohm
MICROCONTROLLER BASED TEMPERATURE INDICATOR
Capacitors:
C1470f, 25v electrolytic Capacito r C2, C3, C40.1f ceramic capacitors C5..10f, 16v electrolytic Capacit or C6, C7.33pf ceramic capacitor
Miscellaneous:
Transformer230v AC Primary to 0-9v, 250mA Secondary Crystal..12 MHz LCD161LCD Module
(Lamp EX model GMD 1601A) S1On/Off SPST switch 8 Pin IC base 40 Pin IC base
125c.Besides AT89C52 microcontroller a uses a temperature sensor chip and an LCD module. The indicator outputs the calibrated data in digital form. The program for the microcontroller is written in C program has well defined syntax; it far outweighs the merits of assembly language program.
7805 Regula
LCD display
MCU AT89C5
DS1621 Temperature
Description of components
1.
RESISTANCE:
It is opposition of the flow of current in the current. Resistances have different values for their needs in the circuits.
2.
CAPACITOR:
It is devices which have its own electrical energy. In a capacitor there are two plants in it, which have opposite charge.
3.
An ic is an performs tasks very It is highly reliable, time, less expensive also available in many tasks, sizes and user
4.
A pcb is a board having electronic circuit designed on it, on this board no wiring is needed. On pcb, copper metal oxide is used to draw the lay out diagram of the circuit to get high reliability, no wiring circuits, easy soldering of electronic devices and equipment and to decrease resistance values
5.
LCD:
LCD is stands for Liquid crystal display and it is used to display the output. In this project the LCD is showing the temperature in digital form. In this project LCD 161 module is used.
PCB Layout
PCB stands for printed circuit board. A pcb is a board having electronic circuit designed on it, on this board no wiring is needed. On pcb, copper metal oxide is used to draw the lay out diagram of the circuit to get high reliability. In single sided PCB, the conductor tracks run only on one side of copper clad board. Thus crossing of conductor is not allowed. Base material is selected according to the application. It is mechanically and chemically cleaned. Then the photo resist solution is uniformly applied. Photo resist is an organic solution, which when exposed to light of power wavelength, changes their solubility in the developers. There are two types of resist: Negative acting photo resist Positive acting photo resist Negative acting resist is a mixture, which is initially soluble in its developer but after exposure to light, it is not soluble. Therefore, the unexposed resist is selectively dissolved and washed away, living the desired the resist pattern on copper clad laminate. Coating of photo resist is done by:
Spray coating Dip coating Roller coating The coated copper clad laminated and films negative are kept in glass frame to intimate contact with each other. The assembly is exposed to ultraviolet light for 3 minutes. The exposed board is rinsed in developer tank. Proper developer has to be used for a particular photo resist. Then the PCB is dyed in a tray. The dye reveals the faults due to contrasts. The faults are then removed by retouching.
Power supply
The power supply unit consists of a step down transformer (230v AC primary to 0-9v, 250mA secondary), bridge rectifier and voltage regulator. The output of the transformer is fed to bridge rectifier diodes D1 through D4(each IN4007). The ripple from the output bridge rectifier is filtered by capacitor C1 and to regulator IC 7805. The regulated output is given to the temperature sensor, microcontroller unit and LCD module, respectively. A transformer is a device used for transferring power from one circuit to another without change in frequency. It can rise or lower the voltage with corresponding decries or increases in current. In simplest from transformer is consist of two coils coupled magnetically. The winding receives the electrical power and secondary delivers it to load.
Transformer are used in different applications as: Voltage transformation Current transformation Isolation transformation etc. When switch S1 is closed, LED1 glows to indicate the presence of power in the system.
. Primary secondary
Temperature sensor
Temperature sensor chip DS1621 (IC3) is an 8 pin DIP IC. Its pin details are shown in fig.3 and the internal block diagram in fig.4. the chip can measure temperature from -55c to +125c in 0.5c increments, which are read as 9bit values. It can operate off 2.7v to 5.5v. Data is read written via a 2of the temperature IC is connected to pins 11 and 10 of the microcontroller, respectively. The internal alarm output (Tout) of IC DS1621 activates when the temperature exceeds user-defined high temperature TH. The output remains active until the temperature drops below user-defined temperature settings are stored in the non-volatile memory. Temperature settings and
temperature readings are communicated to/from IC DS1621 over a 2-wire serial cable. The most significant bit (MSB) of the last significant bit (LSB) is transmitted last.
AND
VDD A0 A1 A2 SDL A0 A1 A2
SS AND I/O CONTROL
SCL
ADDRE
GND 3
TEMPERATURE SENSOR
DS1621
DIGITAL COMPARATOR/LOGIC
ADDRESSING
The chip; address of DS1621 comprises internal preset code nibble 1001 (binary) followed by externally configurable address pins/bits A2, A1 and A0. The eighteen bit of the address byte is determined by the type of operation (either read or write) that is to be performed. For writing to the device the eighth bit is 0 and for reading form the device the eighth bit is 1. In our case, A2, A1 and A0 pins are grounded and hence the
MICROCONTROLLER BASED TEMPERATURE INDICATOR
device address for writing is 10010000b or 90(hex) and for reading the device address is 1001001b or 91 (hex).
Configuration/status register
This register can be accessed for reading or wr4itting by issuing command byte AC (hex) from the master (82052). This register is particularly required if DS1621 is used for thermostat control, since it contains flag bits THF (hightemperature flag) and TLF (low-temperature flag) which are set to when temperature crosses the respective limits
MICROCONTROLLER BASED TEMPERATURE INDICATOR
earlier written into TH and TL registers. It also contains the flag bit (Done), which is set to 1when results of conversion are available after issuing of start conversion command EE (hex). The other bits of configuration register are defined below. NAB is the non-volatile memory busy flag, I is write to an E2 memory cell in progress, 0 indicates that nonvolatile memory is not busy, POL is non-volatile output polarity bit (1 = active-high and 0 = active-low) and ISHOT is one-shot mode. A copy to E-may take up to 10 ms. If ISHOT is I DS1621 will continuously perform temperature conversions. This bit is non-volatile.
THF 1 SHOT
TLF
NVB
Microcontroller unit
Microcontroller AT89C52 (IC2) is a 40-pin IC from Atmel. Its pin details are shown in Fig. 5. Like AT89C51, it also belongs to the 8031/8051 family. Microcontroller AT89C523 is a powerful, highly flexible and cost-effective solution to many embedded control applications. Ports 0 and 2 are 8-bit bidirectional input/output (1/0) ports havent been used in this temperature indicator. Port 1 is an 8-bit bidirectional 1/0 port with internal pull-ups. Ports 1.0 through 1.7 are connected to pins 7 through 14 of the LCD. Port-1 output buffers can sink/source four TTL inputs. Port 3 is an 8-bit bidirectional 1/0 port with internal pull-ups, Ports 3.0 and 3.1 of IC2 are connected to serial clock line (SCL) and serial data line (SDA) of IC3, respectively. Ports 3.2 through 3.4 reconnected to pins 4 through 6 of the LCD, respectively. Port-3 output buffers can sink/source four TTL inputs. A 12MHz crystal oscillator is connected to XTAL1 and XTAL2 pins for operation of the microcontroller. A high pulse on RST pin (pin 9) while the oscillator is running resets the microcontroller. In this circuit, this pin is connected to +Vcc through capacitor C5 (10 uF, 16V). The external access enable pin 9EA) is connected to +Vcc for internal program executions. This pin also receives the 12V programming-enable voltage (Vpp) during flash programming when 12V programming is selected.
The Program
The c-language program to microcontroller at89c52 is compiled using cross amplifier c51 version 7.10 from keil software. The demo version of this compiler is available for free on the website www.keil.com. it can compile programs up to 2kb only, which is sufficient for writing most programs. For testing the display, the program hello.c is given here. This program, when loaded to AT89C52, displays hello! How R U? on the LCD. The hello.c program has nothing to do with temperature. It just guarantees a perfect communication between the LCD and the microcontroller for temperature indication, the program Temp52.c is used. The programs Hello.c and Temp52.c, are given at the end of this article. The communication interface between the temperature sensor and the microcontroller chip follows the ic (inter integrated circuit) standard which is implemented in c here. Ic is a simple master/slave type interface. Simplicity of the ic is primarily due to the bidirectional 2-wire (SDA and SCL) DESIGN AND THE PROTOCOL format .bidirectional communication is through 2 wire lines (which are either active low or passive high). In the program the i2c _stop, i2c_start, i2c_right and i2c_read functions are used for communicating clock and data from ds1621 to p3.0 and
MICROCONTROLLER BASED TEMPERATURE INDICATOR
p3.1 of at89c52, respectively. Such functions as command, ready and display in the program are used for driving the LCD.
Construction
the circuit of this temperature indicator using microcontroller AT89C52 is to be assembled on single sided PCB given along
TEMP52.C
/*Written by : Nitin Kumar G P Hisar Haryana Email : richnitin7@gmail.com Program for temperature indicator complied under keil C */ #include <stdio.h> #include<string.h> #include<Regx52.h>
MICROCONTROLLER BASED TEMPERATURE INDICATOR
/ //Global variable // .. Int temperature; #define high0x01 //Active High Signal #define low0x00 //Active Low Signal #define True0x01 //Active High Signal #define False0x00 //Active Low Signal // .. // function Prototyping // . Void ready (void): Void Command (int): Void Display (char *): Void i2c_stop (void): Void i2c_start (void):
Void i2c_right (unsigned char): Unsigned char i2c_read (void): Void convert (unsigned char): // . // Port Defination // .. #define Data P3_1 #define // Serial data
//Beginning of Main Program Void Main (void) { Int tmp; Char str{16}; Bit flag = FALSE; Unsigned char ch; Void Command (int); Void display (char *) Command (0x3c); Command (0x0c); Command (0x06); While (1)
MICROCONTROLLER BASED TEMPERATURE INDICATOR
{ I2c_start(); I2c_write(0x90); I2c_write(0xEE); I2c_stop(); I2c_start(); I2c_write(0x90); I2c_write(0xAA); I2c_start(); I2c_write(0x91); Ch = i2c_read(); I2c_stop(); Temperature = 0; Convert(ch); If(flag = = FALSE) { Flag = TRUE; tmp = temperature; } Else {
MICROCONTROLLER BASED TEMPERATURE INDICATOR
If(tmp ! = temperature) { tmp = temperature sprint(str%d%s,temperature, Centigrade); command(0x01); command(0x80); display(str); } } } ] //Delay Survive Routine Void delay_time (void) { Unsigned int i; For(i=0<100;i+ +); } //12C Start Function Void i2c_start (void) { DATA = HIGH;
MICROCONTROLLER BASED TEMPERATURE INDICATOR
Delay time(); CLOCK = HIGH; Delay_time(); DATA = LOW; CLOCK = LOW; } //12c stop (void) { Unsigned char I; CLOCK = LOW; DATA = LOW; CLOCK = HIGH Delay_ time(); DATA = HIGH; I = DATA; } //12C Data Write Function Void i2c_write (unsigned char j) { Unsigned char I; For(I = 0;i<8;I + +)
MICROCONTROLLER BASED TEMPERATURE INDICATOR
{ DATA = {(J & 0X80)?i : 0); J < < = 1; Clock = HIGH; Delay_time(); CLOCK = LOW; } I = DATA; CLOCK = HIGH; Delay_time(); CLOCK=LOW; } Ready(); P1 = a; P3_2 = 0x00; P3_3 = 0x00; P3_4 = 0x01; P3_4 = 0x00;