Color Changing Digital PC Fan Controller using Microcontroller ATMega168

We’ve all seen LED fans that you can put in your computer to make it look cool.  They usually come in blue, sometimes red or green and consist of a basic PC fan with 4 bright LED’s mounted in the 4 corners.  They source their voltage from the fan’s power input, so if you’re using a fan controller (either the one built into your motherboard or otherwise) to slow the fan, the LED’s get dim.
Well, I got a new case for my server and it took 120mm fans, so I had to buy new fans for it.  I got a nice blue LED fan for the front but one of the LED’s was burned out and it didn’t look good, plus the fan was loud and I was out of controllable channels on my motherboard.  I got a free replacement for the bad LED, but I already had my mind set on converting the fan with the bad LED into something much better using what I’d learned about microcontrollers last Fall.  The plan?  A self-contained, digital, full control fan controller based around an AVR microcontroller that could have fine control over the fan’s speed, read back the RPM, and control not just the brightness of the LEDs but also the color.  Having seen a lot of cool projects using RGB (red-green-blue) LED’s online, I figured it would be a good project.

Find a suitable fan for modification.

fanIf you don’t have an LED fan already, you can’t just convert a plain fan.  The fan I am using cost $5 on NewEgg and they sent me a free replacement for one bad LED (yet they let me keep the “bad” one so I used it for this project).
Things you want:
Clear plastic.  Tinted plastic may give unwanted effects (but if you want to try, go ahead, it may produce a neat effect, I tried one RGB LED on a blue-tinted fan and it looked OK).  Black plastic won’t give you the same effect, though I’ve seen LED fans that have black plastic and they do give the LED lines when spinning.
3rd wire (RPM sensor wire).  This wire (usually yellow or white) is what fan controllers use to count RPM.  It pulls low (connects to ground) twice per revolution of the fan, so you count falling edges per minute and divide by 2 (or count falling edges per second, divide by 2, and then multiply by 60).
3-pin connector.  The 3-pin connector is a PC fan standard, it’s the connector that motherboards use and it’s the connector I designed my controller to use.  Some newer fans that use 4 pin connectors won’t work for this project.  It may have a 4-pin Molex (power supply) connector, I just cut it off and used that connector to connect the fan controller to my computer’s power supply.

Parts List

This is going to be fun…
1 – ATMega168 (DIP28 through-hole package)
1 – MAX232  or equivalent (DIP16 through-hole package)
IC sockets:
1 – DIP28 socket
1 – DIP16 socket
1 – PNP, I used D1616 (NPN) and B1116 (PNP) transistors, they’re capable of 1A current
1 – NPN  If you use any other transistors, they MUST BE ECB (where base is on the end, not the middle).  This is different from most other transistors I’ve seen and didn’t notice until I tested them after I ordered them.  They were cheap though so w/e.
Here is where I ordered them:
5 – 1.0 uF capacitors, I just used some little blue ones, they’re either ceramic or similar, not electrolytic.
3 – 1KOhm, 1/4 watt (though you could get by with 1/8 watt easily)
2 – 10KOhm, 1/4 watt (also could use 1/8 watt)
12 – 300 Ohm, 1/4 watt (might be able to use 1/8 watt, these handle the LED current)
4 – 5mm, Common Cathode RGB LED’s – I used clear (not diffused) ones and diffused them with sandpaper.  I think regular diffused ones would probably be “too diffused” and be a bit dim.  I got a 50 pack of these RGB LED’s on eBay from China, was only $15 shipped, compare to Mouser’s $2.00 per single LED before shipping.
I used 0.1″ (2.54mm) breakaway pin headers for all my connections.  To connect to them, I got a 32-pin rectangular connector that fits 0.1″ pin headers and then cut it into pieces.  I got one that was through hole so it had pins that were easy to solder to.
Copper-clad, single sided PCB that is at least probably 4″x2″.  I used a 6×6″ and there’s room to make at least 2 more.
A laser printer to print the PCB design, just any old laser printer should work.

Remove the original fan LED’s.

To start out, you need to modify the fan so it has RGB LED’s in it.  The hardest part is removing the old LED’s as they’re probably glued in pretty well.  I just took a small screwdriver and pushed them out from the front (be careful around the fan blades, don’t break them!).  After pushing them out, I desoldered the blue LED’s and put them in my parts bin (they still work, so they’ll be useful later).  I then taped up the LED wires with clear tape so it wouldn’t short out.
After this, plug the fan back in and make sure it spins without the LED’s.

Solder wires to the RGB LED’s.

I used flat ribbon cable for this.  You need 4-wire cable that is thin enough to wrap around the fan without too much work.  Ribbon cable (not the really flat stuff, but like IDE cord type wire) is very good for this as you can tape it to the outside of the fan.  Use pliers to bend the leads from the LED at a 90 degree angle.  Keep the bend close to the base of the LED so that it won’t stick out of the fan or obstruct the fan mounting holes.
After bending, carefully solder the 4 wires to the 4 pins of the LED.  Don’t leave the soldering iron touching the LED for a long time as LED’s are sensitive to heat and you could burn out one or all of the colors, rendering that LED useless.  In case this does happen, try “zapping” the non-functioning LED with 5 volts (no resistor).  I had the blue LED on one of mine not work, but after hitting it with straight 5V for like 5 seconds, it started working and works fine now.
Clip the excess leads and put tape or glue around the connections to protect them.
Repeat until you have 4 RGB LED’s that have wires coming off of them.  Make sure you know which wire goes to which (test them with a battery, the longest pin on the LED is the ground [cathode] and the others are red, green, and blue, find out what is what with a battery and remember it or write it down).  Test to make sure all the colors light up when connected as well.
For more Detail: Color Changing Digital PC Fan Controller using Microcontroller ATMega168

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top