Noob here, I recently upgraded my CPU cooler, and now have a Wraith Stealth just hanging around. After tinkering with it for a bit, I realized I could remove the fan from the heatsink, and thought of hooking it up to an Arduino for a future project.
It has 4 pins. From Google, I found that they are GND, 12V, Sense and PWM respectively. What bothers me is the 12V pin, and as far as I know, the Uno can output 5V.
Is it possible for me to connect, and control the fan, and if so, what would I need? I looked it up on the forums, and the OP there changed the question every few replies, so it got pretty confusing by the end.
Yes, you can control the speed of the fan by connecting the pwm pin on the fan to, guess what, a pwm fan on the Uno. You can also monitor the speed of the fan using another Arduino pin (that one does not need to be a pwm pin). You can even power the fan from the 5V pin.
Now to the problems.
Obviously, with only 5V power, the fan will run at much slower speed than with 12V. Also you will need to limit any other components you connect to the Uno, as the fan will use most of the current the Uno can provide at 5V. Also you will need to write code to "soft start" the fan. Otherwise, the current surge as the fan starts could damage the Uno.
You could use a 12V supply and wire that direct to the fan and also to the barrel socket or Vin pin of the Uno. Again, you will need to strictly limit the current drawn by other components connected to the Uno, or it could be damaged, or will refuse to work for more than a few seconds at a time because it's regulator is overheating.
Best option of all, and possible inside a pc, would be to supply 12V to the fan and 5V to the Uno (to its 5V pin).
There's another possible problem. The fan may emit an audible whining sound because the Arduino's pwm signal is in the human audible range. It should be possible to fix that in the code.
Use a transistor like 2n2222 to switch 12v to the fan from a pwm arduino pin. Use a 270ohm resistor between arduino pin and the base of the transistor.
The typical 4 wire 12 volt fan should look like this:
So you just apply a PWM signal input to the PWM pin on the fan. If you just want to experiment I would find a 12 VDC out wall wart for a power supply. I would not use 5 volts to power the fan since once we get down to 3 volts the average 12 volt fan quits turning. My experience with an 80mm x 80mm 12 volt fan was at 12 VDC it drew 157.4 mA and ran at 2740 RPM. At 9.013 VDC the current draw was 115.2 mA and speed was 2,139 RPM. At 6.025 volts current was 75 mA and speed was 1460 RPM and finally at 3.011 current was 31.3 mA and RPM was 114 to 125 fluctuating plus the fan needed greater than about 3 volts before it would rotate.
If you choose to use the tachometer output to measure fan speed keep in mind the output is normally 2 pulses per revolution. From there just do the math. The output is normally a 12 volt pulse if the fan is configured like the above illustration. If it is just open collector you can try adding a pullup to 5 volts to get 5 volt pulses. Likewise I would try applying 5 volt PWM and see if it works. If not then add a transistor as was suggested.
If you have a 10K pot laying around tie one end to 5 Volts and one end to Ground. Run the wiper out into the A0 (or any analog in) and map the analog in to your PWM out.
The drawing is incorrect as pointed out below and thank you to jremington for pointing it out. The N Channel MOSFET would be configured as a low side and not high side switch. .
Ron
The fan circuit won't be using a N channel MOSFET as a high side switch.
jremington:
The fan circuit won't be using a N channel MOSFET as a high side switch.
Oh man, can't believe I did that. Thank you for point that out. MOSFET goes south of the motor.
Thanks
Ron
Watcher:
Use a transistor like 2n2222 to switch 12v to the fan from a pwm arduino pin. Use a 270ohm resistor between arduino pin and the base of the transistor.
Not needed. A 4 pin fan has that built-in.