Determining best fan PWM frequency

  • Hi all,

    The other day I received my new parts cooling fan in the mail - got the soldering iron out and made it happen. Upon testing it out, I noticed it wouldn't start to rotate until I hit about 75% throttle.
    So I begin testing different PWM frequencies to see what it liked best (using code chunk below), starting at Q100, then Q500, and then increasing by 500 until I could get the fan to turn on from 0% to 10% reliably, with no 'blip' required, and with the least amount of noise - which yielded the outcome of Q5000. Then I went in 100 increments up until I lost the ability to turn on to 10% from a dead start, and went back down until it was reliable and quite. In my case, this just happened to be 5000.

    So my question is this; is there a better way to do this? And what is the max PWM freq one should/could use?

    M950 F0 C"Fan0" Q5000; Creates PARTS COOLING FAN
                         ; BLOWER 50X15MM 24VDC - 5.0 CFM (0.140m³/min)
                         ; Digi-Key: B5015E24B-BSR
                         ; 1570-1034-ND
    M106 S25; Turn fan on, 10%   - once testing complete use:  M107; Turn off fan


  • administrators

    2-wire fans are not designed to work with PWM. It's amazing that many of them do (but some don't). Few fans will work reliably at 10%, especially without a blip. So I suggest you set your sights a little lower. In particular, it's normal to use a blip when starting the fan to a low speed.

    Duet 3 supports 4-wire fans that have a separate PWM input.

  • @dc42 said in Determining best fan PWM frequency:

    set your sights a little lower

    Thanks @dc42, my sights at 10% run from a dead-stop were achieved with this blower, I have no problems or issues with that. My inquiry is, what is the maximum PWM assignable frequency and, in regards to how I performed my findings, is there a better or simpler way to do it.


    Update: found that the maximum PWM frequency supported is 65535Hz.

  • administrators

    I advise against using high PWM frequencies, except when using 4-wire fans, for which the PM frequency should be 25kHz. For other fans, 500kHz is usually appropriate, except for a small number of fans that need 100Hz or even lower.

  • @dc42 said in Determining best fan PWM frequency:

    For other fans, 500kHz is usually appropriate, except for a small number of fans that need 100Hz or even lower.

    @dc42, thanks for the patience - but is 500kHz a typo and meant to be 500Hz? I read 65535Hz, in a previous postings, as maximum. Also, what would you consider 'high PWM frequencies'? And lastly, what would be the consequences of running them at higher freqs?


  • @dc42, I searched through the forum a bit more and discovered answers to most of my curiosities - apologies for wasting your time.

    This was interesting:
    Another option is to put a R-C filter in series with the fan so that the PWM gets smoothed out and you drive the fan with a variable voltage. Connect a resistor of between10 and about 200 ohms between the Duet fan output and the fan. Also connect a capacitor of at least 100uF in parallel with the motor.
    I find it very hard to believe that the same motor works with RAMBO. The RAMBO board has a flyback diode in parallel with the fan output, but apart from that it has nothing else that would make a difference.
    Standard Arduino PWM frequency is about 490Hz, but I don't know whether Marlin uses that or alters it.

    This is a good read:

    If all else fails and fan does not like PWM out you can place a low-pass filter to smooth the pwm output into an analog signal-'ish', but what PWM freq to use and how does fPWM equate to fc? I'm reading that the highest possible PWM freq yields the best performance of the filter but how does the correspond to fc / or does it at all?

    So what I gather from all this – a high pwm frequency shouldn’t be detrimental to the controller board or the fan, in most cases it will have an effect on noise and speed limitations on either end of the spectrum. If it works, it works.

Log in to reply