Project Report

34
TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012) CONTENTS :- Introduction Temperature Sensor and Control Pin Diagram of Microcontroller Hardware Used Working Circuit Diagram Layout of Circuit Coding Advantages & Application Future development Different Precautions Conclusion Reference

Transcript of Project Report

Page 1: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

CONTENTS:- Introduction

Temperature Sensor and Control

Pin Diagram of Microcontroller

Hardware Used

Working

Circuit Diagram

Layout of Circuit

Coding

Advantages & Application

Future development

Different Precautions

Conclusion

Reference

Page 2: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

INTRODUCTION :-

The aim of this project is to design an ambient temperature measurement circuit. The motivation for doing this project is the fact that temperature measurement has become an integral part of any control system operating in a temperature sensitive environment and the various learning outcomes associated during the implementation of the project.

In this project the ambient temperature will be displayed on a LCD. An 89s52 Microcontroller will be used for handling all the required computations and control.

In following we have briefly discussed details of a Microcontroller and the project in general. A temperature sensor LM 35 is used for sensing the ambient temperature. The system will get the temperature from the IC and it will display the temperature over the seven segment display and this temperature was compared with the value stored by the user.

Page 3: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

TEMPERATURE

SENSING & CONTROL

What is a temperature sensor?

An analog temperature sensor is pretty easy to explain, it’s a chip that tells you what the ambient temperature is! These sensors use a solid-state technique to determine the temperature. That is to say, they don’t use mercury (like old thermometers), bimetallic strips (like in some home thermometers or stoves), nor do they use thermostats (temperature sensitive resistors). Instead, they use the fact as temperature increases, the voltage across a diode increases at a known rate. By precisely amplifying the voltage change, it is easy to generate an analog signal that is directly proportional to temperature. There have been some improvements on the technique but, essentially that is how temperature is measured. Because these sensors have no moving parts, they are precise, never wear out, don't need calibration, work under many environmental conditions, and are consistent between sensors and readings. Moreover they are very inexpensive and quite easy to use.

What is a Temperature Controller?

As the name implies a temperature controller is an instrument used

Page 4: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

to control temperature. The temperature controller takes an input from a temperature sensor and has an output that is connected to a control element such as a heater or fan. How do Temperature Controllers work? To accurately control process temperature without extensive

operator involvement, a temperature control system relies upon a

controller, which accepts a temperature sensor such as a

thermocouple or RTD as input. It compares the actual temperature

to the desired control temperature, or set point, and provides an

output to a control element. The controller is one part of the entire

control system, and the whole system should be analyzed in selecting

the proper controller.

A temperature control system is a programmable thermostat

that can keep the home or office at a desired temperature

regardless of fluctuating exterior conditions.

The advantage of having a temperature control system over a

common thermostat is that it can save energy and money by

automatically maintaining different temperatures at different

times of the day and night.

Page 5: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

BRIEF INTRODUCTION

TO

MICROCONTROLLER

When we have to learn about a new computer we have to familiarize about the machine capability we are using, and we can do it by studying the internal hardware design (devices architecture), and also to know about the size, number and the size of the registers. A microcontroller is a single chip that contains the processor (the CPU), non-volatile memory for the program (ROM or flash), volatile memory for input and output (RAM), a clock and an I/O control unit. Also called a "computer on a chip," billions of microcontroller units (MCUs) are embedded each year in a myriad of products from toys to appliances to automobiles. For example, a single vehicle can use 70 or more microcontrollers. The following picture describes a general block diagram of microcontroller.

Page 6: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

89s52: The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmelâ„¢s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pinout. 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 in-system programmable Flash on a monolithic chip, the Atmel's AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications.

The AT89S52 provides the following standard features:

8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, Two data pointers, Three 16-bit timer/counters, A six-vector two-level interrupt architecture, A full duplex serial port, On-chip oscillator, and Clock circuitry.

Page 7: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM con-tents but freezes the oscillator, disabling all other chip functions until the next interrupt The hardware is driven by a set of program instructions, or software. Once familiar with hardware and software, the user can then apply the microcontroller to the problems easily.

The following are some of the capabilities of 8051 microcontroller.

