I'm experimenting with control of the speed of a small brushless fan like the ones used in PCs or power supplies. A propeller pin drives the base of a small NPN transistor. The code is quite easy:
pwmFreq = 500
pwmFrame = 240 ' 24V in 0.1V units
pwmBase = freqPll / (pwmFreq * pwmFrame)
PUB SetFanVolt (v)
' set fan PWM in 0.1V units
However, I'm not so happy with the audible noise generated. The fan runs best with frequencies between 200 and 1000Hz but this causes some whistling. At higher frequencies the sound is softer but the speed vs. PWM duty response gets nonlinear and and the motor has startup problems at low speed.
I guess this is caused by the cheap commutation circuit in the brushless motor. Although I have a free-wheeling diode in my driver it doesn't work really well. So the current drops to zero (fast decay) in each off-phase of the transistor and the winding inductance limits the current rise in the next on-phase.
Does anybody know how fan speed control works in PCs? They run almost quiet. Running the fan from a linear regulator (lab power supply) works much better than PWM but a linear regulator dissipates heat. A switch mode regulator with filtered DC output costs money and both solutions require much more board space than a simple transistor.