Senin, 11 Juni 2012

Intelligent Fan Controller

During the Maker Faire Salvage Crawl last month, I picked up a kiosk-size industrial computer for $20.  All well and good, except that the BIOS in it made no effort to control the fan speeds, and instead simply ran all three cooling fans at full blast.  This was unpleasantly loud, so I decided to simply build my own fan controller, using an MSP430, so I could easily monitor the system temperature and adjust the fan speeds accordingly.

Video:

As a bonus, while waiting for the computer to heat up, I give you a basic intro to the concept of a PID controller.

The hardware isn't too involved; an MSP430G2452 takes temperature readings from the CPU via a 10k thermistor, then uses this to set the fan speeds for the three fans. 

Computer fans typically come in two varieties; three pin and four pin.
  • Three pin fans have, in order, a ground, a 12V supply, and a tachometer pin.  By applying a pull-up resistor to the tach pin, the fan outputs two pulses per rotation, so the MSP430 can count these pulses and know how fast each fan is spinning.  To adjust the speed of the fan, the MSP430 pulse-width-modulates the 12V pin at 32Hz.
  • Four pin fans are backwards compatible with three pin fans, with the addition of a fourth pin for speed control.  Instead of requiring the pair of transistors to switch the 12V line as in the case of the three pin fans, you can instead simply apply the 3.3V PWM signal to this fourth pin and the fan will use it to modulate its power itself.
 This computer happened to come with two three-pin fans and a single four-pin fan, which is why I only needed two NPN-PNP transistor pairs, to switch the two three-pin fans.  The four-pin fan is controlled directly from the MSP430 digital output.
I have moved almost entirely to using 0603 surface mount passives on my prototype projects; fitting circuits on perf board is much easier when you can fit passives like resistors or capacitors between any two adjacent pins.
In the schematic, I forgot the input 10μF caps on the 12V and 5V lines.  The entire circuit board is powered using the standard 0.1" floppy disc power connector (12V (yellow), GND, GND, 5V (red)), since those tend to be numerous and under-utilized inside desktop computers.

One thing to appreciate when reading my code is that I have very deliberately left the control code weak.  It is currently a purely integral controller, which has many disadvantages which can be improved via switching to a PI controller and implementing integral spool-up prevention.  I'm considering revisiting this project with another hardware revision and some controller algorithm refinements, but alas the hazard of having this one "mostly-working" means that may take a while... I'll leave programming a faster temperature control loop as an exercise for the reader.

Source code:

Related Article

Intelligent Fan Controller
4/ 5
Oleh

SUBSCRIBE

Enter Your Email For Update Articles..