Arduino Uno to Control PWM Fans?

I was wondering if I could use the Arduino Uno's PWM pin to control a PWM fan's speed? and supply auxillary power to actually drive the fan. I will be using it as a control hub for the rest of my computer such as fan speed, lighting, temperature, etc.
If its possible, then how would I go about doing so?

Also the 12V supplied by a molex plug in a computer's PSU would be enough to power the Arduino right?

Thanks in advance.

Brinith:
I was wondering if I could use the Arduino Uno's PWM pin to control a PWM fan's speed

Nope. Whoops, sorry, [backspace] [backspace] [backspace] [backspace] [backspace] [backspace] Yep for sure. The only caveat is that down at -low- RPMs DC motors often get boggy.

and supply auxillary power to actually drive the fan.

Pretty much nope. Arduino can supply only a tiny amount of current.

I will be using it as a control hub for the rest of my computer such as fan speed, lighting, temperature, etc.
If its possible, then how would I go about doing so?

Google is your NEW best friend. :smiley: :smiley: Look up...

site:arduino.cc "computer" "fans" "fet" "12v" "pwm"

...-including- all the "quotes" and your friend will return a bunch of very relevant hits. Start reading and come back again when you have a Q.

Also the 12V supplied by a molex plug in a computer's PSU would be enough to power the Arduino right?

Yep, plenty, that's exactly what they're for. You don't -have- to buy Molex connectors you can cut/splice/extend them manually.

I meant auxillary power as in another molex. And I only plan on getting as low as about 30-40% fan speed, so the motors shouldn't have a problem.

I didn't realize it was a as common of a question as it is. But also as complex. Being fairly new to electronics (well creating it), I didn't realize it to be as complicated. I just assumed it would be simply connecting the PWM pin to the Arduino's, and supply them both with power through the PSU and witha change of a variable, that would be it.

Well time to research because I don't understand half the things they are trying to say.

Are you too new to electronics to draw a schematic with pen and paper and take a photo of it with your cell phone and post it ?

I didn't bother as it is way too simplistic and would basically be a waste of effort compared to merely explaining it

I meant auxillary power as in another molex.

And I only plan on getting as low as about 30-40% fan speed, so the motors shouldn't have a problem.

So it is assumed we know how you plan to connect the molex ?
I didn't see that mentioned in your post. Are we supposed to know what you mean ?
I mean if it is so "simplistic" why are you posting here and what are you asking for ?
Is there a question here somewhere ? I didn't see any question marks.

I merely used to explain how I originally thought how it was going to work. However, since jbarchuk pointed me to some other posts, I now understand that was not the case. And I added a question mark to please your needs.

Makes me realize again how much some people like pick on every tiny mistake others make.

Okay, I didn't include a diagram/schematic. Not only is this my first post, but I literally just started into making electronics (for lack of a better term onhand, don't start complaining about that too) and making a schematic didn't cross my mind. I just barely managed to remember most of the basic signs in schematics.

I don't know what happened to you, but you seriously need a change in attitude. I probably going to never use this forum again if most of the members are like you. Luckily for me, there are many alternatives.

So it is assumed we know how you plan to connect the molex ?
I didn't see that mentioned in your post. Are we supposed to know what you mean ?
I mean if it is so "simplistic" why are you posting here and what are asking for ?
Is there a question here somewhere ? I didn't see any question marks.

Did I offend you because I asked how are we going to help you if you don't explain what you mean ? I don't see how that be interpreted as an offensive remark . And regarding the question mark , was I not asking you if you have a question and you interpret that as "being picky " because I said I didn't see a question mark. How can we help you if you fly off the handle when we simply ask you what exactly it is you want ? Please explain this to me . I am not understanding where you are coming from. I asked you for a schematic and you reply that is too simplistic

I didn't bother as it is way too simplistic and would basically be a waste of effort compared to merely explaining it

