7

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

Fieg
  • 175
  • 1
  • 1
  • 8

9 Answers9

4

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.

Fieg
  • 175
  • 1
  • 1
  • 8
SAS
  • 56
  • 1
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.

Gerben
  • 11,332
  • 3
  • 22
  • 34
3

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

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

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.

Raros
  • 1
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.

Woopi
  • 1
  • 1
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.

Martynas
  • 538
  • 3
  • 10
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

0

25kHz power PWM solved this problem for my 3-pin fan. Diode had no effect on noise, it fixes another problem (EMI).

temoto
  • 101
  • 2