# Reading GPU PWM output from an arduino

Hi,

I'm wanting to be able to read the PWM value outputted from a computer graphics card fan header to intercept the signal and make my own PWM controller.
I'm using a custom cooler with my GPU, along with a couple of 4 pin 120mm PWM fans. This aftermarket cooler setup has much greater thermal dissipation capacity then the stock cooler, so I'd like to adjust the fan speed accordingly. The GPU also doesn't allow you to have the fans speed at 0% (even if the GPU temp is under 50c), which is another reason why I'd like to be able to control it myself.

I've had a look at reading fan speeds on my arduino from the link below, but can't get it working, I get no value in the serial output terminal. When I create a PWM signal out on the arduino itself, then read it using one of the interrupt pins I get a value just fine. I've seen other posts saying that the PWM signal that is generated for PC fans can be problematic for reading on the arduino, so I suspect that's why it's not working.

I'm thinking that it may just be easier to bypass reading PWM on the arduino all together, and convert the 12v PWM that I want to read into a 0-5v analog signal, which I could then read easily from the analog pins.

I'm pretty comfortable with programming on the arduino, but am a bit of a noob when it comes to electronics, so need some guidance here.
Ideally there would be a part I can by from mouser or rsonline that can do what I need, and I can solder it up and use it with an arduino.
If I have to build a circuit for this I'd do it, provided it's not too complicated.

Could anybody provide any direction here?
Thanks

Let VOUT = 5V
VIN = 12V
R1 = 8200 (8.2k)

Vo = Vin* (R2/(8200 + R2)

5V = 12V* (R2/(8200 + R2)

5 12*R2
----- = --------
1 (8200 + R2)

(cross multiply)

5*(8200 + R2) = 12*R2

41000 + 5R2 = 12R2

41000 = 12R2 - 5R2

7*R2 = 41000

R2 = 41000/7

R2 = 5857 ~ 5.6k

Proof:

Vo = Vin*( 5600/(8200+5600)

Vo = 12v* (5600/13800)

Vo = 4.89V

Use a voltage divider with 8.2 k and 5.6k, with the 12V PWM connected to one end of the 8.2k
and the other end of the 8.2k connected to one end of the 5.6k, and the other end of the 5.6k
connected to GND (COMMON GND between device sending PWM and arduino)

Connect the pin used to read the pwm to where the two resistors connect (the output of the voltage
divider) and use this tutorial to read the pwm

PulseIn()

Would the above circuit drop the voltage down and convert it from 0-5v analog?
Ideally I don't really want a PWM signal to read as I've seen online that it can be problematic reading from a 4 pin computer pwm fan.

YES, it would if drop it from 12V to 5V and
the folling would convert it to analog.

Just add a 4.7 k / 5.7uF RC LPF after the voltage divider (4.7k ohm resistor from the analog pin to the output ofvtge votsge divider and the 4.7uF electrolyitic cap goes + terminal to the analog pin , - terminal to GND.

No, it will being down the signal from 12V to 5V.

You can add a capacitor; value depends on the PWM frequency that you want to measure.
I see that previous reply contains a value for the capacitor
[/edit]

Please provide links to articles that state that reading from a 4 pin PWM fan is problematic.

Is this circuit correct?

Can you please also clarify if I need a 5.7uF capacitor or 4.7uF capacitor? Both values were listed in your reply.

Thanks very much

I read that those fans are run with
PWM at about 25KHz. So you can use
a much smaller capacitor and eliminate
the 4.7K resistor. This is not a place to
use a low-pass filter since it uses a fixed,
single frequency.
Herb

Apparently for computer fans the acceptable PWM operational range is from 21 kHz to 28 kHz. I don't want to assume that the PWM signal is definitely going to be running at, or very close to 25kHz.

21 to 28 kHz? Supersonic? Wow.

Can you please also clarify if I need a 5.7uF capacitor or 4.7uF capacitor?

5.7uF is not a standard value, 4.7uF is.

That was a typo. It should be 4.7uF.

I would keep the 4.7k resistor because at 28kHz
the Capacitive Reactance (Xc) = 1.209 Ohms.
(Xc = 1/(2Pi f* C))

Without the resistor you would be effectively putting a
1.2 ohm resistor in parallel with the 5.6k
resistor.

Remember, coils are a short at DC and open at
high frequency whereas caps are open at DC
and a short at high frequency. The higher the
frequency the more a cap 'approaches' a short.
28 kHz is pretty high. Use the 4.7 k ohm/4.7uF.
like I (meant to) told you.
FYI, no big deal but in the schematic you just
posted, the terminal of the cap that goes to
ground should be vertical ( like the 5.6k ohm resistor), not horizontal. It should be represented as visually parallel with the 5.6 k resistor ( but separated by the 4.7k ohm resistor. You showed
it 'L' shaped , which you would not see in a
properly drawn schematic. (it's a minor detail
I thought you should know about. Electrically it's still correct. It just looks wierd.

raschemmel:
That was a typo. It should be 4.7uF.

I would keep the 4.7k resistor because at 28kHz
the Capacitive Reactance (Xc) = 1.209 Ohms.
(Xc = 1/(2Pi f* C))

Without the resistor you would be effectively putting a
1.2 ohm resistor in parallel with the 5.6k
resistor.

Remember, coils are a short at DC and open at
high frequency whereas caps are open at DC
and a short at high frequency. The higher the
frequency the more a cap 'approaches' a short.
28 kHz is pretty high. Use the 4.7 k ohm/4.7uF.
like I (meant to) told you.
FYI, no big deal but in the schematic you just
posted, the terminal of the cap that goes to
ground should be vertical ( like the 5.6k ohm resistor), not horizontal. It should be represented as visually parallel with the 5.6 k resistor ( but separated by the 4.7k ohm resistor. You showed
it 'L' shaped , which you would not see in a
properly drawn schematic. (it's a minor detail
I thought you should know about. Electrically it's still correct. It just looks wierd.

Thank you. Appreciate the help.

Sorry, one more thing.
I've just read that the voltage of the PWM signal for 12v fans is actually 5v, not 12v, even though the fan itself operates at 12v.

I assume I can just drop the first part of the circuit, and only have the 4.7k resistor and 4.7uF capacitor to convert the 5v pwm to 0 - 5v analog?

Cheers

mattjberry:
I assume I can just drop the first part of the circuit, and only have the 4.7k resistor and 4.7uF capacitor to convert the 5v pwm to 0 - 5v analog?

Yes, that'll do just fine.

I do think the pulseIn() method will be easier to implement and give more accurate readings.

This is a 4-pin fan: it needs +12 Volts, Ground,
a PWM signal input and it supplies a feed-back
signal to show how it is actually running. It runs
from a power supply of 12 volts. The PWM signal
should be 0 to 5 volts. You should not PWM its
power source.
Herb