Duty Cycle is the ratio of the full-power pulse's duration to the entire PWM interval period, usually expressed as a percentage. PWM Equivalent Voltage is the product of the power supply voltage times the Duty Cycle divided by 100.

The width of each PWM pulse is set by the program code to adjust the amount of energy for the controller board to send to the attached motor. A pulse with a long duration imparts more energy to the motor, increasing the speed of the motor. A short duration pulse reduces the available energy and the motor spins more slowly. The motor sees changes in pulse energy just like when batteries are added or removed. With a little math, the pulse energy can be expressed as an “equivalent voltage” similar to battery voltage.

When a controller is sending the full voltage of the power source to the motor, the motor sees a PWM signal with a duty cycle of 100%. For example, if the controller output is always at the power supply voltage level, the duty cycle is 100%; if at full voltage for 5 milliseconds (ms) during a 10ms interval period , the duty cycle calculates to 50%. A full voltage pulse for 2ms during the 10ms period has a duty cycle of 20%.

PWM equivalent voltage is equal to the power supply voltage times the duty cycle. If the power source is 5 volts, a duty cycle of 100% has an equivalent voltage of:

5v * (100% / 100) = 5 volts

A duty cycle of 20% produces the equivalent voltage:

5v * (20% / 100) = 1.0 volts

As the PWM duty cycle changes, the motor reacts to the equivalent voltage and spins the motor at a speed that is proportional to that value. A lower duty cycle slows the motor; a higher duty cycle increases motor speed.

In CircuitPython's motor control libraries, the motor’s PWM duty cycle ratio is usually called the motor’s throttle, expressed as a numeric value between 0 and 1.0 where a value of 0 stops the motor and 1.0 runs the motor at full speed. Forward motor direction is a positive throttle value (0 to +1.0). Reverse direction is a negative value (0 to -1.0).

While duty cycle controls the motor’s speed, the controller’s motor current decay mode and the PWM signal’s frequency can dramatically effect the efficiency of a brushed DC motor, particularly when the PWM duty cycle is less than 30%. Why does the decay mode and PWM frequency play such an important role? Next we’ll look at the how motor recirculation current decay mode can help control motor performance.

This guide was first published on Apr 11, 2021. It was last updated on Apr 11, 2021.

This page (Duty Cycle) was last updated on Nov 27, 2021.

Text editor powered by tinymce.