## Build A Pulse-Width-Modulation Fan Controller

Detailed How-To – L337 M33P, aka Jonathan Bell

IMPORTANT INFORMATION FOR PEOPLE BUILDING OR USING MY FAN CONTROLLER

Under testing conditions in the PC, I have come across a design weakness in
the 556 circuit. The discharge pin will draw a considerable current through
the 12 ohm resistor when the device is set for 100% output, i.e. the
discharge pin is continually discharging. THIS CURRENT HEATS THE 556 UP and
if both channels are run at 100% for extended periods of time the 556 MAY
OVERHEAT? After 30 minutes with both channels at 100%, the 556 was hot
enough to give a mild burn to the end of my finger. I was first alerted to a
problem when the circuit cut the fans out at 50% pot travel instead of
keeping them spinning all the way down.

DO NOT use the fan controller at 100% on either channel. I will modify the
circuit to eliminate this problem. It will most likely be a fix consisting
of replacing the 12 ohm resistors with ones of higher value to reduce the
current draw.

From an (OC Forums Poll,) people seem to have an average 4-5 case fans – enough to need some kind of fan control if you don’t want to go insane because of the noise.

Many people have rheostats/potentiometers that control their fans. In essence, these are large variable resistors that are used to reduce the current to a fan and slow it down, giving the user a degree of analogue control. These are fine up to a certain extent, but the greater the load placed on the rheostat, the larger the thing has to be in order to dissipate the heat produced.

Example: A Delta 80mm fan draws 0.80 Amps at 12v, as per their data sheet.

At 6v, assuming that the fan is resistive (big assumption, but who cares), the rheostat will be dissipating the most heat -

The fan will draw 6 / 12 * 0.8 = 0.4A

The rheostat, which must be dropping the other 6 volts, will have the 0.4A flowing through it:

• Power = I*V
• Power = 0.4 * 6 = 2.4 watts

This means that at least a 10 watt rheostat must be used, as the power dissipation is only occurring along part of the track – the dissipation figure for a variable resistor is for the whole thing, not just the bit that has current flowing through it. The size of 10W rheostats is not small and they are not that cheap either, as they are most likely wirewound or ceramic cased – not the cheap carbon types. If you don’t use a large enough pot, then the thing will glow a nice orange colour and smoke heavily.

Also the rheostat is not too efficient – its efficiency varies with the voltage supplied to the fan, such that it is 100% when at 12v across the fan and drops to 50% when the voltage is 6v. This means extra heat in your case, and with highly overclocked PCs, this is a bad thing; imagine 4 Delta fans on your rheostats at 7v, causing it to kick out 12W of heat that is wasted. Not only is that heating your case but it is drawing it off the PSU’s 12v line, and with a hefty overclock you need all the amps you can get.

There is another way though – one that is both affordable, efficient and can supply enough amps for you to run 3 Delta 92mm fans on ONE CHANNEL – and the controller will have two. This article tells you how to make one.
{mospagebreak}

Jonathan Bell – aka L337 M33P

Introducing PWM

It is based on the principle of Pulse-Width Modulation, as you may have guessed from the title . Its requirements are cheap components, a little soldering skill/electronics know-how and a free 5.25″ external bay slot with bezel that you are willing to mutilate – err, convert.

The principle of PWM is that the output voltage is switched on and off at a high rate, with the proportion of “on” time compared to the “off” time giving the equivalent output voltage. E.g., if the voltage was 12v for 50% of the time and 0v for the other 50%, you would effectively get 6 volts.

As you might have guessed, people have done this sort of thing before with fans and “true” PWM, which does not smooth the output and merely uses 12v then 0v then 12v then 0v at about 200 Hz. This is fine for non-RPM sensing fans, but with RPM sensing, this majorly screws up the readings or makes the sense circuitry not work at all. It can also give problems if the frequency/fan speed is too low (a buzzing sound can be heard) or if you use it with “brushless” fans – they have circuitry that switches over the voltages to the stationary coils when the next magnetic “pole” comes into alignment and won’t be too happy with suddenly changing voltages.

Smoothing the output requires a few extra components but will work with many more fans and still have the high efficiency of a PWM-based design. The RPM sense signals will also still be readable by the motherboard, which is a bonus if the fans are in critical positions, like on the CPU heatsink (word of warning: I wouldn’t recommend using the fan controller with such a vital fan unless you have thoroughly tested the thing beforehand).

