Multiple PWM PC case fan control

First, Forgive me if this is not the right place or just a stupid question. I've done many DIY projects over the years which includes programming and some electronics, but now I am entering new ground with arduino/Pi type projects.

I thought it would be relatively simple to find a means of controlling multiple PWM PC fans, but after A LOT of googling I have yet to find what I'm looking for. It does not mean that it does not exists, just that I can't find it or I don't know what components I can use to make this happen :)

Yes, there are commercial fan controllers like the ASUS Fan Extension Card, but that can only handle 3 fans and seems to only work with a ASUS system. Link: https://www.asus.com/Motherboard-Accessories/FAN-EXTENSION-CARD/

One other controller I found requires me to register a online account before I can use the software. No. I want total control.

I want to use this in my server and gamin rig. For the most part, the server hosts files and rarely does any real work. As such I want to be able to have most of the fans in it stop when it's just sitting there. I mean, the CPU does not need to idle at under 20°C. Same goes for my gaming rig and if I can reduce of amount of fans running when these systems are just idling I will also reduce the amount of dust that gets pulled in. I live in Africa and dust is a pain.

Requirements: 1. Does not have to be arduino based. 2. I'm looking for something that can handle about 6-12 fans. 3. It should take power from the Computer's PSU since it can supply 5v and 12v. That would be 12v for the fans and if needed, 5v for the controller board. 4. Want to plug it into a USB header on the motherboard so I can send it instructions and monitor fan speeds. 5. Would be nice if I can turn fans completely off when a temp value goes below a threshold. I know PWM fans will run at a default minimum when the PWM signal is zero. So a switch of some kind would be needed to kill power to a particular fan. 6. The smaller the enter setup, the better ;)

The idea here is total control. I want to be able to program it in such a way that I can, for example, say that Fan #3 only turns on if the GPU temp goes above 50°C and then have the fan speed increase as the GPU temp increases.

Or be able to set a condition where if the GPU is at 45°C, but the cpu is passing 55°C then Fan #3 will again turn on and will increase in speed as the CPU temp rises. If the GPU temp over takes the CPU temp, the fan's speed would be managed based on GPU temp instead.

These 2 example would just be programming which I should be able to handle myself. It's the hardware side I need advise with. I've watched a lot of DIY vids over the years and the programming with something like Arduino seems simple enough and with my programming background should not be a issue.

When it comes to the amount of fans, something modular could also work. For example, maybe get a module that can run 4 fans, but then be able to attach 2 or more modules together and so end up with the option of controlling 8 or more fans.

I did find the PCA9685 which is a 16 channel servo PWM controller: https://www.adafruit.com/product/815

It says in the description that it can go up to 12v and you can link multiple of these together to add many more channels, but this does not monitor fan speed. If a fan should be running, but it's not, I want to know about it.

I know I'm very ambitious here. I honestly thought something like this would already exists and I can program it how I want and put it together without needing to make any of my own complex circuits or even my own controller board. I don't want to reinvent the wheel if I don't need to :)

So does something like this already exists and my google-fu is just terrible? Do I need to combine multiple components to make this happen? Or do I need to go back to the drawing board and start to learn on how to make my own controller board for this?

Again, sorry if this is not the right place to ask. I'm hoping that someone here can give some info/advise that can help me find direction and a place to start.

Regards Nick

This looks like a possibilitygrid plus v3 although it "only" controls six fans. Disclaimer: have not used it.

Or you can home-brew it with an Arduino. To get 12 PWM outputs, you would need something like a Mega. Then twelve outputs to switch power to the fans via appropriate transistors and twelve inputs reading fan speed. I'm not sure what voltage the speed indicator is - I'd guess 12V in which case you would need voltage dividers to get each one down to 5V.

I'd suggest you get an Uno to start with and experiment with controlling a couple of fans - cheaper to replace if you have a catastrophe.

NZXT is one of the companies that requires you to register a account. That said, I looked at their stuff some time ago now. It might be different now... although I doubt it.

The Mega has 15 PWM capable pins which should be plenty. Can it do PWM at 25KhZ? I will need a separate setup for the 12v power since there is no way I could run like 12 case fans from a arduino.

Good thing you mentioned the speed measurement. I've been so focused on the PWM feature that I've not spent enough time looking into how I would measure the speed if I build something myself.

If I were to use the Mega, after testing with a uno, would I then require a pin for the PWN, pin for RPM, and another pin to enable or disable power for a particular fan? That would mean that for a 12 fan setup (Which is unlikely, I know) I would require a total of 36 pins?

To kill power to a particular fan, each fan would need a small relay? What options would I have here?

It does look like I will have to make something myself which is fine. I just wanted to make sure from more experienced people that I'm not reinventing something :)

Apparently, you can change the PWM frequency and 25kHz is achievable. The code to achieve it looks nasty but it's just a matter of finding it and copying.

You would indeed need 36 pins if you want to control the 12 fans independently. Luckily, the Mega has plenty.

Killing power doesn't need a mechanical relay, an SSR or just a transistor would probably do it.

Thank you. I will do some more research and start experimenting when I get what I need.

I built a very similar project about a year ago based on a barebones ATMega328p, although mine has only four channels.

One thing you need to decide is wether you want to control a three pin or four pin PC case fan. When you want to use a four pin fan, then you can just connect the raw PWM signal directly to the PWM pin of the fan. If you want to use a three pin fan, then you need to control the power to the fan with a N-Channel MOSFET.

