At a minimum, a simple on-off switch can be used to control a motor. When the switch is on, the power supply voltage is applied to the motor causing it to spin. Turn the switch off and the motor abruptly loses power and coasts to a stop. Current flow within the motor rises to the maximum when the switch is on and suddenly drops to zero when the switch is turned off. When a motor controller circuit acts like this switch, it is said to be operating the motor in Fast Decay Mode because current to the motor quickly decays. This mode may also be called Coasting Mode since the motor is allowed to coast when power is removed.
In many cases, such as when our robot nears the edge of a cliff, we’d like more control over the motor than just allowing it to coast to a stop; we’d like to apply the brakes. Another control mode, Slow Decay Mode, can be used to quickly stop a spinning motor and provide more precision of the motor’s movement. Slow decay mode improves control and braking by taking advantage of a secondary characteristic of a brushed DC motor — its ability to act as a generator. Let’s try an experiment to understand how this works.
Choose one of your favorite DC motors and an LED from the parts bin. A Yellow-TT motor and a red or green LED will work nicely. Connect the LED to the motor terminals and give the shaft a quick spin then again in the opposite direction. What did you see? A spinning motor creates electricity in proportion to its speed and direction. This phenomenon is called EMF (electro-motive force) and can be measured in volts.
A DC motor creates electricity even when coasting to a stop. If the motor terminals of a coasting motor are connected to each other, the generated EMF will return the power to the motor causing it to try to spin in the opposite direction (back EMF). The result is a rapid slow down of the motor speed, akin to brakes. Very handy for stopping on a dime.
Motor controller breakouts such as the DRV8833 apply active braking when operating in slow decay mode. It’s called slow decay since the motor continues to operate using the current supplied by the motor itself; the motor current doesn’t suddenly disappear. Some controller chip vendors also call this Braking Mode.
The Yellow-TT motor's spin threshold decreases to 1200 RPM when operating in slow decay mode compared to 3000 RPM for fast decay mode. That means that the output shaft of the 1:48 gearbox turns the attached wheel at 25 RPM versus 63 RPM; forward speed drops to 8.5 cm/sec from 21.4 cm/sec.
Also note that the speed versus motor voltage curve for slow decay (blue line) is more linear than fast decay (green line). The linear relationship between speed and voltage simplifies calculating motor speed from the throttle value.
equivalent_voltage = power_supply * throttle
motor_speed = (2500 * equivalent_voltage) - 2000
gearbox_speed = motor_speed / 48
With a 5-volt power supply, the motor and gearbox output shaft speeds for a throttle setting of 0.5 are 4250 RPM and 88.5 RPM.
equivalent_voltage = 5 * 0.5
motor_speed = (2500 * 2.5) - 2000 = 4250
gearbox_speed = 4250 / 48 = 88.5
Selecting the proper current decay mode for your project will go a long way to fine-tuning required brushed DC motor performance. One other PWM parameter, frequency, is useful for increasing low-speed torque and lowering the throttle value needed to start the motor spinning.