Dear community, I have a 5KΩ potentiometer (attached) and would like to control through it and the Arduino nano, a 5V fan . The one (fan) attached has only 2 wires but I could get a 3 or 4 wire fan to connect. Can someone please offer advice on the library and the wiring please?
Since a fan motor cannot be powered by an Arduino pin, you will need a driver to go between the Nano and the motor (fan). If the fan is not reversible the driver can be a simple transistor driver. The preferred driver, nowadays, is the logic level MOSFET.
Scale the output. The analogRead function returns a value between 0 and 1023. The analogWrite function (that controls PWM or the motor speed) requires a value between 0 and 255. You can use the map() function or simply divide by 4.
Use analogWrite to output the scaled value to the PWM pin.
Thank you very much both ! Regarding the hardware connection : it is for a simple + - PC fan correct ?
If I understood it right I can use that hardware connection and the libraries groundFungus sent to operate the fan , is that correct ?
Yes, for the typical 12V or 5V brushless fan motor. Note that those motors are not reversible by swapping polarity of the motor supply.
There are no libraries required, only functions. Reading the pot uses the analogRead function. Control the motor speed with PWM using the analogWrite function. To scale the output from the analogRead (0 -1023) to the range of values output by the analogWrite function (0 - 255) use either the map function or just divide the output from analogRead by 4.
A google search for "arduino control 2 wire fan speed" gets almost 4 million hits.
Thank you groundFungus , I will get back to this post with my results !
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.