Author Options:

Can I control the speed of 2 wire CPU fan from arduino uno ? Answered

This is my first project of arduino. I have purchased 2 wire (red and black) cpu fan and i want to control the speed of cpu fan through my arduino board but i dont know how to connect the wire of cpu fan to relay.


I used this page here, to control a 5v mini fan with an arduino pro micro. I used a 2N3904 instead of the BD139. (not sure if thats correct, but it works). I can control the speed based on my DHT22 values.

Sketch and images in the description here: https://codebender.cc/sketch:322563

I used a potentiometer at first (as you can see from the image) to manually control the speed of the fan...Once i got that working, i replaced it with the DHT22 to automate things.

No, you can only switch it on or off, no speed control. There is a small circuit board inside which functions as an ESC(electronic speed control).

You will also need a separate psu to power the motor because the arduino only puts out 5V, most brushless fans need a minimum of 8v to rotate.

I have a relay wch will convert 5v to 12 volt. Nd if i want to control the speed of fan then what should i do??

Relays dont convert voltage, they only switch over from one contact to another, they cant change the fan speed.

You cannot power a 2 wire 12v brushless cpu fan off an arduino, unless you use an ESC from R/C equipment and hack the pcb on the fan.

The cpu fan already has its own built in esc and only provides a red wire +12V dc and a black -12v dc/ground.

The only way to connect it as I have said in my first comment is to switch it on or off... red from fan to NO relay contact, red from 12v psu to C(common) contact.

The black from the fan goes direct to black-12v of psu.

Arduino does not provide 12v dc, a relay does not convert voltages, it only switches... from an external psu which you need to provide.

i have made the connection as you have mentioned above but i dont know what code should i write to turn on and off the fan??

My cpu fan is having 2 wire (black n red) nd i dont know where to plug these wires (no,nc,c). Plz instruct me where to plug red wire nd where to plug black wire

If there is no built in speed control (a third, probably yellow wire) then less voltage will result in a lower speed. You will have to get it started though and bring it down to get it to much slower speeds. It might impact the life of the fan though.

Do you know the voltage the fan is looking for optimally?


2 years ago

The red wire is the positive DC and the black wire is the negative DC.

no = normally-Open, nc = normally-Closed, c = Common.