Measuring the speed of a PC case fan is also relatively easy. The Intel specification says that the speed output of a fan has to be Open Collector. This means that you can connect a pin of the MCU with pullup resistor enabled directly to the speed output of the fan and the fan circuitry will periodically pull the pin low. One thing you need to be aware of is that when you are controlling a three pin fan via a MOSFET then you need to crank the PWM signal to 100% for a few milliseconds while reading the speed or else you will get garbage readings.

I will add a photo of my contraption when I am at the PC.

So I want to stick with 4 pin fans and use PWM to control the speed.

Right now I'm looking at what would be the best and smallest means of turning power on or off to a particular fan. I figured something that can handle up 2A should be more than enough for almost any PC fan you would want to use.

This is not something I've really done before and I am unsure about the efficiencies and potential heat build up that comes with transistors. Using a MOSFET to switch the power seems to be more efficient, but I'm still doing research and learning.

A mechanical relay seems like the most simple means, but they tend to be kinda large and then you also get the clicking noise... not that the fans would be constantly turning on and off, but still.

EDIT: OK... 2A might be a bit much...

This is my fan controller: |285x500 It is mounted inside an old DVD drive case.

The main difference from your plans is that mine is self contained and can't be controlled by software on the PC (although that would be doable).

Most PC case fans need between 100 and 300 mA at full power, depending on their size and max RPM. The MOSFETs I used in my build are IRLU024N (Datasheet) and they are massive overkill for the task.

XFactHD:
If you want to use a three pin fan, then you need to control the power to the fan with a N-Channel MOSFET.

Measuring the speed of a PC case fan is also relatively easy.

Both statements don’t go together.
If you want to use the tach output, then fan ground must stay fan ground.
And fan PWM needs to be done high-side, with a P-channel mosfet (or PNP transistor) and a level shifter.
Leo…

Wawa: If you want to use the tach output, then fan ground must stay fan ground.

I invite you to carefully read my first post again to notice the little warning about the need to set the PWM signal to 100% while reading the tacho ping.

Wawa: And fan PWM needs to be done high-side, with a P-channel mosfet (or PNP transistor) and a level shifter.

The device pictured above works flawlessly with low-side control of the fans and the two commercial ones I examined while building this did exactly the same.

EDIT: Looking further into this, I found this paper by Analog Devices. While this paper is not strictly talking about PC fans, the concepts still apply here. I would consider Analog Devices to be a quite credible source of information.

12volt on a 3-pin fan, and no ground (zero PWM) means 12volt on the tach circuit ground inside the fan. That seems unhealthy for the circuit inside the fan if the tach pin is pulled down to 5volt by the Arduino circuit.

Better/safer to use high-side switching, with the added advantage that you can read the tach pulse all the time. High-side circuit here (third diagram). Leo..

Wawa: 12volt on a 3-pin fan, and no ground (zero PWM) means 12volt on the tach circuit ground inside the fan. That seems unhealthy for the circuit inside the fan if the tach pin is pulled down to 5volt by the Arduino circuit.

This should not be a problem in my circuit as the resistor pulling the tacho pin to 5V is the internal pull-up of the ATMega328p as they are in the range of 20-50 kOhm.

If you want to avoid any possibility of destroying the tacho circuit you could still use an optocoupler wired between fan supply voltage and the tacho pin. This is something I thought about adding to my circuit but didn't in the end, I am thinking about adding it now...

In case you are interested, here is the 4-Wire PWM Fan Specification by Intel.

I don't see the need for optos if you can share Arduino/fan grounds.

Most 4-pin fans I tried work fine on Arduino's default PWM frequency (~500hz of 1khz, depending on pin). There is a possibility of motor whine on the PWM frequency, but I never noticed it. Leo..

I set the two timers corresponding to the PWM pins I used to 32kHz to get them outside the audible range as I am very sensitive to this high pitch noise and it works perfectly with every 4-pin fan I tested and also almost every 3-pin fan (I know that they are not at all specified for that).

Thanks for the responses guys. Actually learned quite a bit here already.

Just to be clear, I want to use the 4 pin fans. From the links above, I should be able to always get a reading from a 4 pin fan and won't need to do pulse stretching to get an accurate reading.

Is there anything special I need to do, or component I need to add, to read the RPM of a 4 pin fan with the Arduino?

I am currently looking online for examples on how to read the fan's RPM.

You have two options to read the speed of a fan: with interupts or with pulseIn().

Using interupts is a bit more complicated but the whole thing may be a little more responsive, which may be benefitial when operated via a user interface on a display.

If you use pulseIn() you have blocking code (similar to delay()) but really only for a few 100 microseconds per fan up to a few milliseconds. In my fan controller I used pulseIn() with a timeout of 100ms to read the speed every 5 seconds and seperated the four reads (one per fan) to be done in four subsequent loop() calls to keep the user interface responsive.

I saw a video where the guy used interupts. I going to at least try that.

Most of what I see online is for 3 pin fans. Only found a few 4 pin examples, but during the week I have limited time to do research with work and life.

Seems I need a resistor of some kind between the tach signal and the Arduino? I'm guessing to limit the signal strength to not overpower the arduino?

Don’t forget that the Mega only has six interrupts.

Nic_s:
Seems I need a resistor of some kind between the tach signal and the Arduino? I’m guessing to limit the signal strength to not overpower the arduino?

They probably added that to protect the inputs from voltage spikes induced into the tacho wire which may be a valid concern with long wires.

wildbill: Don't forget that the Mega only has six interrupts.

So you don't count pin change interrupts as interrupts? Strange...