Arduino PWM control MOSFET

I have a bit of a problem that in hoping someone can shed some light on.

I have a 4 wire fan (from a power mac g5) and I found that the pinout is positive, negative, PWM and rpm output. It's a bit strange in that the 12v must be connected constantly and the fan speed is actually controlled with either a variable voltage to the PWM pin or I'm guessing an actual PWM of 12v would be more likely. I have tested this with 12, 5 and 3v to the PWM input and it works.

I'm not trying to PWM the main 12v rail, most examples I've seen show this.

So what I am trying to do is control 4 of these fans with an arduino uno.

If I take a 12v wall wart and power the 12v rail on the fan, then use a mosfet to produce the 12v PWM signal using the arduino to drive the PWM input on the fan, is this the way to go? Can anyone show me an example of how to do this using 1 12v PSU?

My knowledge of transistors/mosfets is nil!

Thanks,

The trick with a computer fan is the frequency of the PWM signal - it has to be within bounds that the default Arduino PWM frequency is about 1/40th of.

Intel (probably) published this datasheet on 4-wire fan control. Section 2.1.4 has the main business.

The current draw does not come from the PWM pin - the specification says it's 8mA maximum. A good Sanyo Denki 12V computer fan can eat 3 Amps through the 12V line! The Arduino could drive the PWM control by itself (although inverted), but I recommend an NPN BJT transistor or an N-channel MOSFET even for one fan, let alone four. All you need to do is connect the Base/Gate to the Arduino PWM pin (with a resistor, if it's an NPN transistor), Emitter/Source to ground, and Collector/Drain to the PWM wire on the fan.

You will of course need to up the PWM frequency on the Arduino to between 21 and 28kHz, and have a read through the rest of the aforementioned datasheet to find the minimum duty cycle. (Spoiler alert: it's actually specified by each fan's manufacturer, not the datasheet per se, but it can easily be determined throug trial and error.)

Suitable drivers are (off the top of my tired head):

BJT Transistors: - 2N3904 , BC548 , 2N2222;

MOSFETs: - 2N7000, 2N7002, BSS138, BS170.

You say the PWM pin works with 3 V, so this is probably a logic input. You may have damaged it by applying 12 V. However, as long as it still works, all you need to to (apparently from your description) is to drive the fan PWM pin from a PWM output of your microcontroller. The circuitry inside the fan takes care of the rest. No power switching is needed on your end.

• It's definitely not a logic input as such. It doesn't follow the normal pc fan convention. I tried running it from PWM output on the arduino, but no joy. With the 12v rail applied, I can use a 3/5v output from the arduino to drive it easily and 12v also goes full speed. May 22, 2015 at 20:30
• Here is where I found out the info so far: tonymacx86.com/powermac-g5/69889-info-g5-fans.html May 22, 2015 at 20:40
• From researching further, the current draw is actually from the PWM input, not the 12v rail. How would I use a mosfet to control a 12v PWM signal to this fan? May 22, 2015 at 21:32
• Anyone? Forget the fan peculiarities for a second. Let's just say that I need to generate a 12v PWM signal, using an arduino to generate a 5v PWM signal, would I be better off using a p or n transistor in this scenario? May 24, 2015 at 2:26