PWM (Pulse Width Modulation)


To learn about the use of PWM signals, their related parameters, and how to set up an ADC driver for the LPC17xx.

    What is a PWM signal?

    A Pulse Width Modulation (PWM) signal is simply a digital signal that is on (high) for part of its period and off (low) for the remainder of its period. If such signal is on half the time and off the other half, then it's a square wave. 


    Figure 1. PWM Signal (credit:

    PWM Parameters

    Duty Cycle

    A duty cycle of a certain PWM signal is given as a percentage, and it represents the ratio of the signal "on" time to the signal's full period. In other words, if the duty cycle of a signal is said to be 75%, it means that this signal is high for 75% of its period and low for the remaining 25%. 100% duty cycle implies a constantly high signal, and a 0% duty cycle implies a constantly grounded signal.


     The frequency of a PWM signal (just like any electrical signal) refers to the rate at which the signal repeats per second. A 1 Hz signal repeats every 1 second while a 1 KHz signal repeats every 1 millisecond.


    Figure 2. Parameters of a PWM signal

    PWM Signal Applications

    Generally speaking, a PWM signal is a way for a digital system to interface with an analog device. 

    DC Motors

    DC Motors are controllable via a PWM signal. The duty cycle of the signal is typically linearly proportional to the velocity of the motor. For example, a 60 RPM motor driven by a 50% duty cycle PWM signal will rotate at a 30 RPM velocity. It's worth noting that such signal needs to run at a high enough frequency (10 KHz for example) so the motor can rotate smoothly. A low-frequency PWM signal (say 10 Hz) will result in an observable choppy motor motion. 


    The brightness of an LED can be controlled via a reasonably high-frequency PWM signal. A 5V 50% PWM signal applied to an LED will have the same brightness effect as a constant 2.5V signal applied to the same LED. 


     Servos are typically controlled by a 50 Hz PWM signal, where the duty cycle of the signal determines the angle of the servo. Typically, the duty cycle ranges from 5% to 10%, causing the servo to rotate to its smallest and largest angles, respectively. 

    PWM Driver for LPC17xx