You are on page 1of 13

ABSTRACT

We develop a Temperature Controlled Cooling Fan .This system provides a fan whose speed is controlled by microcontroller depending on the present temperature along with a temperature sensor and an ADC.

Temperature controller can be done by using Electronic circuit, Microprocessor or microcontroller. Now microcontroller is advanced among all above circuits therefore we are using Microcontroller for temperature controlling. In this project, microcontroller 89s51 forms the processing part, which firstly receives data from ADC. ADC receives data from temperature sensor. Then microcontroller 89s51 performs the comparison of current temperature and set temperature as per the logic of program for which microcontroller has already been programmed. The result obtained from the above operation is given through output port of 89s51 to LCD display of relevant data and generated pulses as per the logic program which is further fed to the driver circuit to obtain the desired output of the fan.

The "Temperature Controlled Cooling Fan" is designed around the microcontroller. The main blocks of the system are: Micro-controller board: It 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 Atmels high-density nonvolatile memory technology and is compatible with the 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, it provides a highly flexible and cost effective solution so many embedded control applications.

Block Diagram

Temperature Sensor

ADC

Power Transistor

LCD

AT 89S51 C
Cooling FAN

Power Supply +5/+12v/Gnd

Parts of this project Hardware: 89s51 DC Motor LCD ADC Temperature Sensor Cooling Fan Software: Embedded C WinQCad

PROGRAM CODE

#include <reg51.h> #define uc unsigned char unsigned int ontime,offtime,tempdata,ontimeref,offtimeref,temp,comp; void lcd_com(uc command_word); void lcd_data(uc value); void display(uc *s); void lcd_init(); sbit rs=P1^7; sbit en=P1^6; sbit start=P1^1; sbit oe=P1^0; sbit eoc=P1^2; sbit speed=P1^3; void pulseon(); void pulseoff(); void delay(unsigned int y); //creates a delay //pulse determining fan speed //selects command mode

//selects data mode //displays values //initialize lcd //register selector (mode selector) //enables lcd ouput so that repetition of character displey is avoided //start conversion //output enable //end of convertion

void converts(unsigned int g); //converts character to ascii to display it on lcd void timer0(void) interrupt 1 { pulseon(); return; }

void timer1(void) interrupt 3 { pulseoff(); return; } void main() { speed=0; P3=0xff; P2=0; lcd_init(); lcd_com(0x80); display("Temp Controller"); lcd_com(0xc0); display("Current Temp:"); ontime=0; offtime=0; comp=35; TMOD=0x22; TH0=0; TH1=0; IE=0x8A; TR1=1; TR0=1; //10001010 (0 & 1 timer interrupts enabled //strt timer 1 //start timer 0 //both timers mode 2 & 8 bit auto reload //second line first position //first line first position

while(1) { oe=1; eoc=1 ; start=1; delay(1); start=0; delay(5); start=1; while(eoc==1); oe=0; delay(5); tempdata=P3; delay(5); oe=1; if(tempdata>=0 && tempdata<=19) { temp=28; converts(temp); speed=0; ontimeref=1000; offtimeref=1; } //read data //end of converstion //start of convertion

if(tempdata>19 && tempdata<=22) { temp=29; converts(temp); ontimeref=900; offtimeref=100; } if(tempdata>22 && tempdata<=25) { temp=30; converts(temp); ontimeref=700; offtimeref=300; } if(tempdata>25 && tempdata<=28) { temp=31; converts(temp); ontimeref=500; offtimeref=500; } if(tempdata>28 && tempdata<=31) { temp=32;

converts(temp); ontimeref=300; offtimeref=600; } if(tempdata>31 && tempdata<=34) { temp=33; converts(temp); ontimeref=1; offtimeref=1000; offtime=0; } if(tempdata>35) { speed=1; ontimeref=1; offtimeref=1000; offtime=0; if(tempdata>comp) { comp=tempdata ; converts(temp++); } else {

comp=tempdata; converts(temp--); } } delay(800); } } void pulseon() { ontime++; if(ontime>=ontimeref) { ontime=0; speed=1; } return; } void pulseoff() { offtime++; if(offtime>=offtimeref) { offtime=0; speed=0; }

return; } // lcd functions void lcd_init() { lcd_com(0x38); delay(1); lcd_com(0x0c); delay(1); lcd_com(0x01); delay(1); lcd_com(0x02); delay(1); return; } void lcd_com(uc command_word) { rs=0;//command mode P2=command_word; en=0;// data is read delay(1); en=1; delay(1); return; } //returns cursor to initial //no commadnd or data to LCD until it finishes execution //clear display in memory //display on curser off //5*7 FONT 8 BIT 2 LINES

void lcd_data(uc value) { rs=1; P2=value; en=0; delay(1); en=1; delay(1); return; } void display(uc *s) { while (*s) { lcd_data(*s); delay(1); s++; } return; } //convertion void converts(unsigned int g) { unsigned int x;

x=g/100; x=x+(0x30); lcd_com(0xcd); lcd_data(x); g=g%100; x=g/10; x=x+(0x30); lcd_com(0xce); lcd_data(x); x=g%10; x=x+(0x30); lcd_com(0xcf); lcd_data(x); return; } // delay void delay(unsigned int y) { unsigned int k,h; for(h=0;h<y;h++) for(k=0;k<=250;k++); return; }

Working Temperature sensor sense the temperature and produce an equivalent voltage .Since we are using LM35 transistor as temperatue sensor the voltage produced by it is linear to the present temperature. So no extra calculations are needed to convert voltage to its equivalent temperature in Degree Celsius .A offset was given to this voltage , to set the temperature as 28 degree C at room temperature . Now the voltage produced is connected to ADC ( Analog to Digital Convertor ) to convert the continuous voltage to samples so that the micro controller can control the speed of the fan on the basis of that readings. Sampled voltage is fed into microcontroller 8051 .Coding of it was done using Keil software . Program was written in embedded C. An external clock was also given to microcontroller . A power amplifier was connected to the output port from which connection to the fan is taken. It provides the essential power to drive fan . Some capacitors and resistors were also used to prevent feedback and to protect circuit. The project was made on the PCB. To design PCB , WinQCAD software was used .

You might also like