Brushed DC motors have an affinity for direct current, engineered to spin in proportion to the level and polarity of the applied DC voltage. For example, a miniature 6-volt DC motor runs at its full rated speed when supplied with power from four AA batteries (four times 1.5 volts equals 6 volts). The motor will run slower with three AA batteries (4.5 volts) or even slower with two AA batteries (3 volts). When the speed of a robot's DC motor needs to be controlled by software, swapping batteries in and out just won't do.
To control the motor with software like CircuitPython, a special signal called Pulse Width Modulation (PWM) is used. Microcontrollers such as the Feather M4 Express send software-controlled PWM signals to an external breakout board in order to regulate motor speed. To cause the motor to spin, the microcontroller furnishes the external motor controller board a pulsing signal which in turn sends a high-power pulse to the attached motor. The PWM signals control the motor’s direction, speed, and available torque.
A typical PWM signal used for a brushed DC motor consists of three primary characteristics, duty cycle, decay mode, and frequency. Let’s get to know each aspect of the PWM signal better.