PWM 4 pin PC fan control questions

Thread Starter

Nic_s

Joined Jun 18, 2019
6
Hi

I've done many DIY projects over the years, but this kind thing is new ground for me. So forgive me if the following questions are in the wrong place or just stupid :) I know the post is long, but it includes why and what I'm trying to achieve.

First, I've spent A LOT of time searching the web for what I'm looking for, but with my lack of knowledge I might be looking at what I need and not even know it.

Second, I know there are commercial PC fan controllers available. However, none that I found seems to allow allow you to turn a fan off as far as I can see. Some of those controllers also require you to have a account with the company before you can even use the software and then it still does not do everything I want.

Lastly, I'm a programmer by day and should be able to handle that side of things. It's the hardware side I'm having trouble with.

Why?
In short, Dust. The less fans running when a system is at idle, the less dust it will pull in. I live in South Africa and there is CONSTANT construction everywhere. Dust is a massive pain here.

I currently have 2 systems I want to have total control over the fans. The first is my "server". I say "server" since it's just a intel i3 and mostly acts as a file server. Very rarely will this machine do any real work which could drastically increase the temps. This machine runs 24/7 so to be able to turn fans off when not needed would be awesome here.

The second machine is my work/gaming rig. Right now this machine has 2 CPU fans and a total of 6 case fans and while I'm typing this the CPU is idling between 8-20°C. When the temps are this low, the reading on the cores is not super accurate from what I understand.
In short, almost all the case fans can be turned off while the system is idling or doing simple tasks like remote desktop or watching youtube.

NOTE: Currently it's winter here and we see about 17°C (62.6°F) high during the day. During summer... we will see 35°C+(95°F) almost daily. This is another reason total fan control would be awesome.


What am I trying to do?
1. Want to control 4 pin PWM PC fans, not 3 pin.
2. Want to control fan speed based on CPU or GPU temperature.
3. Want to be able to turn a specified fan off if temp is below a certain threshold.
4. Want to be able to read fan RPM. If a fan is not turning, but it should be, I would like to know about it.
5. Power for the fans will come from the power supply.
6. Want to connect the controller to a USB header on the motherboard so I can send it setup information and the CPU and GPU temps.
7. Want to be able to control up to 8 fans, possibly more in the future.

I've been looking at using a Arduino for this and although it looks like it will work, the issue is the PWM frequency of the Arduino is not the 25khz as per the Intel PWM spec. You can make the Arduino do this frequency, but from what I've read so far it requires messing with the Arduino's timers which in turn will result in some timing related functions to not work properly.

Also, to turn the fan off or on, it seems a MOSFET between each fan and the power rail is the simplest way. This means that for each fan I would need 3 pins on the Arduino. One for PWM, one for RPM, and one for the MOSFET. That results in 24 pins for 8 fans, and I might want to control more fans in the future for a slightly different project I have in mind.

This seems doable with something like the Arduino MEGA, but I started to wonder what it would take to make a board dedicated to my requirements. This is where I'm stuck.

My thinking is that maybe I could have a Master chip that would control a slave chip for each fan.
The Master would have the setup which will determine how each fan should be managed.
This setup would be compiled by the user on the PC and passed to the Master with the USB header connection.
After the setup has been sent to the Master chip, the PC app would just periodically sent CPU and GPU temps to the Master chip.
Each slave would only be responsible for the PWM signal and the Master chip tells the slave the duty cycle when it needs to change.
Somewhere in there I would probably still need the MOSFET to actually be able to turn the fan on or off.

One more note: I know you can make the PWM signal using a 555 timer, but if I have to make that for 8 fans or more it will be a pretty big setup. It's not the end of the world, but if it can smaller then why not. I have so far not find a chip that can do it all in one. Might just be that I have without really knowing it. I have found PWM Controller chips, but I'm not sure if that's what I need and because none of them seem to do 25khz I have not spent much time reading up about them yet.

Questions:
1. How do I generate the 25khz PWM signal for each fan? Is there a chip that can do this? What are they called or any recommendations?
2. How do I specify the duty cycle for each fan? Can the chip in question 1 (If it exists) do this as well?
3. Is a MOSFET still the best way to turn a fan on or off when making a dedicate board?

By no means is this exactly how the circuit should work. This is just an idea from someone who knows very little on the subject. It's most likely a pretty stupid idea :)

I am 100% sure there is a better way and that is why I'm asking here. I know I am close to asking for a full schematic here and that is not my intent. I am willing to learn as I would want to do similar projects in the future, but I do need some good advise/ideas/recommendations on where to start and what to look for.

If something like this already exists, and I could just not find it, then this might be a very short thread ;)

I know this is an ambitious project for someone like me, but I've wanted to have something like this for a long time and it seems no one/company is making it. So DIY it is :)

Regards
 

Thread Starter

Nic_s

