The StringCar racer robot was bouncing off the string when accelerating and braking. At lower speeds, the precariously balanced car’s pulley dramatically changed speed and disengaged from the string without warning. To avoid sudden starts and stops, the car's CircuitPython code gradually ramped the motor voltage up and down using PWM (Pulse-Width Modulation) signals, so why was the car so jumpy?
It became obvious that the car's brushed direct-current (DC) motor didn’t have enough torque to run reliably at speeds less than 200RPM without some sort of gearing arrangement. A geared motor for the StringCar was too heavy and difficult to balance, so another solution was needed. And if that wasn't enough, the speed control throttle setting wasn't linearly related to actual motor speed making it difficult to measure string length based solely on motor run time.
After some experimentation, the solution was to adjust two PWM signal parameters. No need to add a gearbox or change hardware; we'll just apply some simple changes to the CircuitPython code.
This guide will elaborate on the solution, examine some commonly available motors, and provide programming examples that will improve the performance of your robot’s brushed DC motors. First, we’ll look at the motors’ love/hate relationship with PWM and how to make them friends again.
A Special Acknowledgment: Thank you to Chris Parrott (@ZodiusInfuser) for insight and subsequent discussions leading to including current decay mode as an important factor to consider for brushed DC motor control.