Custom fan control project: 2 PWM inputs -> 1 PWM output

Hi,

This is my first post here. Hello, my name is Michael and I have a project in mind that I think the Arduino platform can help with. It's for a new PC that I'm putting together. I'd like the speed of the case fans to be a function of both the CPU temperature and the GPU temperature. The motherboad and the graphics card are each capable of generating a 25Khz PWM signal whose duty cycle is governed by the temp of the CPU and GPU respectively. Fan control PWM runs on a 25Khz carrier frequency at 5v.

I'd like to build a device that can sample two PWM signals, do some basic math with the two duty cycle numbers, and produce a third PWM signal as output with a new duty cycle. Size matters. I have my eye on the Arduino Nano for this project. When I'm done, I'd like to box it up and bury it in the bottom of my PC case, under a PSU shroud so it needs to be small.

I've dug up this various info that makes me think Arduino can work for this and seen youtube clips of Arduinos controlling PWM fans.

Some examples of how to sample pwm inputs. http://www.benripley.com/diy/arduino/three-ways-to-read-a-pwm-signal-with-arduino/

A pwm library that should let the arduino produce a 25khz pwm output per the fan spec. http://forum.arduino.cc/index.php?topic=117425.0

A spec for 4pin pwm fan control http://www.formfactors.org/developer%5Cspecs%5C4_Wire_PWM_Spec.pdf

I'm definitely looking for guidance. Am I one right track or am I barking up the wrong tree?

Thnx!

Hi again,

I think I'm going to go ahead and try to turn this project into something. I've not touched an Arduino before and mucking with electronics isn't something I'm terribly familiar with, so I'm sure to fumble around and make mistakes.

I think I need to get two Arduino Nanos, two terminal adapters, and a potentiometer to start with. I have a 750W power supply with clean 12v and 5v outputs that I can use for power and a pwm controllable fan that I can wire up to 'learn to drive with'. Here's an outline of the steps I think I should take to see this through.

0) Take a look at the ide/devkit with an eye for compat with my system. Download, install, and run it. Sign up on the forum. I've done this much already.

0.5) Order the 2x Arduinos Nanos + terminal adapters. I can make a trip to Fry's for the pot and some wires.

Question: Where's a good place to buy a Nano?

0.7) Run some wires to connect the psu + 1 nano + pot + fan. Run a usb cable from the nano to my pc.

Question: Should I do anything special to ensure my workstation and my experiment's psu share a common ground? I intend to plug them into the same power strip, is that commonly ground enough?

0.8 ) Make sure serial io between the IDE and the device looks good.

// Finally we get to more fun parts

1) Figure out how to generate a pwm signal. Learn to drive by controlling the fan, ramping the speed up and down with the pot. Figure out how to generate 2 pwm signals with different duty cycles at the same time. Being able to produce two signals will come in handy in step 2.

2) Figure out how to read a pwm signal. Use the first device to generate the input signals to read. Then figure out how to read two signals concurrently.

3) Write production code that samples two pwm input signals and produces a third with a duty cycle of std::min(100, in_1+ in_2). Hook that output up to the fan and debug things. Hopefully the coding/debugging part should be fairly straight forward for me, sw development is what is what I do for a living.

4) Solder the leads on the 'production' device after deciding upon connectors and wire lengths for all the inputs and outputs.

5) Package it into a small box, leaving the mini-usb port accessible.

6) Install the device up in my old gaming rig as a test to see that nothing blows up.

7) Install it into my new pc.

8 ) Edit to taste the resulting duty cycle calculation to get the fan speeds where I want them. I can't do this fine tuning earlier because the 'production' fans are busy elsewhere, they're cooling my new pc.

9) Have a beer, very important step.

10) Game on without concern for heat build up.

Any feedback or guidance on that plan would be welcome.

I've got a couple specific questions already and I'm sure I'll have piles more as I dig into the details. Right now I'm blocked on figuring out where to order the Arduino Nanos. They're not available in the store here? I see some on newegg and ebay and amazon? What's a good manufacturer for these things?