Internal ROM and RAM I/O ports with programmable pins Timers and counters Serial data communication The 8051 architecture consists of these specific features: 16 bit PC &data pointer (DPTR) 8 bit program status word (PSW) 8 bit stack pointer (SP) Internal ROM 4k Internal RAM of 128 bytes. 4 register banks, each containing 8 registers 0 bits of general purpose data memory

Page 8: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

32 input/output pins arranged as four 8 bit ports0-P3 Two 16 bit timer/counters: T0-T1 Two external and three internal interrupt sources Oscillator and clock circuits

The following Figure shows PIN Diagram of AT89S52 Microcontroller:-

Page 9: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

Hardware Used:-

¢ Microcontroller AT89S52(8052 derivative). ¢ IC™S 1. DS 1820 (Temperature Sensor). LM 7805 (Regulator IC for 5 volts constant D.C

supply). ¢ LCD For display at remote station. ¢ Crystal Oscillator To produce 11.0592 MHz

Frequency for microcontroller clock. ¢ General Purpose PCB™s.2.2 Software Used. ¢ Keil u-Vision 3.0:- Keil Software is used provide you with software

development tools for 8051 based microcontrollers. With the Keil tools, you can generate embedded applications for virtually every 8051 derivative. The supported microcontrollers are listed in the µ-vision.

¢ 8051 Burner Software

Page 10: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

WORKING

The main work of the project is to sense the temperature and display it and then control it by using relays. Now to display a temperature we have to just convert the temperature which is analog into a digital quantity by using an analog to digital convertor that is referred as ADC or A/D convertor.

To control a temperature sensitive device we refer a range of temperature which with compared by the current temperature that is sensed by the temperature sensor. The temperature based applications are based on mostly on three types these are:-

1 .Under temperature application

2. Over temperature application

3. Power tripping application

Now for an example if equipment is working continuously then it becomes heated. Due to heating the insulation of that particular device is being molten. And now it become slow or we can say that it become less efficient.

To prevent this condition we continuously monitor the device temperature. The work of relay to control temperature is depends on the surrounding conditions, like if the device is over heated then the reference range of temperature. At this time we have to avoid the overheating & provide cooling to the device.

Page 11: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

But in those countries where the snow fall occurs then the device is become under heating then to avoid this condition we have to provide heating to the device.

And if the device exceeds the temperature range which is previously define by us, then the device is being turned OFF or we can say that the device is being tripped.

The above discussed three cases are operated by three different relays. One relay provide heating by heater which is connected to the relay; this relay is activated when the “UNDER TEMPERATURE” condition occur. Once heater is on the device starts heating & works properly as required.

The second relay provides cooling to the device by a fan or blower which is connected with relay, this relay activated when over temperature condition occurs. Due to this the device becomes cooled.

If the temperature range get out of the range of reference range then required to on the fan or blower. But if in case the fan is not in working condition and the device temperature is exceeds the relay tripped the device to prevent the damage. It is used for safety purpose.

In this whole system is using the oscillation frequency 11.0592MHz. all the relays are connected with the transistors at active high mode so as buzzer is also connected in the active high mode with the transistor. Buzzer is blow vary with respect to the temperature change. As the temperature increases the sound of buzzer also increase.

Page 12: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

CIRCUIT DIAGRAM:-

Page 13: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

LAYOUT OF PCB:-

Page 14: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

CODING OF

MICROCONTROLLER:-

#include <89s51.h>

#include<stdio.h>

#define lcddata P1

#define adcport P2

#define rd P3_5

#define wr P3_6

#define intr P3_7

#define rs P3_4

#define rw P3_3

#define en P3_2

#define pwrtrip P0_0

#define fan P0_1

#define heater P0_2

unsigned int adc_val;

void conv();

Page 15: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

void read();

void lcd_busy()

{

unsigned char i,j;

for(i=0;i<80;i++)

for(j=0;j<80;j++);

}

void wait(unsigned int time)

{

unsigned char i,j;

for(i=0;i<100;i++)

for(j=0;j<time;j++);

}

void lcd_init()

