PWM fans for arduino

I know this topic's come up before but I get very confused with all the different posts on the subject.

I have an Arduino Duemilnove and I want to attach 3 servos and 1 12v DC PWM fan to it. I will control all of these via Max/MSP. My first question is power supply - should I just use a 12v adapter and plug it into the jack on the arduino board? Currently my 3 servos are hooked up to the 5v input that gets power from the USB. I was hoping to power them via USB and the fan separately from the jack. Does this work? My second question is about the fan - I want to control it via PWM. Do I need to get a special type of fan for this? My computer fan has three wires, so I was thinking I could attach the yellow one to the PWM pin and control it from Max.

If anyone knows how I should be hooking this up please let me know - I have a project coming up very soon that I need to get this running for!

Thanks

Do I need to get a special type of fan for this

No

so I was thinking I could attach the yellow one to the PWM pin

No, that pin is for measuring the speed of the fan not controlling it.

You should be hooking the fan up to the 12V (assuming it is a 12V fan), you can also use this to power the arduino through the power jack and you will need a transistor to turn the 5V output to 12V for the fan. You can continue to run the servos off the 5V but I would add some extra decoupling capacitors on the power to the servos.

Thanks for the explanation! That was very clear. So, you mention I can't control the speed of the fan by plugging the yellow wire into the PWM pin on the Arduino. How do I control the speed then? I've seen examples where you control the voltage instead - is that how you do it? Or can I get a 4-wire PWM fan and plug that in?

You will need to use the analogWrite function to supply the PWM signal for the fan via a transistor because you need 12V and not 5v.

You can control the fan with PWM of the power to it. http://www.thebox.myzen.co.uk/Tutorial/PWM.html Either filtered or non filtered PWM. In fact a fan manufacturer I was in contact with said that the filtered PWM, that is a varying DC voltage, was better in terms of reliability than straight PWM but in this case I don't think it matters much.

Or can I get a 4-wire PWM fan and plug that in?

I have not come across a fan with built in speed control so I am not sure about this.

Just treat the fan like a motor:- http://www.thebox.myzen.co.uk/Workshop/Motors_1.html and http://www.thebox.myzen.co.uk/Workshop/Motors_2.html

i've seen a couple 4 wire pwm fans around. i think they designed them so you could regulate the speed while still getting a tachometer output. if you pwm a 3 wire fan the tachometer output gets pulsed also and it messes with the rpm readings.