my question is how do I control speed of a fan I got from an old PC. It has 3 pins and label says it is 12V.
When I connect ground and voltage to my Freaduino UNO (fully Arduino compatible), the fan starts spinning even with no code, because as I measured, the board outputs 5V all the time.
Stepan214:
The above can be ignored, How do I Set a fan RPM if it has 3 wires, using only Arduino, power supply and wires?
You dont.
The third wire just reads back the RPM. The RPM is determined by the voltage you supply to the fan, at least that's the only way I interacted with PC fans. The arduino itself can only output 5V, not 12V.
You would need some kind of controller in between (BLDCs are inductive loads afaik and you shouldn't drive them directly with the arduino anyway), but that seems to be out of the scope of your question.
Alright, quick solution I found: I used a relay and created another circuit. Now the fan is powered using a 9V battery and connected to the relay. However, I cannot control anywhere between stop and full speed (9V, not technically full speed, but works for now), but that is also not a problem right now.
Because you need to control the voltage to control the speed. Typically PC Fans are run between 7V and 12V. Build a circuit that allows the Arduino to change the output voltage of some driver/etc. then you will be able to deduce the rpm from the voltage you supply. Or use the third wire that should give you the rpm.