Slow decay mode is usually selected for controlling brushed DC motors because of its ability to dynamically apply braking. It also helps to linearize the relationship between duty cycle and motor speed. Let’s compare the two modes.
If low-speed operation is required, slow decay mode increases available torque and significantly improves the overall speed range of the motor. Choosing slow decay also provides a linear mapping of the software throttle setting to motor speed which is helpful when measuring velocity and distance traveled.
Slow decay mode appears to be superior in most categories, but isn't the best choice if power consumption is your primary concern. For some battery-powered robots, the power saved using fast decay mode outweighs the more precise control offered by slow current decay.
Fast decay mode is the default mode in CircuitPython motor control libraries. Changing the operational mode parameter to slow decay can be accomplished with a simple, one-line statement. See the Code Examples section for the details.
After changing the mode, test the operation to confirm that the lowest required motor speed is working as needed. If a lower spin threshold is required, try reducing the PWM frequency to the lowest possible value (usually about 25Hz) and work up towards the maximum of the motor controller. Choose the frequency that provides the best balance of torque throughout the desired speed range while balancing the motor chatter that can happen at lower frequencies.
As a rule of thumb, most small brushed DC motors will operate nicely with a PWM frequency of 50Hz to 100Hz and slow decay mode. Projects like the StringCar Racer that don't use gearbox motors seem to work best at 25Hz.
In combination with its CircuitPython library, a motor controller board will offer a range of selectable PWM frequencies as well as decay mode. The table above shows the available frequency range and mode support for a variety of Adafruit motor controllers. Refer to the Code Examples section for how to select a specific decay mode and PWM frequency for your motor controller board.
Text editor powered by tinymce.