PWM frequency, is 25kHz possible?


I want to control a 4-pin PWM FAN (computer casing) using the imp. It seems that norm for the PWM control for 4-pin computer fans is 25kHz.

I remember from arduino that this was somewhat complicated to obtain, how is the case for the imp?

This is how I did it last time I was playing with a 4pin pwm fan from a computer. They are not that picky about the frequency, but if you set it too low you can hear it.

Great, thats perfect, thanks Mike!

25kHz PWM is no problem for the imp, see, float, float)

You’d just specify the period as 1/25,000ths of a second. Note the 1.0 (vs 1) to ensure that you get a floating point value here:

hardware.pin1.configure(PWM_OUT, 1.0/25000, 0.5);

…this sets 25kHz, 50% duty cycle on pin 1.