Joined Jun 18, 2019
6
For starters, here is the specification of 4-wire pwm fans. https://folk.uio.no/kyrrens/diverse/viftekontroller/developer-specs-REV1_2_Public.pdf
Second, wow that is a lot of text to digest.
Since you plan to use the atmega, that should be more than capable to generate the correct PWM, measure temperature through whatever sensor you like, and do other stuff as well.
I've already gone through the spec. Like I said, the ATMega looks like it will work, but I'm interested in making a dedicated board with out having to "hack" a Arduino into doing what I need. From what I have read, if you mess with the arduino's internal timers to get the 25khz it will mess with other time related functions and then reading the RPM will be a pain.

Also, I believe most if not all 4 pin PWM fans have a default if the signal is not there or below a threshold that will result in the fan running at either it's minimum speed or max speed depending on how the fan was setup. As far as I can see, PC fan will run at their minimum.
 

kubeek

Joined Sep 20, 2005
5,796
If was doing this, I would probably use a ready arduino board, program it in C and not arduino IDE, and add a second protoboard with whatever connections or additional components I need.
 

Thread Starter

Nic_s

Joined Jun 18, 2019
6
If was doing this, I would probably use a ready arduino board, program it in C and not arduino IDE, and add a second protoboard with whatever connections or additional components I need.
hmm... program it in C... I will have to do some research on that. The original idea was to have separate board for the power rail and other components.

Still, I thought it would be easier if I can have chip produce the 25khz signal and then just have a means of telling said chip the duty cycle. The 555 timer method is essentially what I'm looking for, but in a single chip... if possible.
 

kubeek

Joined Sep 20, 2005
5,796
Now I remembered there is an IC from linear that does just that. Look up LTC6992-1 it is a simple voltage to PWM generator.
 
You probably don't want the fans running at different speeds, but you might want to turn some of them off. Think about your configuration.
Turning them off, might require less pins. e.g. an I/O expander IC that's controlled via I2C.
 

atferrari

Joined Jan 6, 2004
5,017
Hi

I've done many DIY projects over the years, but this kind thing is new ground for me. So forgive me if the following questions are in the wrong place or just stupid :) I know the post is long, but it includes why and what I'm trying to achieve.

First, I've spent A LOT of time searching the web for what I'm looking for, but with my lack of knowledge I might be looking at what I need and not even know it.

Second, I know there are commercial PC fan controllers available. However, none that I found seems to allow allow you to turn a fan off as far as I can see. Some of those controllers also require you to have a account with the company before you can even use the software and then it still does not do everything I want.

Lastly, I'm a programmer by day and should be able to handle that side of things. It's the hardware side I'm having trouble with.

Why?
In short, Dust. The less fans running when a system is at idle, the less dust it will pull in. I live in South Africa and there is CONSTANT construction everywhere. Dust is a massive pain here.

I currently have 2 systems I want to have total control over the fans. The first is my "server". I say "server" since it's just a intel i3 and mostly acts as a file server. Very rarely will this machine do any real work which could drastically increase the temps. This machine runs 24/7 so to be able to turn fans off when not needed would be awesome here.

The second machine is my work/gaming rig. Right now this machine has 2 CPU fans and a total of 6 case fans and while I'm typing this the CPU is idling between 8-20°C. When the temps are this low, the reading on the cores is not super accurate from what I understand.
In short, almost all the case fans can be turned off while the system is idling or doing simple tasks like remote desktop or watching youtube.

NOTE: Currently it's winter here and we see about 17°C (62.6°F) high during the day. During summer... we will see 35°C+(95°F) almost daily. This is another reason total fan control would be awesome.


What am I trying to do?
1. Want to control 4 pin PWM PC fans, not 3 pin.
2. Want to control fan speed based on CPU or GPU temperature.
3. Want to be able to turn a specified fan off if temp is below a certain threshold.
4. Want to be able to read fan RPM. If a fan is not turning, but it should be, I would like to know about it.
5. Power for the fans will come from the power supply.
6. Want to connect the controller to a USB header on the motherboard so I can send it setup information and the CPU and GPU temps.
7. Want to be able to control up to 8 fans, possibly more in the future.

I've been looking at using a Arduino for this and although it looks like it will work, the issue is the PWM frequency of the Arduino is not the 25khz as per the Intel PWM spec. You can make the Arduino do this frequency, but from what I've read so far it requires messing with the Arduino's timers which in turn will result in some timing related functions to not work properly.

Also, to turn the fan off or on, it seems a MOSFET between each fan and the power rail is the simplest way. This means that for each fan I would need 3 pins on the Arduino. One for PWM, one for RPM, and one for the MOSFET. That results in 24 pins for 8 fans, and I might want to control more fans in the future for a slightly different project I have in mind.

This seems doable with something like the Arduino MEGA, but I started to wonder what it would take to make a board dedicated to my requirements. This is where I'm stuck.

My thinking is that maybe I could have a Master chip that would control a slave chip for each fan.
The Master would have the setup which will determine how each fan should be managed.
This setup would be compiled by the user on the PC and passed to the Master with the USB header connection.
After the setup has been sent to the Master chip, the PC app would just periodically sent CPU and GPU temps to the Master chip.
Each slave would only be responsible for the PWM signal and the Master chip tells the slave the duty cycle when it needs to change.
Somewhere in there I would probably still need the MOSFET to actually be able to turn the fan on or off.

