ATtiny85 - PWM @ ~18-30KHz

Hi all,

i'm trying to build a simple DC-Fan-Controller using an ATtiny85, as i want to keep the wiring as basic as possible.

My problem now, that i don't know, how to set the PWM frequency of the ATtiny to ~18-30KHz as this is the frequency, my fan supports.
There are many tutorials on the web, but as i have no idea, of what exactly i'm looking for, most of them are not very helpful... :confused:

I'm using the ATTinyCore.

What do i have to do, to get a PWM frequency in the range of 18-30KHz?

Any help greatly appreciated.

Thanks in advance!


I did some further research and discovered this great website

If i understand this all correctly, all i have to do is set the Prescale-Value to "2" and the TOP-Value to "199" to achieve ~20KHz on TIMER1 using a System-Clock of 8MHz, right?

Any comments on my thoughts? :confused:

Look at Secrets of Arduino PWM, Arduino PWM frequency and PWM Frequency. Hope it helps :slight_smile: