There is a proportional relationship between speed and duty cycle. For example, if a rated BDC motor rotates at 15000 RPM at 12V, when a signal with a 50% duty cycle is applied to the motor, the motor will (ideally) rotate at 7500 RPM. The frequency of the PWM signal is the focus of consideration. If the frequency is too low, the motor speed will be too low, the noise will be large, and the response to the duty cycle changes will be too slow.
If the frequency is too high, the efficiency of the system will be reduced due to the switching loss of the switching device. The rule of thumb is to modulate the frequency of the input signal in the range of 4 kHz to 20 kHz. This range is high enough, the noise of the motor can be attenuated, and the switching loss in the MOSFET (or BJT) can also be ignored at this time. Generally speaking, it is a good way to find a satisfactory PWM frequency by experiment for a given motor. How to use PIC microcontroller to generate PWM signal to control the speed of BDC motor? One method is to alternately flip the output pin level by writing special assembly or C code (1). Another method is to choose a PIC microcontroller with a hardware PWM module. The modules provided by Microchip with this function are CCP and ECCP modules. Many PIC microcontrollers have CCP and ECCP modules. Please refer to the product selection guide for devices with these functional modules.