Grazie e ciao!

A fourth method for reading PWM signals: a resistor and capacitor forming a low pass filter, so that you can use analogRead to read the PWM inputs. This approach allows to substitute the PWM inputs by pots, or by PWM signals of a different frequency, without changing program logic.

The PWM library supports 960Hz only. Search the forum for how to change that frequency, if your fan requires 25kHz instead.

About ground connections: both the power supply and logic share the Gnd connection of every module. You cannot separate power and logic Gnd. Every module must be connected to the common ground/Gnd line.

Orders: The Arduino trademark was split into Arduino and Genuino, for use inside/outside USA. In Italy look for Genuino Nano.

DrDiettrich: A fourth method for reading PWM signals: a resistor and capacitor forming a low pass filter, so that you can use analogRead to read the PWM inputs. This approach allows to substitute the PWM inputs by pots, or by PWM signals of a different frequency, without changing program logic.

Thanx for that! If I run into trouble trying to catch rising and falling edges with interrupt handlers, I could give this a try. Actually, it sounds a lot more straight forword to code up (one function call), but would put additional power/current demands on the PWM signal source. I'll have to figure out of the extra power would too much for my pwm signal sources.

DrDiettrich: The PWM library supports 960Hz only. Search the forum for how to change that frequency, if your fan requires 25kHz instead.

I'm hoping this will help me out in that area. http://forum.arduino.cc/index.php?topic=117425.0

DrDiettrich: About ground connections: both the power supply and logic share the Gnd connection of every module. You cannot separate power and logic Gnd. Every module must be connected to the common ground/Gnd line.

What's a "module"? Is my pc a module?

I have a PC powered by an 850W psu. I have an arduino + fan + pot assembly on the side, powered by a separate 750W psu. I have the PC connected via USB to the arduino.

Question is should I explicit ground the 2 PSUs together, running a ground wire from one to the other. Since they're both plugged into the same power strip, I expect I don't need to do that explicitly myself because they already share a common ground, but am just checking.

DrDiettrich: Orders: The Arduino trademark was split into Arduino and Genuino, for use inside/outside USA. In Italy look for Genuino Nano.

I'm in the USA. I see some Nanos, or Nano compatibles on newegg, made in china by companies I'm not familiar with. They go for a few bucks each, incredibly cheap. Are those good to get? Or should I stick with Adafruit or the Arduino store (neither of which has a Nano available for purchase right now).

Hi, What are you trying to achieve? What will be your algorithm for control?

Tom..... :)

TomGeorge: Hi, What are you trying to achieve? What will be your algorithm for control?

Tom..... :)

MUX two pwm inputs to produce a third. To start with, a very simple algorithm:

pwmOut = max(pwmIn1, pwmIn2);

I'll fine tune that simple arithmetic once i get it put together.

The synthesized signal will be used to control the speed of the case fans on my pc.

The two pwm inputs are generated by other compnents in my pc, the motherboard and gpu. They reflect the temperature of the the CPU and GPU. Those existing inputs are controlling the fans directly associated with its respective device, and they'll continue to serve that purpose in addition to providing inputs to the arduino based MUX device.

So the case fans will respond to the cooling needs of the CPU and the GPU. Without the device, I have to pick one of those two sources as the 'master' that determines the case fans speeds. I want to pick both.

First I have to get my hands on a couple Arduino Nanos to play with.

I found the answer to my first question. Where can you get a Nano?

http://store.gravitech.us/arduino.html

More generally, for all manner of stuff from the duino-verse...

https://www.arduino.cc/en/Main/Buy https://www.arduino.cc/en/Products/Counterfeit

michael-duino: What's a "module"? Is my pc a module?

Here a module (or device) is whatever electric circuit you connect to another circuit. Every connection requires a reference (base, ground) line, in addition to the signal or power lines.

Finally placed an order for a nano + terminal adapter.

I have in mind to use the terminal adapter for the final assembly too. Wrap the whole thing in black electrical tape when done and tuck it away in the bottom of my pc case.