The high efficiency of PWM comes from the fact that the control circuit is either fully conducting or off at any point in time. This means that very little power is wasted in the circuitry, as it is either full on or off, with 0V across it or 0A current flowing through it. As Power = V * I, when either V or I is 0 the power dissipated is 0, so in theory the circuit should be 100% efficient. In practice it is not, as the circuit takes a small amount of time to come on (and therefore having a period where there is some volts and some amps flowing) and there is a slight voltage drop across the circuit at full on, leading to about 85% theoretical efficiency overall.

The DIY fan-controller has been done before, using LM317s, transistors, rheostats and “true” PWM control, but as you can see in the links below, they have some design disadvantages that, IMO, can outweigh their benefits.

The best true PWM controller I have seen so far is Aardil’s Fan Controller, which is a good PWM controller in its own right. But before you all complain that I ripped the design from him, I designed my circuit without prior knowledge of him or his circuit – great minds think alike Here are some articles on the pros and cons of different methods of fan control:

And here is Nomad’s fan controller

The Vantec Nexus and Sunbeam Rheobus are the commercial versions of PWM fan controllers, with 3 and 4 channels respectively. They aren’t exactly cheap though, costing upwards of £25. With this design, you will be using readily available and cheap components, and if you already have some electronics junk knocking around, it will be even cheaper.
{mospagebreak}

Jonathan Bell – aka L337 M33P

Enough theory, I can hear you yelling Well tough, there’s a whole lot more to come… skip it if you like, but it details how the thing works.

The Circuit

The fan controller’s main components are:

• 1×556 dual timer IC
• 2x Potentiometers, low power
• 2x Power MOSFETs, TO-220 case styles
• 6x Diodes – 2 high power, 4 signal
• Capacitors and resistors

The 556 IC is an industry-standard dual timer IC (555 is a single timer) that produces square wave pulses. It is possible to modify a simple 555 circuit to produce pulse-width modulation; all you need is a couple of diodes…

Argh! Complicated circuit, ay? Not very complicated after you understand what it does.

The capacitor on the far right is the cap that charges and discharges through the resistors. The frequency of the output wave is about 3.8 KHz with this set of resistances. The capacitor charges up through the right-hand diode and discharges through the left. The 555 has a set of internal comparators that effectively tell the capacitor to charge and discharge at 1/3 of Vs and 2/3 of Vs respectively.

Since the mark-time and space-time add up to make the time period, which is a constant, this means that the total time remains fairly constant throughout the potentiometer’s travel. Unfortunately, the frequency does vary a small amount as the 555 isn’t perfect; however, this should not be a problem, as in this circuit the output voltage is only varied between 11.4 and 5.4V with the frequency varying within about 10% throughout the potentiometer’s travel.

The range of voltage output is fixed by the two end resistors – 12 ohms is to keep the 555 oscillating at a decent frequency when the pulse width is near 0% (Pot at one end of its travel), and the 8.2k resistor sets the lower voltage limit at around 5v. Using a slightly lower value resistor would lower the voltage limit, but beware that 12v fans may stop working at voltages lower than 5v.

The 470uF/10nF capacitors at the top of the diagram are mostly there to provide power supply decoupling – the sudden changes of current flow demanded by the 555 and MOSFET can produce nasty spikes on the supply rail, so these capacitors placed on the PCB/Stripboard eliminate the noise generated. The 10nF connected to pin 5 is always there – it prevents the control voltage pin from floating.

Now here is a cunning bit – the pin RST (reset) of the 555 must be held above ~1 Volts for the 555 to give output pulses – if RST is below 1v, then the 555′s output is 0v. Now, if the output can be delayed at switch-on, this will make the MOSFETs’ output voltages at 12v for a short amount of time, spinning up fans that might otherwise not spin up at voltages below 7v.

That is the reason for the 470uF capacitor and 8.2k resistor connected to RST – when the supply is initially turned on, the voltage across the capacitor is 0v. As the capacitor charges through the resistor, the voltage across it rises. When the voltage at RST gets to above ~1v, the 555 will start oscillating and PWMing the fans. The time delay is about 0.8 seconds, which is enough time for most fans to get spinning. This does mean, however, that the capacitor will retain its charge for quite a while after being switched off (about 15 seconds), so if you power off, then on, you may not get fans spinning again.
{mospagebreak}

Jonathan Bell – aka L337 M33P

Now on to the rest of the circuit – the output power stage…

