• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

[BUILD] 10 Channel USB PWM Fan Controller

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

ameel

Registered
Joined
May 29, 2014
How did this start?

I have 7x Corsair SP120 and a pump on my mini-itx rig which are all controlled through the swiftech 8-way PWM splitter which I got with the cooler. While splitting PWM sounds great in theory, I found out that the splitter does not work well with Corsair SP120 fans which are 'sensitive'.

I did a bit of reading, and built a simple diy PWM amplifier using a 555 timer.

That was great! However, while I could now effectively control fan speeds, if I wanted everything quiet, the pump would almost not run at all! >_< Bugger! So I needed an alternative option where I could control each group of fans separately, and this is when I decided to build my own Fan Controller.

What I want to do/achieve
Build a PWM Fan Controller with a USB and software interface that has lots of features:
1) individually control speed of up to 10 devices
2) linked fan control
3) temperature sensor (modular/wired and can be put against cpu/gpu/hdd/mobo/etc)
4) adjust temp based on temperature
5) individual/linked speed scheduler
6) LCD output (more of a gimmick, but why not!)
7) etc/as other features/thoughts come to mind


How can you help?
Offer ideas/feedback/criticism, or other suggestions


Complete Log (Brief)
0) Put together rough designs (drawn poorly, not CAD), and put together a simple prototyping board for a PIC18F2455 and some breadboards + basic firmware
1) Reading the fan speed/RPM. I got the microcontroller to output fan speed every second and that seemed to work fine
2) Implement PWM through the firmware. That was equally simple to implement.
3) Implemented a basic USB interface (and moved away from Serial). This allowed me to initially just read the RPM.
4) Improved the software interface to allow me to read and set PWM cycles.
5) re-wrote software interface ground up with improved features (slider to control PWM, PWM calibration. (week 16/06)
6) Implemented temperature sensor, on design, prototyping board, firmware and software interface
7) Learn to use Eagle (weekend 21/06)
8) Redesigned schematic to use a PIC18F4550 to support LCD, temp sensor and 2 LEDs (for status or whatever end user wants to do) (and ordered some parts, which I've been waiting on for a while)
9) Built circuit on a prototyping board for new schematic, except for the IC and Fan headers (waiting on those from UK)
10) Not happy with size, and decided to etch my own board.
11) Learn to etch boards, acquired material, and trialled couple of small designs
12) Redesign schematic for bottom layer only (24/06)
13) Etch final schematic (25/06)

What's Next as at 25/06
1) Drill PCB and solder parts
2) Firmware implementation:
a) LCD implementation
3) Software implementations:
a) LCD control
b) Calibrating Fans
c) Linked fan
d) individual Fan Scheduler (software-based for now)
e) Switching between PWM Control and % speed control
f) Fan profiles
g) Linked fan profiles
h) Fan names + mapper
i) Profiles based on temp with overriding rules

Detailed Progress log as at 25/06
By way of update, I got some parts and waiting for some more.

Meanwhile, I redesigned my 9-Channel USB PWM Fan Controller to a 10 Channel USB PWM Fan controller with these extras:
1) 2x16 monochrome LCD support (software is WIP)
2) 2xstatus LEDS (for debugging. software is WIP, but i'll probably allow user-control)
3) Temp sensor (this modular/wired. so it can be put against motherboard/cpu/gpu/hdd/whatever)

I've also had some time to work on the firmware and software. I've basically re-written the app ground up in WPF (so I can make it look nicer later on)
Software now implements:
1) slider for fans
2) temperature readings
3) Fan calibration (i.e. tries duty cycles 0 -100 to see what duty cycles give what RPM/% fan speed)\


Software update:
n2zioy.jpg

