|
by Brad Collins
This fan controller uses a picaxe IC to control the speed of two 120mm DC fans. It has the following features:
- reads water temp using waterproof probe (1/16 degree resolution)
- programmable on, max and off temperatures
- programmable min and max fan speed
- fan speed varies between min and max as temp varies between on and max temp
- fan defaults to max speed if temp probe comes unplugged
Circuit Diagram
Circuit Diagram
Note: It may be a good idea to add a diode across the fan output.
Assembly and Installation
Circuit board assembled.
Parts installed in project box.
Sealed temperature probe.
Fans.
Code
'Fan Controller V1.4
'Copyright - Brad Collins 2008
'For PICAXE-08M
'Reads Temp from DS18B20 and adjusts fan speed via MOSFET
SYMBOL MAXTEMP = 480 'temps are degrees x 16
SYMBOL MINONTEMP = 432
SYMBOL MINOFFTEMP = 424
SYMBOL CALIBRATETEMP = 3
SYMBOL MAXSPEED = 200 'must be <= 4 x pwm period (50)
SYMBOL MINSPEED = 50 'must be high enough to start fan
SYMBOL TEMP = w0
SYMBOL SPEED = w1
w2 = MAXTEMP - MINONTEMP 'temp range
w3 = MAXSPEED - MINSPEED 'speed range
w4 = w3 / w2 'integer part of ratio
w5 = w3 // w2 'remainder of ratio
for b12 = 1 to 4 'flash LED on power on
high 1
pause 20
low 1
pause 200
next
do
high 1 'flash LED on temp read
pause 20
low 1
readtemp12 4, TEMP 'read temp from DS18B20
TEMP = TEMP + CALIBRATETEMP
sertxd(#TEMP,13,10)
if TEMP = CALIBRATETEMP then
for b12 = 1 to 4 'flash LED if no temp data
high 1
pause 200
low 1
pause 100
next
high 1
pwmout 2, 0, 0
high 2 'fan on high if no temp data
else if TEMP > MAXTEMP then
pwmout 2, 0, 0
high 2
else if TEMP >= MINONTEMP then
SPEED = TEMP - MINONTEMP * w4 'convert integer part of temp to speed
SPEED = TEMP - MINONTEMP * w5 / w2 + SPEED 'convert remainder part and add interger part
SPEED = SPEED + MINSPEED
pwmout 2, 50, SPEED
else if TEMP < MINOFFTEMP then 'fan will stay on low between MINONTEMP and MINOFFTEMP
pwmout 2, 0, 0
low 2
end if
pause 5000
loop
Completed
Installed fans.
Completed unit.
Only registered users can write comments. Please login or register. Powered by AkoComment! |