Temperature Controlled Fan
Temperature Controlled Fan
Temperature Controlled Fan
A PROJECT REPORT
Submitted by
PEEYUSH PASHINE(2011H140033H)
PRAVESH TAMRAKAR(2011H140036H)
SRI KRISHNA YADAV(2011H140031H)
J GANESH(2011H140032H)
TABLE OF CONTENTS
Page No.
3
1)Block Diagram
3
3
4
4
5
6
7
7
7
8
1.1 8051(AT89C51)
1.2 Temperature sensor(LM35)
1.3 ADC 0808
1.4 7 Segment display
2)Working
3)Simulations
4)Snapshots
5)Conclusion
6)Application
Page No.
3
7)Future work
8)Appendix
LIST OF FIGURES
1)Fig1
5
5
2)Fig2
3)Fig3
4)Fig4
5)Fig5
6
7
6)Fig6
7)Fig7
ABSTRACT
This project is used to control the fan speed according to the temperature and it also
indicates the temperature. The system will get the temperature sense from the
temperature measuring IC corresponding to which temperature digits are obtained and
displayed and it will control the speed of fan according the duty cycle(PWM) values
stored in a lookup table according to the temperature measured .
1. Block Diagram
Description :-As in Fig 1,the block diagram contains 8051 microcontroller, power
supply and reset circuit ,8 bit ADC ,temperature sensor LM35,motor driver L293D,
and DC motor(bipolar),sensor opamp circuit for generating interrupt(to enable or
disable entire operation) ,input switches for manual operation and display devices(7
segment).The flow of program is as power supply is provided to motor
driver,8051,switches and ADC0808.The measured temperature is given to ADC and
converted digital data from ADC is given to 8051 for further operation, display and
speed variation, motor is driven by driver circuit.
1.1
1.2
Seven Segment display: - A seven-segment display (SSD), or sevensegment indicator, is a form of electronic display device for displaying decimal
numerals that is an alternative to the more complex dot-matrix displays. Sevensegment displays are widely used in digital clocks electronic meters and other
electronic devices for displaying numerical information. For displaying each
alphanumeric code, 7 segments requires unique hex code.the schematic is as in
fig4 and 5 below.
DIGIT----
HEX CODE
0
7E
1
30
2
6D
Fig 4 (7 segment)
3
79
5
33
5
5B
6
5F
7
70
8
7F
9
7B
2. Working: -
In fig 1 all the modules used are integrated, here is the working
description about project. Speed of fan is monitored by temperature variation. Basic idea
behind project is getting the temperature, displaying the temperature and change in
temperature is reflected as change in speed of fan. We are using LM35 temperature
sensor(shown in fig 2), whose output is given to ADC(see fig 3).The entire working is
enabled or disabled by external interrupt(so it acts as a switch)the interrupt signal is
generated by opamp sensor, which can be calibrated for different type of sensors.
The output of ADC used to select unique values of temperature from look up table in
program, based on different output values of ADC, different 2 digits value for temperature
representation are selected, which in turn are provided to display port. Display port includes
7 segment display devices(refer fig 4 and 5), where alphanumeric symbols/digits are
displayed using some special HEX code, preconfigured for 1 seven segment display. By
enabling one 7 segment at a time, no of digits can be displayed to several segments via just
one port. We are using two 7 segment display required to represent 2 digit temperature (Here
Celsius is taken by default)
Finally the displayed values from a temporary register are used to select the
distinguish delay according to digits. For speed variation we have used PWM concept which
in turn stands by duty cycle variation. Duty cycle variation needs, different on time and off
time duration, which are generated in program through delay generation logic, where value
of digit is inversely proportional to the delay value selected for off time delay from the speed
lookup table. This varying speed controls the running motion of dc motor. Further we have 2
modes of operation, manual and automatic, depending upon the status of active low input
switches, mode operation can selected.
7. Future work:-This
8.
APPENDIX
CODE:
;------------------------------------------;
;
SPDT
= Auto/Manual
SW2
= Off
SW3
= fcheck
;
;------------------------------------------off
equ
P1.0 // switch off, motors/fan will off if switch is off, active low switch
fcheck equ P1.1 // switch fcheck ,active low, if enabled vary the speed of fan according to
temperature value
automanualequ
P1.2
operation,otherwise manual
8
soc
equ
P3.1
read equ
P3.0
EXT_SIGNL equ
mode equ
20H
done
21H
equ
P3.3
operation
adc
equ
30H
adcport equ
P2
scratchpad
disp
equ
equ
P0
40H
// adcport
// a random ram location used for storage purpose in program
dc_mot1_t1
equ
p1.3
// terminal 1 of dc motor
dc_mot1_t2
equ
p1.4
// terminal 2 of dc motor
org 0H
sjmp start
org 13H
setb done
reti
start:
clr EXT_SIGNL
clr done
clr mode
mov IE,#10000011B
scan:
acall read_temp
sjmp manual
auto:
setb mode
manual:
JB mode,inauto
JNB off,fanoff
JNB fcheck,fanspeed
sjmp scan
fanoff:
clr dc_mot1_t1
clr dc_mot1_t2
back:
JNB off,back
sjmp scan
fanspeed:
mov DPTR,#Sptable
delay count,
according to temperature for varying duty cycle
according to temperature
acall temp_checker
setb dc_mot1_t1
clr dc_mot1_t2
acall ondelay
clr dc_mot1_t1
// call ondelay
// stop dc motors/fan
clr dc_mot1_t2
acall offdelay
// call offdelay
sjmp scan
inauto:
10
mov a,adc
clr c
cjne a,#30H,chk
chk:
jc fanoff
clr c
sjmp fanspeed
stay here
clr done
clr read
mov a,adcport
setb read
mov dptr,#ttable
movc a,@a+dptr
copied to A
mov adc,a
mov dptr,#dtable
swap a
anl a,#0FH
OF TEMPERATURE VALUE)
11
movc a,@a+dptr
segment) in A
mov adcport,#00
mov a,adc
anl a,#0FH
movc a,@a+dptr
segment) in A
mov disp,a
ret
ondelay: /*computing ondelay by subtracting the offdelay count from 100
mov r4,#100 basically calculating different duty cycle value and thus using pwm,
varying the speed, according to temperature for which distinguish delay
is generated using temp_check subroutine and sptable */
mov a,r4
subb a,r2
bigloop1:
mov r3,#50h
djnz r3,$
dec a
jnz bigloop1
ret
12
offdelay:
mov scratchpad, r2
and
temp_check subroutine
bigloop2: mov r3,#50h
loop:
djnz r3,loop
djnz r2,bigloop2
mov r2, scratchpad
ret
delay:
mov r6,#20
// normal delay
wait:
mov r5,#255
djnz r5,$
djnz r6,wait
ret
temp_checker:
// initializing r2 with 0
mov r1,#5
mov a, adc
swap a
anl a,#0fh
movc a,@a+DPTR
go:
addc a,r2
// copy content of A to r2
// again load value of adc to A
// mask lower nibble
13
movc a,@a+DPTR
add a,r2
mov r2,a
//add the content of a with r2,to get final delay sum for off delay
// copy it to r2
ret
org 300h
ttable: DB 25 26 27 28 29 30 31 32
DB 33 34 35 36 37 38 39 40
DB 41 42 43 44 45 46 47 48
DB 49 50 51 52 53 54 55 56
DB 57 58 59 60 61 62 63 64
DB 65 66 67 68 69 70 71 72
DB 73 74 75 76 77 78 79 80
DB 81 82 83 84 85 86 87 88
DB 89 90 91 92 93 94 95 96 97
DB 97 98 99 100 101 102 103 104
DB 105 106 107 108 109 110 111 112
DB 113 114 115 116 117 118 119 120
org 400h
dtable: DB 54 32 78 ED 4F 2B 8E 6C AC D4
ORG 500H
Sptable: DB 18 16 14 12 10 8 6 4 2 1
END
14