While still waiting for the parts, I started preparing a breadboard. It resulted in a 150x100mm config for the 10 fans and other output/input (LED, LCD, Thermistor, ICSP).
(Pin headers for Fans missing, and the PIC18F4550 Those are the only parts I've been waiting on.

2myai5c.jpg


I went nuts here and decided to solder bridge everything. Was first time experimenting with this particular board. The pads make it fairly easy to solder bridge.

23tys4.jpg


Although I liked the design and soldering outcome, I didn't like the size and decided to etch my own board. Having some extra spare time, I learnt how to use Eagle, re-designed the board, learnt (thanks internet!) how to etch boards, printed, got some copper clad and experimented a bit. For those who use Eagle, I've only used it 2 days now and REALLY hate the autorouter. It probably uses the worst algorithms there are. I tried a lot of times with different parameters but eventually just gave up. What you see on the board below is what I fully manually routed (yes, can probably improve).

I just now finally etched the board and cleaned it, and guess what... I got my parts earlier today! The only thing to progress this project further is to drill the newly baked pcb tomorrow, solder the parts. After that's done I'll have a complete prototyping board to fully work on the firmware and software.
(you will notice I forgot it's now a 10 channel fan controller, but still etched '9 channel' on it, it's just a typo )

11abghc.jpg


Photo of PCB, iphone 4s and 250mL up&go for size comparison

faoeuh.jpg

Btw this is what I would call my "proper prototyping board". It wouldn't necessarily be what the end user would have/use. For example I've provided pin-outs for all the pins of the IC and also ICSP, which would normally not be included in a final product

Also, I realise I will need thicker traces to power 12v fans and for ground. I'll look into wider traces that in an updated version later on, or just stick to thicker trace (applying some solder on the power and ground traces). I'll be focusing on firmware/software for now
 
Detailed Progress as at 27/06

1. "Minor" issues with the board.

2. Redesigned the board with thicker connections and solved a couple of things I forgot/mixed up the first time. Already printed and etched it, but too late/early to drill and solder.

1495p95.jpg


3. Updated Firmware and software to support control of 10 fans (hiccups with 4 inputs because of poor circuitry on first board :confused: )

t85htv.jpg
(forgot to plug in temperature module)

4. Successfully tested 6 fans with individual controls (see picture below)

wqtzio.jpg


What's next?
1. Drill holes and put new prototyping board together.
2. Test/debug software
3. Progress other features mentioned in OP
 
Where is power for the fans coming from? I can't find a plug on the pcb.
 
Where is power for the fans coming from? I can't find a plug on the pcb.

Im using DIY wire. On the picture it's the last one on the left (red,yellow and black)

On the new design board it's at the top right corner with 3 connections (ground,5v, 12v)
 
Where is power for the fans coming from? I can't find a plug on the pcb.

Also, further to what you wrote about the trace width before, I'll be applying a layer of single core cable onto the power and ground traces for the fans.this should be plenty to carry 25amps (needed for 1sec peak when 10 devices are started)
 
Detailed Progress as at 30/06
1. Drilled remaining holes on new board
2. Soldered components
3. Re-wrote firmware partly to match new board's i/o configuration
4. Noted 3 channels seem to still be giving trouble. Upon comparing with the previous board (re-mapping the pins), I figured out 3 of the chip's i/o were defective.
5. Change chip, and Tada! All 10 channel now working.

Here's the newboard running 6 SP120 and 1 Pump:

35iw4s5.jpg


On the software it looks like this:
206ybkn.jpg

What's Next
1. Might look at LCD tonight, although I now realise I should have got a GLCD instead. But still keen to try it out.
 
A simple fan controller with individual temperature control. Nice. Is there any way to do this cost effectively for non-PWM fans?
 
Not really. To do it with normal fans you need at a bare minimum to add a power MOSFET, either a MOSFET driver or a second MOSFET to act as a driver, an inductor and a diode, per channel.
 
Yeah, kinda figured it would be too expensive since you would need a circuit for each channel that can handle the power requirements and control the voltages. Wish I had invested in some PWM fans, but everything I have on hand is just regular 2 wire + tach.
 
If you don't mind full speed being ~10.5v you can do it with linear regulators for a lot less money.
If you aren't planning on running high end fans you can abuse them with PWM on the ground pin for less money as well.

I have a microcontroller in front of me that is partially designed for motion control, and there's another one that I've been looking at that is specifically designed for motion control as well. Either of those may be able to act as a buck regulator for less money. The second one could even replace the fan's PCB and drive the motor coils directly :D

I'm eyeballing a multi channel LCD enabled fan controller design as well, so far it's just in my head though.
 
Detailed Progress as at 01/07
1. Working LCD (firmware-controlled only)

What's Next
1. Will see about implementing software-side updates for LCD. Need wrap my head around couple of things to get this to work.
2. I should really get a graphical LCD. Could display more stuff, and costs about the same anyway.

LCD demo:
102ovug.jpg
 
Not to keen to spend anymore until pay day, although the graphical lcd is fairly cheap >_<

Would be a couple of months at least before I get to the standards I'm happy with. Right now, it actually achieves the original functions I wanted, which is individual fan control.

Implementing the software-side of things is very easy (profile, scheduler, renamed/mapped fans, linked fans, temperature-profile override, customisable LCD display, etc). Unfortunately, because it's very easy to do (and therefore not challenging), means I'm not particularly excited to work on them, so I'll probably only progress slower from now on.


Detailed Progress 02/07
1. Software-controlled LCD text implemented
2. Firmware "handover" from firmware display loop to software control implemented


What's next
1. Need to fix some minor hiccups with firmware display loop
2. Will implement eeprom features

LCD showing software control:
6ds6rt.jpg
 
I like the software a lot, it's very cool.
How often does the RPM refresh?
 
I like the software a lot, it's very cool.
How often does the RPM refresh?

Every second both firmware and software sides, but it's adjustable. The slower the refresh, the more accurate per min.

Haven't implemented it yet, but one of the features to be included is customising refresh rate from the software. Again, very easy to do.

I might do a couple of the 'very easy' features tonight.
 
Detailed Progress 03/07
1. Fixed hiccups with LCD display loop (now all working properly)
2. Implemented setting custom text on LCD from software, and switching back to firmware LCD display loop
3. Implemented custom text in firmware LCD display loop (saved in eeprom, i.e. text is shown in LCD display loop without requiring software interface)
4. Implemented EEPROM for PWM values, i.e. preferred PWM values are saved and don't need software interface
5. Implemented read/write functions for debug (both firmware/software)

What's next
I'll look into the following over next few weeks, not in any particular order:
1. Complete Fan Calibration Logic
2. Switching between PWM control and Fan speed % control
3. Fan Profiles (names, temperature profiles, linked groups etc)
4. Adjustable PWM Refresh Rate
5. Resetting Firmware Default Settings
6. Scheduler + Temperature Overrides
7. Re-writing firmware and software to optimize code
8. Re-designing software UI

https://plus.google.com/106571501264837102999/posts/CYT6FxZ2DRs
 
Last edited:
What hack are you using to get 10 PWM outputs on a chip that only has 2 CCP peripherals?
 
It has a hardware USB interface, I expect that leaves plenty of CPU time for software (or firmware, if you prefer) PWM rather than using the two hardware PWM channels.

It's only a 25kHz signal, assuming he's following the Intel spec, you've got 40 microseconds between leading edges. 20MHz clock speed (highest listed for use with a crystal. 8MHz if it's internal oscillator is being used) gives you 800 cycles (320 for internal osc), that ought to be enough to get 101 PWM steps (0% to 100%) into software. I can think of a couple ways to do it on an Atmel chip.
Reading the datasheet further, you can feed that PIC a 48MHz external clock, that'd give tons of time for software PWM.

