I'm trying to control the speed of a PWM fan (4 wire, DC brushless motor with a PWM wire). The PWM pin of the Arduino will connect to the PWM wire of the fan, and the 2 power wire would connect to the battery. There is another tacho wire that won't be used.
My question is, how do I actually change the speed of the fan? I'm a beginner but I feel there are many ways to do this. I want to a knob that I can turn. I'm thinking a potentiometer might be one way to do this, the Arduino can then sense a change in resistance somehow and change the duty cycle of the PWM. But I don't know the details of implementation. If you can recommend a webpage or tutorial that'll be appreciated.
I need the knob to be big enough to easily handle. Wouldn't want one of those knobs that one has to use a screwdriver to turn...
Thanks
Your idea sounds perfectly feasible adn a great beginner project. Try doing some google work with arduino and potentiometer and you will find TONS of not only information and you tube videos and tutorials, and hackadays, and so much stuff that it would be impossible to list here. Just google a little and you'll find something already written that's exactly what you're looking for. This has been done so many times that even trying to choose one to show you would be hard just because we don't know much about your skill level. But I promise that this particular topic has been covered like a million times all over the internet. Someone has done it at your level whatever that level is.
There is an important book you should have in your library, it is called Arduino Cookbook, it is very good and would have everything you need for your project. Since you are new I highly suggest you also learn a little CAD to draw your schematics. You can download a full CAD program called KiCad for free, the only thing asked is a freewill donation. I use it and it takes me from idea through completed circuit boards. Learning it is not an over the weekend project unless you have CAD experience. There are others available some as demos with some limits. Schematics is the language of electronics. A lot of users use the frizzy program but after a few items it is useless and definitely does not contain enough information to properly debug a project unless you are intimately familiar with it.
Tell me the frequency of your PWM signal? Once I know the answer, I will show you the way of changing the speed of the fan by changing the duty cycle of the PWM signal using a potentiometer.
4-pin computer fans should be PWM-ed with 25kHz (according to the Intel specifications).
But the fans I tried work just fine on the default PWM frequency of an Arduino.
Connect fan ground and the blue PWM wire to ground and pin 5 of the (classic) Nano.
Connect 12volt fan power to ground (black) and fan power (yellow or red).
Connect the pot to Nano 5volt and ground, and the center pin of the pot to A0.
This is all you need for basic control.
It does say 25kHz for PWM, and after doing some reading on Arduino, it seems the analogWrite function doesn't output anywhere near that frequency (do you know how what is the frequency for analogWrite?) So right now I'm currently reading about the timers.
So it seems so much easier to just use the analogWrite. Now you said the fans you tried worked fine, but I wonder from a theory perspective what's the drawbacks (if any)?
As a side question, these 4 wire PWM fans seems to be for computer use. I wonder if they have bigger fans for say, home ventilation use or HVAC use that work similarly (4 wire, PWM, can be controlled via Arduino)?
I picked pin5, because pin5 and pin6 are about 1kHz on an Uno.
The other PWM pins are about 500Hz.
Google also knows those things. Try "Arduino PWM frequency".
The drawbacks of a lower PWM frequency is a possible audible PWM whitle in the fan, and/or not being able to dial down to very low speeds.
Many larger fans also seem to use the same Intel specification as computer fans.
Leo..
Are there are any good libraries for PWM? It seems a lot of work to deal with that low level stuff if one wants a PWM frequency beside what's offered with analogwrite()...
I appreciate the help so far. We've been talking about sending a PWM signal to the PWM wire of a 4 wire fan to control the speed.
The fan also comes with a 3 wire version (non - PWM). I wonder if it's possible to control the speed for the non - PWM version by lowering the drive voltage instead? It's a "12V" fan so I wonder what's the difference (if any) between going the PWM route with a 50% duty cycle (so average voltage is 6V) VS feeding constant 6V to the power?
The difference I'm interested in are static pressure and flow rate. With fans, it usually delivers max static pressure at low flow rate, and pressure drops as flow rate increases.
Thanks