{

lcddata=0x38;

rs=0;

rw=0;

en=1;

en=0;

Page 16: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

lcd_busy();

lcddata=0x0f;

rs=0;

rw=0;

en=1;

en=0;

lcd_busy();

lcddata=0x01;

rs=0;

rw=0;

en=1;

en=0;

lcd_busy();

lcddata=0x07;

rs=0;

rw=0;

en=1;

lcd_busy();

}

void lcd_command(unsigned char var)

Page 17: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

{

lcddata=var;

rs=0;

rw=0;

en=1;

en=0;

lcd_busy();

}

void lcd_sendlcddata(unsigned char var)

{

lcddata=var;

rs=1;

rw=0;

en=1;

en=0;

lcd_busy();

}

void sendstring(unsigned char *var)

{

while(*var)

Page 18: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

lcd_sendlcddata(*var++);

lcd_busy();

}

void conv()

{

wr = 0;

wr = 1;

while(intr);

}

void read()

{

rd = 0;

adc_val=adcport;

rd = 1;

}

void buzzer(unsigned int pwm)

{

P0_3=1;

wait(pwm);

P0_3=0;

Page 19: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

wait(pwm);

P0_3=1;

wait(pwm);

P0_3=0;

wait(pwm); P0_3=1;

wait(pwm);

P0_3=0;

wait(pwm);

P0_3=1;

wait(pwm);

P0_3=0;

wait(pwm);

}

void sendReading(unsigned int num)

{

unsigned char t=0,H=0,T=0,U=0;

H=(num%1000)/100;

T=((num%1000)%100)/10;

U=((num%1000)%100)%10;

lcd_sendlcddata(H+48); // Hundred's characted

Page 20: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

lcd_sendlcddata(T+48); // Ten's character

lcd_sendlcddata(U+48); // Unit's character

}

void main(void)

{

unsigned int temp;

P0=0x00;

P2=0xff;

lcd_init();

sendstring(" TEMP. DISPLAY ");

lcd_busy();

lcd_busy();

lcd_command(0xc0);

sendstring("& CONTROL SYSTEM");

lcd_busy();

wait(100);

wait(100);

wait(100);

wait(100);

wait(100);

Page 21: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

wait(100);

wait(100);

wait(100);

wait(100);

wait(100);

wait(100);

while(1)

{

lcd_init();

conv();

read();

temp=adc_val;

if((adc_val>=0x01)&&(adc_val<=0x6f)) // temp between 1-100

{

sendstring("SYS. TEMP. ");

lcd_busy();

sendReading(temp); // display temperature

lcd_busy();

Page 22: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

}

if((adc_val>=0x01)&&(adc_val<=0x0f)) // temp between 1-15

{

lcd_command(0xc0); // goto 2nd line of LCD

sendstring("ACT:");

lcd_busy();

sendstring("POWER HEATER"); // display active devices

lcd_busy();

pwrtrip=0; // switch the

fan=0; // respective device

heater=1;

buzzer(50); // audible feedback

}

else if((adc_val>=0x10)&&(adc_val<=0x19)) // temp between 16-25

{

lcd_command(0xc0); // goto 2nd line of LCD

sendstring("ACT:");

lcd_busy();

Page 23: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

sendstring("POWER HEATER"); // display active devices

lcd_busy();

pwrtrip=0; // switch the

fan=0; // respective device

heater=1;

buzzer(100); // audible feedback

}

else if((adc_val>=0x1a)&&(adc_val<=0x2d)) // temp between 26-45

{

lcd_command(0xc0); // goto 2nd line of LCD

sendstring("ACT:");

lcd_busy();

sendstring("POWER "); // display active devices

lcd_busy();

pwrtrip=0; // switch the

fan=0; // respective device

heater=0;

P0_3=0; // audible feedback

Page 24: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

}

else if((adc_val>=0x2e)&&(adc_val<=0x3c))

{

lcd_command(0xc0); // goto 2nd line of LCD

sendstring("ACT:");

lcd_busy();

sendstring("POWER FAN "); // display active devices

lcd_busy();

pwrtrip=0; // switch the

fan=1; // respective device

heater=0;

buzzer(100); // audible feedback

}

else if((adc_val>=0x3d)&&(adc_val<=0x46))

{

lcd_command(0xc0); // goto 2nd line of LCD

sendstring("ACT:");

lcd_busy();

sendstring("POWER FAN "); // display active devices

Page 25: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

lcd_busy();

pwrtrip=0; // switch the

fan=1; // respective device

heater=0;

buzzer(50); // audible feedback

}

else if((adc_val>=0x47)&&(adc_val<=0x50))

{

lcd_command(0xc0); // goto 2nd line of LCD

sendstring("ACT:");

lcd_busy();

sendstring("POWER FAN "); // display active devices

lcd_busy();

pwrtrip=0; // switch the

fan=1; // respective device

heater=0;

buzzer(25); // audible feedback

}

else if((adc_val>=0x51)&&(adc_val<=0x5a))

{

Page 26: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

lcd_command(0xc0); // goto 2nd line of LCD

sendstring("ACT:");

lcd_busy();

sendstring("POWER FAN "); // display active devices

lcd_busy();

pwrtrip=0; // switch the

fan=1; // respective device

heater=0;

buzzer(10); // audible feedback

}

else if((adc_val>=0x5b)&&(adc_val<=0x6f))

{

lcd_command(0xc0); // goto 2nd line of LCD

sendstring("ACT:");

lcd_busy();

sendstring("POWER OFF"); // display active devices

lcd_busy();

pwrtrip=1; // switch the

fan=0; // respective device

Page 27: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

heater=0;

P0_3=1; // audible feedback

}

else

{

sendstring("SEARCHING.");

lcd_busy();

wait(100);

sendstring(".");

lcd_busy();

wait(100);

sendstring(".");

lcd_busy();

wait(100);

sendstring(".");

lcd_busy();

wait(100);

sendstring(".");

lcd_busy();

wait(100);

Page 28: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

sendstring(".");

lcd_busy();

wait(100);

sendstring(".");

lcd_busy();

lcd_command(0xc0); // goto 2nd line of LCD

sendstring("NO/INVALID DATA");

lcd_busy();

wait(100);

wait(100);

wait(100);

pwrtrip=1; // switch the

fan=0; // respective device

heater=0;

P0_3=0;

}

}

}

