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
https://arduino.stackovernet.com/fr/q/8407
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 stationSeb Lemania– Seb Lemania2018年10月16日 13:01:09 +00:00Commented 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– MichaelT2018年10月16日 13:40:32 +00:00Commented 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– Gerben2018年10月16日 13:54:32 +00:00Commented 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– jsotola2018年10月16日 16:04:34 +00:00Commented 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– CrossRoads2018年10月16日 17:19:59 +00:00Commented 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...).