One more note: I know you can make the PWM signal using a 555 timer, but if I have to make that for 8 fans or more it will be a pretty big setup. It's not the end of the world, but if it can smaller then why not. I have so far not find a chip that can do it all in one. Might just be that I have without really knowing it. I have found PWM Controller chips, but I'm not sure if that's what I need and because none of them seem to do 25khz I have not spent much time reading up about them yet.

Questions:
1. How do I generate the 25khz PWM signal for each fan? Is there a chip that can do this? What are they called or any recommendations?
2. How do I specify the duty cycle for each fan? Can the chip in question 1 (If it exists) do this as well?
3. Is a MOSFET still the best way to turn a fan on or off when making a dedicate board?

By no means is this exactly how the circuit should work. This is just an idea from someone who knows very little on the subject. It's most likely a pretty stupid idea :)

I am 100% sure there is a better way and that is why I'm asking here. I know I am close to asking for a full schematic here and that is not my intent. I am willing to learn as I would want to do similar projects in the future, but I do need some good advise/ideas/recommendations on where to start and what to look for.

If something like this already exists, and I could just not find it, then this might be a very short thread ;)

I know this is an ambitious project for someone like me, but I've wanted to have something like this for a long time and it seems no one/company is making it. So DIY it is :)

Regards
What a huge mass of text! No thanks.

Suggest you read this
 

ebeowulf17

Joined Aug 12, 2014
3,307
Just a bit off topic, but I feel like new posts are always in a no-win situation here in these forums.

If you provide a very simple question, you're chided for not providing enough detail, not demonstrating that you've done your own research, and just wasting everyone's time by making them ask so many follow up questions.

If you provide relevant context, details, and the current state of your research, you're chided for writing too much and wasting everyone's time by making them read too much.

I'll admit the first post probably could've been trimmed up a little and still conveyed the relevant info, but it's not that bad. It's actually divided into paragraphs, fairly coherent, and mostly on topic.

If he'd written a short initial post people would've suggested things he's already tried or asked a dozen follow up questions - it would take 10-15 posts to get to the point where we have the information we need to actually analyze the problem. You guys are hard to please! I think the thread starter did a fine job.
 

Thread Starter

Nic_s

Joined Jun 18, 2019
6
You probably don't want the fans running at different speeds, but you might want to turn some of them off. Think about your configuration.
Turning them off, might require less pins. e.g. an I/O expander IC that's controlled via I2C.
Yes, a simple on off would work, but my rig has 6 case fans and as such can be very loud. Would be great if I can have more control over how fast the fans spin as well.

My motherboard has 4 PWM pins for case fan, but you can't switch them off and the control over what they do and when they do it is fairly limited. Essentially the manufacturer (ASUS in this case) made it idiot proof and thus placed hard limits on what I can do. Currently I have 5 out of the 6 case fans connected to the Corsair "fan controller" that comes with the case. It has a simple 3 stage switch which I need to change when I fire up a game and then remember to change back when done. It cannot turn fans off though.

Yes, there are other ways I can do this, but if it's possible to have a more automated and streamlined solution then I would at least like to try. Also, as mentioned in the first post, I have another project in mind that would require a similar controller that can handle more than 8 fans. That project is a little ways off, but this will essentially be one part of it.

Thank you for the responses so far. I'm already learning more.
 
Last edited:

ebeowulf17

Joined Aug 12, 2014
3,307
As for the question at hand, I don't see a lot of options for multi-channel pwm controllers at those high frequencies. Programming your own microcontroller seems like a good approach.

I don't remember all the details on Arduino timers, but I thought there were one or two that were essentially "free," meaning you could change frequency with no significant impact. Might be worth digging deeper.

Also, tons of "arduino" options that aren't actually Arduino, and some may be more flexible on timers. Lately I'm a big fan of the adafruit feather M0 series of boards. I know they've got tons of pwm pins on a tiny board, but I don't know if the clock specs are suitable.
 

kubeek

Joined Sep 20, 2005
5,796
The atmega2560 has 12 channel 16bit hardware PWM, so that would be my choice for the easiest solution, the use some I2C temperature sensors to monitor your temperatures and control the fans accordingly.
 

Thread Starter

Nic_s

Joined Jun 18, 2019
6
As for the question at hand, I don't see a lot of options for multi-channel pwm controllers at those high frequencies. Programming your own microcontroller seems like a good approach.

I don't remember all the details on Arduino timers, but I thought there were one or two that were essentially "free," meaning you could change frequency with no significant impact. Might be worth digging deeper.

Also, tons of "arduino" options that aren't actually Arduino, and some may be more flexible on timers. Lately I'm a big fan of the adafruit feather M0 series of boards. I know they've got tons of pwm pins on a tiny board, but I don't know if the clock specs are suitable.
Thank you. The obvious ones I know about is Arduino and Raspberry, but I will look at others. Also, when searching online for means of controlling a 4 pin PWM fan most of the results are Arduino stuff. It's in part why I decided to ask for more direction so I can adjust my Google-fu and start to find other/new results that may further my research.
 
Top