The output of the 555 (pin 3 in the diagram) is sent to the gate of a P-type MOSFET. This little dealie is almost exactly the same type as ones found on your motherboard controlling your Vcore. The gate is connected to the output of the 555, the source is connected to the 12v and the drain is connected to the smoothing circuit. The P-type MOSFET conducts when the gate voltage goes negative with respect to the source.

Thus because the source is connected to +12V, the MOSFET turns fully on every time the 555′s output goes to 0v, and turns off when the 555 goes to +volts. The “high” output of the 555 isn’t exactly 12v, but it is enough to be below the conduction threshold of the MOSFET (usually about -2V from the source pin) and so it turns off. Varying the pulse width varies the amount of time that the MOSFET is on for and so varies the output voltage.

Now here it gets a bit more complicated, you can skip this if you like

The smoothing circuit consists of the 3 x 470uF capacitors, the inductor and the Schottky freewheeling diode (1N5821), though any 3A 30V fast diode can be substituted. When the MOSFET is conducting, the capacitors charge up with current that consequently flows through the inductor and the freewheeling diode isn’t conducting.

When the MOSFET switches off, however, the inductor suddenly has a fast change in current to deal with. This produces a voltage across it, where the end connected to the diode goes negative and the other end goes positive. This makes the diode conduct and current still flows into the capacitors, albeit at a smaller rate. Thus energy is transferred quite efficiently from the 12v potential to the potential on the capacitors, and comes out nice and smooth.

At ~3 amps draw, the voltage fluctuation does get a bit out of hand, with about 0.4V ripple, so this puts an upper limit on the current you can draw. I think the device will be able to handle almost anything you put on it (except for a dead short) but the output will have unacceptable ripple. For the inductor, I will use a random ferrite circular ring with about 80 turns of 20AWG copper on it – this should give the necessary inductance and with the added bonus of a contained magnetic field, reducing possible EMI. The 3 x 470uF capacitors are there in place of a larger, single capacitor for two reasons:

1. It reduces the “equivalent series resistance” of the capacitor set – capacitors are limited by their internal resistance as to how much ripple current they can supply ie how much current when the MOSFET is off. Using 3 in parallel triples the ripple current they can produce and although the current draw is likely to be small compared to their maximum rating, 3 in parallel will reduce the ripple voltage as well.

2. It will allow you to order more of the same capacitor – and possibly give you a multiple item discount, as well as giving you fewer values to remember.

The 1k resistor after the capacitors is to stop excessive voltage build-up when there is no load on the circuit and the 2.2 ohm resistor is the simulated load of the fans – the actual circuit stops after the 10nF capacitor and has the Molex right after that.

Now, this is supposed to be a dual channel controller – this diagram was for the single one – BUT the 556 is just 2 555s stuck side-by-side with common ground and +VCC pins. It is a 14-pin DIP package instead of 8-pin DIP:

As it is a dual design, you will need two of everything in the diagram except for the supply decoupling capacitors at the top, and instead of 2 555s, you have a 556. If you also want to save a bit more on components, you can run both Reset pins from the same capacitor and resistor, the 8.2k + 470uF ones – just run a wire to it from the other Reset pin.
{mospagebreak}

Jonathan Bell – aka L337 M33P

Component List

So the list of components is: (GO BY THIS LIST, Circuitmaker6 (diagram above) has different components as it is a cut-down student version)

• 9x 470uF 16V electrolytic (radial wire ended)
• 7x 10nF Metallised Polypropylene capacitors
• 1x NE556N TTL Timer chip
• 4x 1N4148 or similar low power high speed rectifier diode
• 2x 1N5821 Schottky fast rectifier diode (or equivalent with 3A IF and Vreverse of 30V)
• 1x a bit of Stripboard (copper tracks under a 0.1″ matrix of holes), 3.5″ by about 6″
• 4x 8.2k fixed resistor (0.25W/0.5W carbon/metal film)
• 2x 22k linear potentiometers – carbon track, low power miniature type
• 2x 12 ohm fixed resistor (0.25W/0.5W carbon/cermet track)
• 4x 1k fixed resistor (0.25W/0.5W carbon/metal film)
• 2x P-type depletion mode MOSFET (Rds (ON) of <0.5ohms, Vgs of ~20V, Vds of >=30V, Id of ~5A, TO220 case style)
• 5x 4-pin Molex connectors (like the ones on hard drives, CDROM drives, ends of fan wires) – this is to mount on the board and you need the type you get on the end of PSU wires to make a daisy chain of connectors for fans. You could use floppy connectors at the input but they might get a wee bit hot. Frozencpu.com is the only place I have found that stock Molexes in quantities of less than 1000. Maplin.co.uk is the place of choice in the UK (although they are called drive connectors)
• 1x 5.25″ front bezel, some sheet metal and some screws with nuts – 4/3mm diameter for the MOSFETs and mounting the board
• Some 18/20AWG enamelled copper wire and a ferrite ring (or a 3A 470uH toroidial inductor)
• Red/black/yellow 20AWG multistrand insulated wire for the wire loom/internal connections
• Solder, soldering iron, insulated wires

