Brushed DC Motor is the most widely used motor due to its simplicity. Its application ranges from toy, small electrical appliances to industrial automation machine and robotics. In most of the applications, we do not want to run the motor at fixed speed and variable speed control is essential. Controlling the motor speed is pretty straight forward as the speed of brushed DC motor is proportional to the applied voltage. What we need to do is just varying the voltage of the power supply.
But wait, it sounds simpler than what it really is. What if I want to power the motor from a fixed voltage source such as a battery?
Maybe we can try to turn on and off the motor periodically by pressing a switch like this?
No, the movement of the motor is too jerky. Let’s try to press the switch faster.
Yes, we’re pretty close, but not there yet.
How about we press the switch 20, 000 times a second? I’m sorry, I can’t show you the video as my finger is not fast enough.
However, we can replace the mechanical switch with electronic switch such as BJT or MOSFET. This electronic switch can be switched at hundred to thousands times per second by a microcontroller (e.g. Arduino, Raspberry Pi, etc).
To control the motor speed, we just need to vary the ratio of on and off time (duty cycle). This method is called Pulse Width Modulation (PWM).
When the motor is switched at high frequency, it behaves like it’s being fed from a pure DC voltage due to mechanical inertial and the coil inductance. Motor inertial prevents the speed of the motor to change rapidly while the property of inductor will not allow the current to change instantaneously.
So, what is the optimum frequency for the PWM signal? There is no hard rules for that. I would recommend to use somewhere between 16kHz to 20kHz as it’s beyond human audible range so that the switching noise can’t be heard. And still, it’s low enough for the MOSFET to handle.
Just a side note, Arduino’s default PWM output frequency is around 490Hz. It’s less than perfect, but still usable.