Page 29: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

ADVANTAGES &

APPLICATIONS:

This project can be used in Home. This project can be used in Industry. This will help in saving the electricity / energy.

Page 30: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

FUTURE

DEVELOPMENT:

We can monitor parameters like humidity, light and at the same time control them.

We can send this data to remote location using mobile or internet.

We can draw graphs of variations in these parameters using computer.

Page 31: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

DIFFERENT PRECAUTIONS

DURING SOLDERING:

¢ The bit of soldering iron should be kept clean with the help of file at time to time.

¢ The solder wire should be of smaller thickness. ¢ We should not use extra solder because it may be a cause

of short circuit in the conductive path. ¢ The components should not be overheated. ¢ The leads of the components should be clean before

soldering, by the send paper.

DURING USING POWER SUPPLY:

¢ switches and fuses should be used in a project circuit. ¢ Earthing is essential in wiring. ¢ We should use insulated wires. ¢ Power supply should be switched off, when it is not -

required. ¢ If there is a fault in the circuit, then firstly we should

repair it. After repairing it connect again the power supply.

DURING TESTING OF PROJECT:

¢ Each component should be checked before checking the project.

¢ Potentiometer should be adjusted at proper range.

Page 32: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

¢ Battery of the testing equipment should be properly checked otherwise it will not measure the actual reading.

¢ The components, which are not doing function properly, should be changed as soon as possible; otherwise, other components may also be damaged by it.

¢ Testing equipment should be in proper range when output measured at any point of the circuit, or component. Otherwise testing equipment may be showed the wrong reading.

Page 33: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

CONCLUSION

Page 34: Project Report

TEMPERATURE SENSOR AND CONTROL PROJECT REPORT (2011-2012)

REFERENCE:-

8051 and embedded system by Mazidi and Mazidi All datasheets from http://www.datasheetcatalog.com About AT89s8252 from http://www.atmel.com And http://www.triindia.co.in About DS1820 from http://www.dallas.com. And from www.seminarprojects.com