I'm using the kind of small brushed DC motor shown below. My MCU controls the motor using PWM via a DRV8833 motor driver, also shown below.
If I set the PWM frequency very low, e.g. 10 Hz, the motor clearly judders on and off. So for a smooth motion, it would seem obvious to set the frequency as high as possible.
However, above 100 Hz something odd starts to happen: the speed of rotation actually starts to drop off. I'm confused - I can vary the duty and frequency values independently and it was my understanding the duty value affects the speed while the frequency should just affect the "smoothness" (i.e. the judder) that I see at low frequencies.
What's going on here? I tried Googling and the only thing I found was a DesignSpark article where they say:
One explanation may be that the very narrow pulses of a high-frequency signal are just not long enough to ‘kick’ the rotor into action.
This doesn't sound terribly convincing. Is this really the explanation for the behavior that I'm seeing?
When experimenting to find the optimum frequency, I kept the duty value at about 25%. I'm using a 3.3V ESP32 connected via two PWM pins to the A_IN1 and A_IN2 pins of the DRV8833 chip (i.e. pins 15 and 16). I'm using a library where the PWM duty value is a 10-bit value that can vary between 0 and 1023 - I keep it fixed at 255 for A_IN1 and 0 for A_IN2.
At 10 Hz and a duty cycle of 25%, I believe that the judder that I see is the result of the frequency being low enough that the starting and stopping of the motor is visible to the human eye (with the low duty cycle meaning that the motor does not have enough momentum to carry it through the off phases).