4

I am trying to build a simple fan controller (single fan). So far I have successfully created a circuit which powers the fan with an external 12v DC adapter and added a transistor (NPN) to switch it on and off. The transistor is connected to a PWM port on the Arduino.

When putting HIGH on the port the fan works perfectly at high speed, but when I want to lower the speed (say analogWrite(fanPin, 150)) it starts to make a humming noise. I believe this is caused by the use of PWM.

What is the best way to control the speed of the fan without (too much) noise?

ps. The fan is a Cooler Master 3-wire PC fan. Transistor is a P2N2222A.

Update: Here is the schema I am using:

schema

  • Martynas pointed out that I should include the circuit, I will do that later today when I get home from work. – Jeroen Fiege Oct 15 '14 at 8:01
  • 1
    Try using pins 5 or 6, as those pwm pins are running at twice the frequency of the other pwm pins. – Gerben Oct 15 '14 at 15:28
  • 1
    When I try your suggestion the noise changes but isn't gone. – Jeroen Fiege Oct 15 '14 at 19:35
1

I had the same problem with a 5V fan. Something simple worked for me: To decrease the PWM frequency. You probably want to do this using pin 9 or 10 (for the Uno) as changing the frequencies of other PWM pins messes up the delay and millis functions. Details on how to do it and a very convenient function are provided in http://playground.arduino.cc/Code/PwmFrequency. In my case, using the lowest frequency possible (31250/1024 = 31Hz), I completely eliminated the hum for higher speeds and significantly reduced it for lower speeds. And by the way, I used the PWM pin to drive a MOSFET since the current of my fan was 140 mA, much higher than the 20 mA Arduino pins can safely provide.

  • I'd be interested in why this works. Is this sound due to some mechanical side effect of the motor or something more interesting like the hum produced by a transformer which (I believe) isn't mechanical. – Kelly S. French May 16 at 14:30
3

Try using pin 3 (or 11) and lower the prescaler of timer 2 using the following code in your setup;

//move from /64 prescaler to /32 prescaler
TCCR2B |= _BV(CS20);//set bit (remove this line for a /8 prescaler)
TCCR2B |= _BV(CS21);//set bit
TCCR2B &= ~_BV(CS22);//clear bit

Halving the prescaler will double the frequency.

  • When I try this I get a noise with a higher frequency. – Jeroen Fiege Oct 18 '14 at 15:49
  • 3
    The goal is to use a frequency high enough to not be audable by the human ear. Have you tried removing the line with CS20? – Gerben Oct 19 '14 at 10:33
  • Yes, I tried that too, but I still hear an annoying noise. – Jeroen Fiege Oct 19 '14 at 11:37
2

It might help to use a capacitor to smooth your PWM signal.

See http://ww1.microchip.com/downloads/en/AppNotes/00771b.pdf

  • That document describes adding a capacitor to reduce slew rate while using an NPN transistor. Is there any way to slow the slew rate while using a MOSFET? – localhost Oct 21 '16 at 2:41
0

coment add circuit to know what you have done

Does your circuit looks similar like:

Do you use resistor for transistor? Diode for fan?

enter image description here

I suspect that you do not have diode.

The purpose of the diode is to allow current that is flowing in the motor coil to continue to flow in the same direction when the transistor turns off. When the transistor turns off, the voltage at the transistor collector will rise as it was flowing out of the motor. From Vce(SAT) it will rise above the power supply voltage and stop only when the transistor breaks down (or when it starts to ring with parasitic capacitance). By putting a diode from the transistor collector to the +12V rail, you prevent the voltage across the transistor from exceeding 12V and and allow the motor current to continue to flow.

  • If you need to ask the original poster questions, please do so by commenting on the question itself. An answer isn't the right place to do that. – Peter Bloomfield Oct 15 '14 at 8:55
  • @PeterR.Bloomfield i understand everything. Sorry for that, but i added an answer too. I would comment if not 44 rep. pts... – Martynas Oct 15 '14 at 9:01
  • I added my schema. It's indeed very similar to yours. Only I had to connect the grounds to get it working. – Jeroen Fiege Oct 15 '14 at 18:42
0

There is also the possibility adding a capacitor bypassing the transistor. But you have to be careful, if the capacity is to big you could damage your transistor.

0

SAS is correct - lowering the PWM to 31Hz works great. Tested using a 12v fan. Before lowering the PWM, the sound from the fan was a loud "WHEEEEEeeeeeeeee" sound at any speed other than full speed. Low speed made the sound worse.

After lowering the PWM frequency, the noise is inaudible at higher speeds. At lower speeds you might hear a light "clicking" noise. The sound reminds me of the faint "clicking" noise you hear as the valves on a car engine open and close.

0

I can also confirm that SAS answer ist correct. I tested it with a 5V DC fan. I hear a very high noise at lower speed, but you have to listen closely, and a very fast clicking noise at higher speeds.

All in all i would say lowering the PWM to the suggested 31Hz did it for me but it is not a perfect solution.

0

I get that this post is 4 year old, but I successfully removed all fan noise with simple electrolytic cap and one ceramic on output, after adding caps you need to bias RPM. You can still get some relay low squeak coming from mosfet but only on low RPM

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.