Unlike PSU applications it doesn't matter much if there is the occasional PWM frequency hiccup in fan control.

I think I'm going to see if my idea works. I'll test two channels at 25kHz with a 1MHz CPU clock, that's close enough.


EDIT:
Well, it worked beautifully in theory, produced a pair of absolutely lovely PWM output waveforms. At 769Hz. Just a touch short of 25kHz. Most fans will accept 769Hz, but most fans (every PWM fan I've tested) make a significant amount of noise if fed a signal at that speed.
IF statements turn out to take a very, very, very long time, at least on an Attiny85 using the Arduino IDE.
By significantly cutting down on features (one output, bottoming out at 1%, direct port manipulation) I was able to get it up to 3kHz. Still far short of the needed 25kHz.

Short answer: No software fan PWM on an Attiny85.
Maybe PICs can do IF statements faster.
 
Last edited:
I was thinking of something like using the CCP to trigger an interrupt, then resetting it for the next duty cycle in the list.

I have done some hacks involving PIC peripherals, like using the adjustable "voltage reference" in a PIC16F88 as a simple DAC.
 
Detailed Progress as at 27/06

1. "Minor" issues with the board.

2. Redesigned the board with thicker connections and solved a couple of things I forgot/mixed up the first time. Already printed and etched it, but too late/early to drill and solder.

ameel.jpg

I have a question: Did you draw the tracks by hand? I say this because the edges are not clean and sharp (sorry, I always look for that kind of thing), also the tracks for power are the only ones that need to be wide,like .050 inch, all others can be .0015 inch wide for signals.
 
Back