(and later confess that you don't know how to draw a schematic) .

and making a schematic didn't cross my mind. I just barely managed to remember most of the basic signs in schematics.

When I asked you this:

Are you too new to electronics to draw a schematic with pen and paper and take a photo of it with your cell phone and post it ?

(which looks to me like a straight-forward question, devoid of sarcasm or attitude) Is there any reason why you could not have simply answered "Yes, I am" ? So that we could go to Plan-B where you simply post a wiring list of how you want it connected ?

so I then reply "then why are you posting ? What do you want ? and you get upset and say you won't ever use the forum again.
If I am here to help you and I can't understand what it is you want, am I not supposed to ask you why you are posting ?
On what do you base your judgement of my attitude ? (on the fact that I am trying to find out what you want and you find that offensive ? Help me out here .

I probably going to never use this forum again if most of the members are like you. .

You might as well shoot yourself in the foot if you're going to do that because it is the same thing as far as learning about arduinos and how to use them.

Luckily for me, there are many alternatives

Really ? Name a couple . We have people all over the world with 20,30, even 40 years experience in every field you can imagine
available to answer any question 24/7/365. You would be foolish not to take advantage of that knowledge base.
My advice to you is collect yourself and start over. Make a wiring list of how you want your connectors wired. As far as learning how to draw a schematic, here are some links to help you.

http://www.learn-c.com/schemat.htm

Yeah, ignore the trolls. Do you plan to use a 4-wire fan which has a separate PWM pin, or do you want to chop the power supply to the fan with your own transistor?

In the 4-pin case it is kind of easy and in the manual case it's fine as long as you don't want RPM measurements also. Chopping the fan's power pin will impose that PWM waveform onto the tachometer output, so you won't really be able to tell how fast the fan is going. I spent a fair bit of time designing an analogue circuit to circumvent that problem but it fails because at low duty cycles, the capacitor internal to the fan discharges rapidly so you get no tacho output at all even if the fan is running.

4-pin fans have a "minimum speed" (typically about 500RPM) which they will go to if you hold the PWM pin down, i.e. you can't get them to slow all the way to zero without killing the power. But they produce a reliable tacho output at all speeds.

The big physical wrinkle is PWM frequency. The arduino default is about 490Hz, which you can hear as an annoying whine. You probably want to reprogram timer2 to produce PWM at 31kHz or 62kHz and use that signal. A very-low (eg 5Hz) PWM frequency is little better than 500Hz because each PWM edge is still audible as a click. You must use a high PWM frequency to get a silent fan.

In terms of the tacho output, note that the fan is 12V and the arduino is NOT, therefore you should put a diode between the tacho pin and your arduino speed-input pin (anode on the arduino side). That means the fan can pull the pin down, but cannot pull it up past 5V and damage the arduino by feeding 12V into VCC through the pin-protect diode. Enable the internal pin pull-up by writing a 1 to it after setting it as an input. Similarly for driving the PWM pin on a 4-pin fan, use a BC548 or similar to make an open-collector output. See the attached schematic - it can disable the fan entirely with a high-side transistor, controls the speed using the fan's PWM input, and monitors the speed from the tacho pin.

You probably want to use Timer 1 (16 bit) to measure the fan's tacho period. Requires a customer interrupt handler for the timer.

If you get stuck, I have a sketch matching the above schematic that I can supply; it includes two nested PID loops to control the fan to achieve a particular temperature, as sensed using a pair of DS1620. It's designed for an audio amplifier, hence the "remote input", "mute relay" and load shutdown signals.

fancontrol.pdf (69.3 KB)

Brinith:
I meant auxillary power as in another molex. And I only plan on getting as low as about 30-40% fan speed, so the motors shouldn't have a problem.

Look on ebay for led panel meters. There are ammeters and voltmeters for various ranges. It's fun to plug in a few of those into a circuit to see values change all at the same time. They're much more convenient than one multimeter probing around, and saves the annoyance of patching wires to plug the ammeter inline.

Check out Circuit Simulator Applet I found this one literally only a few days ago and haven't really gotten into it much but it looks awesome. You'll see screencaps of circuits posted here once in a while for demonstration purposes.

Being fairly new to electronics (well creating it), I didn't realize it to be as complicated. I just assumed it would be simply connecting the PWM pin to the Arduino's, and supply them both with power through the PSU and witha change of a variable, that would be it.

It's complex and intricate for only the first... few hundred times. LOL! The blinky LEd is everyone's Ardiono-101. The fasn is only a couple of parts more than the LED. Add a FET and a couple of resistor and it's a -great- Arduino-102. You'll learn a lot from it.

Yeah, ignore the trolls

@polyglot,

If you have something to say why don't you do it directly instead of hiding behind generalities about fictional creatures from some fantasy game you used to play that you can disavow later ?

polyglot:
Yeah, ignore the trolls. Do you plan to use a 4-wire fan which has a separate PWM pin, or do you want to chop the power supply to the fan with your own transistor?

In the 4-pin case it is kind of easy and in the manual case it's fine as long as you don't want RPM measurements also. Chopping the fan's power pin will impose that PWM waveform onto the tachometer output, so you won't really be able to tell how fast the fan is going. I spent a fair bit of time designing an analogue circuit to circumvent that problem but it fails because at low duty cycles, the capacitor internal to the fan discharges rapidly so you get no tacho output at all even if the fan is running.

4-pin fans have a "minimum speed" (typically about 500RPM) which they will go to if you hold the PWM pin down, i.e. you can't get them to slow all the way to zero without killing the power. But they produce a reliable tacho output at all speeds.

The big physical wrinkle is PWM frequency. The arduino default is about 490Hz, which you can hear as an annoying whine. You probably want to reprogram timer2 to produce PWM at 31kHz or 62kHz and use that signal. A very-low (eg 5Hz) PWM frequency is little better than 500Hz because each PWM edge is still audible as a click. You must use a high PWM frequency to get a silent fan.

In terms of the tacho output, note that the fan is 12V and the arduino is NOT, therefore you should put a diode between the tacho pin and your arduino speed-input pin (anode on the arduino side). That means the fan can pull the pin down, but cannot pull it up past 5V and damage the arduino by feeding 12V into VCC through the pin-protect diode. Enable the internal pin pull-up by writing a 1 to it after setting it as an input. Similarly for driving the PWM pin on a 4-pin fan, use a BC548 or similar to make an open-collector output. See the attached schematic - it can disable the fan entirely with a high-side transistor, controls the speed using the fan's PWM input, and monitors the speed from the tacho pin.

You probably want to use Timer 1 (16 bit) to measure the fan's tacho period. Requires a customer interrupt handler for the timer.

If you get stuck, I have a sketch matching the above schematic that I can supply; it includes two nested PID loops to control the fan to achieve a particular temperature, as sensed using a pair of DS1620. It's designed for an audio amplifier, hence the "remote input", "mute relay" and load shutdown signals.

Thanks, that helps clarifying alot of the things I was confused about. I will be using fans with a separate PWM pin. Seeing that for my application, I do not require the actual RPM of the Fan , would it be safe to say that I would not worry about the tacho pin?

I'll try to see if I can make a schematic of it now that it has become increasingly difficult to explain.

@OP,
see attached fan wiring pinout

Here's tutorial on controlling computer fan speed.

pwm_diagram.jpg

raschemmel:

Yeah, ignore the trolls

@polyglot,

If you have something to say why don't you do it directly instead of hiding behind generalities about fictional creatures from some fantasy game you used to play that you can disavow later ?

I had plenty to say - you could even read it all above. Looks like it might even have been useful to the OP, who knew?

If you answered people's questions instead of snarking at and insulting them, they wouldn't get angry with your responses and I wouldn't be calling you a troll. Belittling others doesn't make anyone think you're smarter.

@polyglot,

Are you too new to electronics to draw a schematic with pen and paper and take a photo of it with your cell phone and post it ?

So in your mind the above question is belittling ?
(Taking into account the OP stated he was new to electronics so can I in all fairness ask him to post a schematic without first asking him if he is too new to post a schematic ?)
So far you have not submitted any proof to support the following accusations:

instead of snarking at and insulting them,

?