I've had a very long break from electronics due to unfortunate circumstances, but I'm back now. First job... make myself a new PSU. That was easy (it was mostly just wiring up SMPS modules into an old SCSI CDR enclosure) but I wanted a fan speed controller in it. I made one with what I had on hand.
The only 'clever' thing is the use of an adjustable LDO voltage regulator as the output stage. It had never occured to me to do that before but it worked nicely. The regulator adds its own reference voltage to the output, above the voltage I give to its reference input. So, I get almost the full 12V (11.7V) into the fan.
- Microchip PIC 18F1320 controller (ADC, PWM, internal 8MHz oscillator, and because I have a box full)
- Temperature sensed in two locations with Microchip MCP9701 linear sensors (because I have a bag full)
- TI 2.5V TL431 reference for the ADC (I might as well because... you guessed it)
- On Semi LM2931 output regulator (because it is LDO, has an Inhibit pin and... yes, a tube full!
- Linear voltage output to fan: completely off, or 4.5V (minimum PWM determined by experiment) to 11.7V
- Files attached for the design (CCS C, KiCad schematic and PCB) and a schematic PDF.
- Most values are not critical.
The PIC samples the temperatures on a timer interrupt, averages and adds hysterisis to stop the output being annoying, and produces a PWM output of the required speed. Of course, two-wire fans (I had a nice Sunon to hand) don't like PWM. A low pass filter takes care of that, followed by an op amp to buffer and multiply by two. That feeds the regulator which adds its reference and feeds the fan. Simples! I used a 2.5V reference for the ADC to give more useful range. A couple of resistors to divide the 5V supply would suffice really, but I had the v.ref's so why not.
When I thought of using the regulator, a quick search found that I wasn't the first (well, d'uh) but the example I found was clearly flawed and could not possibly work as advertised. Mine does. The CA3130 (because I found one) runs fine on a single rail and the output goes to ground, so the final output is below the fan's minimum (only the regulator's reference voltage added). The regulator's Inhibit pin turns off the output when I want the fan off, so it's not sat there with a low voltage on it.
The code really should be tweaked and recompiled for a fan's minimum running speed. It gives a full speed burst to start the fan up, then drops speed to where required. The temperature set points are of course for my kit as are the rate of fan speed increase for each.
The PCB was designed to fit a small space in my enclosure with a screw hole in the middle, and to be 'hand made'. It could certainly be better, but it was quick to make and it worked. The circuit is simple enough to build on veroboard. Note that there is just one wire link on the PCB, for the Inhibit line from the PIC to the regulator. I wanted it finished and couldn't be bothered trying to re-route for it. Apart from three reservour capacitors, all passives are 1206 because I can route traces under those and still hand make the board.
To give a little protection from all the switching noise inside the case, the temperature sensor wires are old CD-ROM to motherboard audio cables. They are screened three-core and I earthed the screen to the case. The MCP9301 regulators use the internal wires of the cable, with a 1uF 1206 MLCC (not shown in the schematic) soldered directly across the sensor's power pins right underneath the plastic case. A heatshrink wrap finished those off nicely. At the board end, a low pass RC filter helps keep things smooth.