You will also need a heatsink – I used 2 little pre-made ones for TO220 case styles – it doesn’t have to be huge. A large RAMsink-style one will probably do, or you could just use a piece of metal strapped to the stripboard and screw the MOSFET onto that. They must be separate from each other though!

The total cost of components is less than that of the commercially available ones and, of course, will look less pretty without the LEDs – but hey! It can handle 36W per channel! Plus you get the satisfaction of making it yourself
{mospagebreak}

Jonathan Bell – aka L337 M33P

Construction

Mail call!

This is an initial placement “sketch” made by just poking the leads through holes – gives an idea of how large this thing will be (the grey rectangle is my spare drive bay bezel, which is going to be butchered – er, eventually cut up and made into a fan controller):

Poor OEM-looking computer never saw the marauder coming…

Now before you do ANYTHING, print out the circuit diagrams and use these to work from. The circuit diagram shows a 555 circuit with pin designations and the 556/555 diagram shows the equivalent pins for the dual chip.

Now the trick to working on stripboard is making everything squeeze up tight – with a little ingenuity, you can fit the components quite densely. Use your common sense to find what attaches to what – it’s fairly easy to get the hang of.

The tracks underneath the board run horizontally, ie, you poke the component holes through, solder them and all the ones on adjacent holes in a row are connected. You can break the tracks with a 3mm HSS drill bit – this is absolutely needed between the legs of the IC and it is advisable to shorten the tracks where the signals run to reduce possible interference.

Now on to the inductors – I wound my own but if you bought yours pre-made, then you can skip this step. I wound mine because I could then use much thicker wire for it (20 SWG) than I would’ve if I had bought it, which reduces DC resistance. If you want to roll your own, you will need a circular ferrite ring, the data for the ring (Specifically the AL, or Inductance/turn) and enamelled copper wire.

The ferrite cores I got were pink for some reason… O_o

The AL value for this ferrite was 77 nH per turn, and using the formula

No of turns = Sq Root [(Required inductance [470uH] / AL [0.077uH/turn])]

Gives about 80 turns of wire. This formula only holds true for toroidial inductors – linear ones are much more complicated, as the magnetic field is open at both ends. Then using the good old pi * D * 80 formula, I calculated the total length of wire needed and it came out to about 3.25 metres.

Using a ferrite ring of that size means that there is quite a squeeze fitting 80 loops through the middle, as you can see in the pic. It helps to be neat, as my second one was able to take the full length of wire – my first attempt (left) had about a foot spare.

This is a pic of the board with the inductors and the 556 circuit added. All that needs doing are the MOSFET gate resistors, heatsinks, two more wires and soldering the whole lot together:

The heatsinks will just about fit in the gap… the inductors are quite bulky and I should have left more room for them, but I didn’t because the board is a bit on the small side – the smoothing capacitors will have to budge over.
{mospagebreak}

Jonathan Bell – aka L337 M33P

This is a high-res pic of the circuit itself: Places where the tracks underneath need to be cut have red dots over the corresponding holes. The wire that disappears under the top pot goes to the middle pin. The resistor values are on the picture, and the diode orientations are as follows: (up being black stripe at top, down at bottom) from left to right they go up down up down. All the small rectangles are 10nF capacitors, the big blue cylinders are the 470uF capacitors. I put some sleeving on the exposed leads of the caps as they are the highest components around. You can copy this diagram pin-for-pin if you like, just make sure all the components go in the right holes and that you check it against the circuit diagram.

Here is a shot with the smoothing caps in place, MOSFETs and all:

Now for soldering: Soldering on stripboard is easy, just angle the soldering iron bit to make a triangle between the track, leg and itself and feed the solder into the hole. The solder should melt and form a little shiny oval that joins seamlessly with the leg and the track. Grey or dull solder joints are “dry” joints and need to be re-done.

