How to eliminate noise from PWM controlled 12V fan at low speed

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.


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

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


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.