AVR Fan Controller



Preface


A great little project for the AVR would be to make a complete fan controller. The many integrated functions of the ATmega8 or ATmega16 makes it easily used for process control. Analog to digital converters for temperature and voltage monitoring, interrupt inputs for tachometer count and timers and PWM circuitry for fan supply voltage control.
In some regards it is also less than perfect, since both models can only really control one fan per ic. Even with the physical smallest model having a 28 pin ic per fan is a bit much. Anyway there is always the fun factor of doing a project like this yourself.
Hopefully there are bits and pieces that you perhaps can use for inspiration.






Support circuits - NPN driver



Tested and working.
The Darlington pair formed by the small power BC547 and the higher power BD911 gives a combined current amplification (hFE) high enough to use a base resistor of 10K ohm drawing very little current from the AVR. The capacitor is not strictly nessasary, but does smooth out the current flow a little.
This circuit is only intended to be used on a fan without a tachometer output because the fan is not connected directly to ground.




Support circuits - Simplified NPN driver



Untested.
After reading the datasheet for the BD911 I realized that it actually had much better specs than I thought. The current amplication is high enough, I my case, for the AVR to drive it directly. I use a fairly big 120mm fan that draws 0.35A at 12Vdc. The datasheet readout says hFE is 250 at those values. That gives Ib = 0.35A / 250 = 1.4mA and the value of the base resistors (R1) becomes R1 = (AVRout - Ube) / 1.4mA = (5 - 0.6) / 1.4mA = 3.1K ohm. Rounded down to the nearest resistor in the E12 series Rb becomes 2.7K ohm. With Rb being 2.7K ohm the current drawn from the AVR is Ib = (5 - 0.6) / 2700 = 1.63mA.
The absolute maximum current allowed for the AVR is 40mA per IO pin.



Support circuits - PNP driver



Tested and working.
This is my first attempt where the PWM driver is in top thereby having the fan firmly on the ground. I was going to wait for a FET I ordered but it has been delayed so I scrambled through a small collection of old Japaneese transistors I desoldered many years ago. That explains why on earth I'm using a 2SB861.
Just for fun I just took a quick scan on the internet. I can't seem to buy one anymore nor its replacement the 2SD1138, so just pick something more sane for your setup.



Additional reading


AD3802.pdf - Analog Devices Application Note: Why and How to Control Fan Speed for Cooling Electronic Equipment.
AN1784.pdf - Maxim Application Note: Fan Speed Control is Cool!