Is it possible using an arduino to control more than 4 PWM fan at 25khz ?

I have found this but 4 PWM limited with an UNO


An other arduino, like a 2560 could be used ?

Thanks Best regards Sébastien

  • I would like replace this : nzxt.com/products/grid-plus-v3 in my work station Commented Oct 16, 2018 at 13:01
  • See answers in arduino.stackexchange.com/questions/3182/… for a guide on how fast Arduino PWM can be.
    – MichaelT
    Commented Oct 16, 2018 at 13:40
  • You could also use timer0, but then delay and millis won't work anymore. Second option is to use a external chip. You could also use a MEGA like you suggested, or the newer ATMega328PB (I don't think the latter is already used in the UNOs)
    – Gerben
    Commented Oct 16, 2018 at 13:54
  • why would you need individual control of the 4 fans? ... just use one PWM signal to control all four.
    – jsotola
    Commented Oct 16, 2018 at 16:04
  • '328P supports 6 analogWrite() outputs on D3,5,6,9,10,11. Won't all 6 do 25 KHz?
    – CrossRoads
    Commented Oct 16, 2018 at 17:19

1 Answer 1


Indeed you could use a Mega. See this answer: it explains how you can use Timer 1 on an Uno to provide two PWM channels at 25 kHz. This is the only 16-bit timer on that board. The Mega, on the other hand, has four 16-bit timers: Timers 1, 3, 4 and 5. These timers are almost identical to the Uno's Timer 1, except that they provide 3 PWM channels each. So you have potentially up to 12 PWM channels that you can run at 25 kHz.

Now, look at this pinout diagram. Every pin labeled OCnx, where n is either 1, 3, 4 or 5, and x is a letter, is a 16-bit PWM output. Just take the code from the answer I linked to and adapt it to the Mega. You configure all those timers in the same way, and you set the duty cycle for pin OC3B by writing to the register OCR3B (and so on...).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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