• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Simple Fan Controller

    Blog entry posted in 'Electronics and Other Ramblings...', December 16, 2011.

    This is one of those see-a-need, fill-a-need type of projects. A while back I was struggling with my cable modem and wireless router. I have the cable modem, the router, and the telephone modem all co-located on the same area. It is a small area on our workroom which happens to share the printer as well. The printer is more accessible and visible (for obvious reasons), but the modems and the router are not. As it happens, the telephone modem seems to be pretty robust; but the cable modem and router (mainly the modem) are quite the pre-madonnas. After a week of continuous use (especially during summer), those two boxes get quite toasty (the cable modem is king though). Once this happens the whole network crawls to a stop until eventually it locks up. The solution: power down the modem (and sometimes the router), let it rest (cool down) for a few minutes and try again. In reality this screams: get a new (better) modem, and perhaps a better router. But there is one point which also became obvious: the location I'm using is less than optimal (airflow-wise) and I need to improve on the airflow.

    So in came the simple fan controller. What it was meant to do was monitor the space/cavity temperature and apply forced cooling (i.e. external fan) to the modem and/or router as required. To do this a PIC MCU would sense the temperature of the space/cavity and enable the fan as necessary.

    A few things came to mind. First, we needed a way to make sure the fan current was being monitored for potential stalls and/or power supply issues. Second, we wanted to measure the temperature and only turned the fan on when the temperature was above a certain limit.

    Well, as all other great plans; once you start executing it, things change quite fast. So what happened, even though monitoring the current to prevent stalling and monitoring the temperature are worthy goals; we were over-complicating the main goal. The main objective was to lower the temperature of these devices using forced air (i.e. a fan). But we added the current and temperature sensing as nice things to have, but not necessarily a requirement.

    As it turned out, the temperature monitoring was a bit misleading. I managed to monitor the temperature alright; but the temperature change (measured as ambient near the devices) did not vary significantly. More importantly, the limits during summer and winter were quite different. Also, I discovered that regardless of season, if I turned he fan on and off a timed intervals, that was sufficient to keep the temperature under control. So I go back to what is really needed. Temperature sensor is on the design, but it's really not used right now.

    The current monitor suffered a similar fate. Even though that one is really useful, for the first proto I decided it was not worth the extra effort to accommodate this feature. Again the current sensing is there, but it's not currently used.

    Ultimately the following schematic shows what I built.


    There is a simple current sense circuit (resistor), and a temperature sense; but these are not implemented yet. There is a simple on/off transistor to the fan which allows to enable/disable the fan; and/or apply speed control (if desired).

    Below is a sample of the code (Oshonsoft Basic) which operates this controller. Interestingly, the simple enable/disable o the fan at timed intervals has been sufficient.

    Code:
    'languer (2011)
    'Pin Allocation:
    'PIN# Main_Fn Secondary_Fn
    'GP0 -> RS232_OUT ICSP-DAT
    'GP1 -> VREF ICSP-CLK
    'GP2 -> FAN_MON
    'GP3 -> MCLR
    'GP4 -> T_SENSE
    'GP5 -> FAN_CTRL

    'General Configuration
    Define CONF_WORD = 0x33c4 'for internal 8MHz osc

    'Oscillator/Clock Configuration for internal 8MHz osc
    Define CLOCK_FREQUENCY = 8
    OSCCON = 0x71

    'Variable Declarations
    '>>I/O
    Symbol rs232_out = GP0 'rs232 output
    Symbol adc_vref = GP1 'voltage reference input
    Symbol fan_sense = GP2 'fan current sense Input
    Symbol temp_sense = GP4 'temperature sense input
    Symbol fan_ctrl = GP5 'fan control output
    Const _trisio = %11111110
    '>>Constants
    Const fan_off_time = 120 'time fan is off, in minutes
    Const fan_on_time = 5 'time fan is on, in minutes
    '>>Variables
    Dim _true As Bit
    Dim _false As Bit
    _true = True
    _false = False

    'Main Program
    main:
    WaitMs 2500
    Call init()
    While _true
    Call wait_minutes(120)
    Call fan_enable()
    Call wait_minutes(5)
    Call fan_disable()
    Wend
    End

    Proc init()
    AllDigital
    TRISIO = _trisio
    Serout rs232_out, 9600, "Starting...", CrLf
    End Proc

    Proc fan_enable()
    'enable fan
    Config fan_ctrl = Output
    Low fan_ctrl
    Serout rs232_out, 9600, "FAN On", CrLf
    End Proc

    Proc fan_disable()
    'disable fan
    Config fan_ctrl = Input
    Serout rs232_out, 9600, "FAN Off", CrLf
    End Proc

    Proc wait_minutes(time As Byte)
    Dim cnt As Byte
    cnt = 0
    While cnt < time
    WaitMs 100
    'WaitMs 60000
    cnt = cnt + 1
    Wend
    End Proc

    Comments
    ElectroMaster, December 17, 2011
    A great circuit. I'm sure lots of people will find this useful, I've got my comp and router in a very hot place and just have a fan working all the time :( not efficient at all so I like this circuit! PS. The schematic is small and I can't quite make out things. I bigger version would be great.
    languer, December 17, 2011
    [QUOTE=ElectroMaster;bt508]A great circuit. I'm sure lots of people will find this useful...[/QUOTE] Thanks. I started with a continuous fan as well and migrate to this a while back (when I had a bit of time to get this up and running). Uploaded a better picture as well.
 

EE World Online Articles

Loading

 
Top