Microcontroller-based fan speed regulator

Control: management of fans, temp/rpm monitoring via soft/hardware

Moderators: NeilBlanchard, Ralf Hutter, sthayashi, Lawrence Lee

Post Reply
Mr Evil
Posts: 566
Joined: Fri Jan 20, 2006 10:12 am
Location: UK
Contact:

Microcontroller-based fan speed regulator

Post by Mr Evil » Thu Jun 28, 2007 1:46 pm

Here's something for the more electronically minded among you: A very simple fan speed regulator based on a PIC10F202 microcontroller.

Most fan controllers merely adjust the voltage supplied to the fan, or the pulse width in the case of PWM, and let the fan do with that as it will. That works fine of course, but it's possible to go one step further and regulate the fan speed to a specific RPM by including it in a negative feedback loop. This can be done by measuring the tachometer output from a suitably equipped fan and adjusting the voltage or pulse width until the tach signal matches the desired speed. This has the benefit that the fan always spins at the same speed regardless of the pressure differential, temperature, phase of the moon and whatever else affects fan speed.

Here is the circuit:
Image
Most of the hard work is done by the microcontroller, so the circuit ends up very simple. The PIC10F202 is small and very cheap (just a few pence), but it lacks more advanced features like EEPROM (so the fan speed setting can be stored when the power is off) and an analogue-to-digital converter (to allow temperature control), but that's ok because this is just an experiment intended to be simple, not a finished product.

The circuit is designed so that it can work in-line between a motherboard fan header and the fan itself, drawing power from the 12V fan supply and allowing the tachometer signal to pass back to the motherboard for RPM monitoring. There are two push buttons - one to increase the speed and one to decrease it. The two transistors change the 3V pulses from the microcontroller to the 12V that a fan needs. The capacitor C3 smooths the output voltage (it effectively turns the circuit into the simplest possible switch-mode regulator) so that the fan's tachometer output works all the way down to the slowest speeds and to reduce the clicking noises that some fans make at slow speeds with PWM. It does decrease the efficiency, but it does the job with the minimum component count.

Here's a photo of the circuit assembled on a breadboard:
Image
It looks a bit of a mess, but you can see just how few components it uses. It could be made small enough to stick to the back of a fan hub.

And here's a shot of the oscilloscope trace of the tachometer (top) and PWM (bottom) outputs:
Image
The PWM output is not very clear because it's at a much higher frequency than the tachometer signal (I chose 1.3kHz as it's the fastest that the PIC can reasonably do, and the faster it is, the easier it is to smooth to a DC voltage).

It works ok, regulating the fan speed quite precisely. It measures the number of tachometer pulses over a 3.1s period, which theoretically allows for a range of speeds from 10-2500rpm. 3.1s yields a rather slow response, but it's the best I can do without a more advanced microcontroller that can measure the time between two individual pulses. It employs basic proportional control but it's stable until the output voltage drops to around 3V, at which point it has a hard time because small decreases in the output stop the fan completely.

The firmware for the microcontroller is also very simple, taking up a mere 482 bytes in total. If you want to see the source code (in assembly), it's here: Fan Controller.asm

~El~Jefe~
Friend of SPCR
Posts: 2887
Joined: Mon Feb 28, 2005 4:21 pm
Location: New York City zzzz
Contact:

Post by ~El~Jefe~ » Fri Jun 29, 2007 7:21 pm

that is really neat :)

im not knowledgeable about such things, but I know how to turn out tricks on corners, you know, pimp things.

Can you make it? I would sell it.

Mr Evil
Posts: 566
Joined: Fri Jan 20, 2006 10:12 am
Location: UK
Contact:

Post by Mr Evil » Sat Jun 30, 2007 11:23 am

~El~Jefe~ wrote:...Can you make it? I would sell it.
I can make it alright, but the trouble is that I make these things by hand, which takes such a long time that it turns out to be unprofitable, especially for materially cheap things like this.

I normally just put these ideas out for other people to use themselves, but I suppose not many people have the equipment necessary to program a microcontroller, even if the circuitry itself is simple enough to be assembled by anyone who can pick up a soldering iron.

Post Reply