The inductor wires had polyurethane insulation on, which meant the solder would not stick to it – I had to melt the insulation off starting from the top of the lead downwards. It decomposes to black crud and smells, but is easy to scrape the residue off. Some solder spilled over onto an adjacent track – you clean up such bridges by running the pointy end of the bit up and down the track. Make sure you leave clear copper between the inductor leads, as the track needs to be broken between them and solder isn’t as easy to drill through as 0.1mm copper =)

{mospagebreak}

Jonathan Bell – aka L337 M33P

To break the tracks on the underside, I used a 4mm HSS bit in a cordless drill – use the drill on slow and only make an indentation the width of the track – you drill right the way through later.

I mounted the MOSFETs with M3 screws and 4mm holes in the stripboard – it goes

and yes, that is Arctic Silver Céramique on the MOSFETs =). The wiring of the Buck converter was done with equipment wire, as I don’t trust the Stripboard tracks with this much current. The MOSFET pins have the tracks cut before and after them, with point-to-point wiring taking care of the current. The gate leads are run directly from the outputs of the 556 and it seems to work fine without the gate resistors in the diagram, as the 556 can both source and sink current.

I also “reinforced” the tracks on which there is going to be current flowing with lots of solder.

For the output wires, I drilled a 2mm hole in the stripboard, threaded the wires through it and then soldered them like so – makes them more sturdy and less likely to break off:

{mospagebreak}

Jonathan Bell – aka L337 M33P

Testing and evaluation

After making sure the 556 circuit was working (no thanks to Maplins – I got a dead 556 _) using an oscilloscope at college, I took it home to finish off mounting the MOSFETs and to test it. If you don’t have an oscilloscope available, you can use a loudspeaker on the gates of the MOSFETs to hear if it’s working – not an expensive one though. The output frequency was a little higher than expected, at around 4.4 KHz for both channels.

My test bench

was hastily constructed from a spare ATX 300W PSU I had lying around, my digital multimeter and a phat 35W ceramic-cased resistor, 12 ohms, for load testing:

Having no Molex connectors, I bunged the wires in the end of the ATX 12V connector

on the PSU and turned it on by shorting the green wire on the ATX connector to ground.

I must say that this thing supplies plenty of juice – the 12 ohm resistor was getting really hot, but all the components stayed dead cold. I ran the circuit at 6V (maximum losses across the internals) for about 5 minutes and there was no detectable change in temperature on the MOSFET heatsink, inductor or capacitors.

The pics below show the range of output voltages – I am a little surprised that the circuit goes as low as 3.5V – I thought I designed it to bottom out at around 5. Take note of this – most 12v fans probably won’t work this low unless they are high power ones. The maximum voltage is quite respectable, just 0.5V drop from the supply voltage at this load. The other channel has almost identical characteristics. The 12 ohm resistor in the timing circuit seems to do nothing though – the 556 seems to stop oscillating at the end of the pot travel anyway, which is a bonus as the circuit is then simply “on”. You can leave them out if you like.

I have not fully tested this circuit yet, as we have broken up for the holidays and I now don’t have access to the electronics lab at college to ascertain output ripple and to see if it can handle 4A (unless Santa brings me an oscilloscope ). The inductors do squeal a bit over the middle of the PWM range – I will get the glue gun out and put hot goop all over them to stop the noise (thanks RoadWarrior for the suggestion). The squealing is only barely audible in a quiet room, so in a computer case it won’t be discernible.

Added stuff: I load tested the controller with a 4 ohm resistance (a huge reel of copper wire that I used to make the inductors) and the fan controller STILL doesn’t break a sweat. This is going from about 1A to 2.97A – and I haven’t got anything big enough to test it more, and the only things that are getting slightly warm are the inductors. The maximum voltage does drop more at the higher load though, it’s 0.9V below the supply voltage as opposed to 0.5V. I also did some calculations and the efficiency turns out to be 93% @ 9v with 0.75A load, dropping to 75% @ 3.5v with 0.3A load. I need more multimeters to measure input and output current simultaneously for efficiency readings though.

After the Christmas Holidays, I will finish this off with a mounting bracket/enclosure and proper Molex connections, along with some nice graphs of output currents and efficiency

Thanks for reading this long-winded article, and thanks to my mother for letting me plonk my test rig on her nice clean table.

Jonathan Bell – aka L337 M33P

Tags: