datasheets.com EBN.com EDN.com EETimes.com Embedded.com PlanetAnalog.com TechOnline.com   UBM Tech
UBM Tech

Pulse-width modulation

-February 16, 2012

Mechatronics logoAs engineers, you use many components and devices every day that you treat as black boxes. You are concerned only about the inputs and outputs of the black box, and that approach is acceptable provided that you know the operating range and limitations of the device. The same can be said about certain concepts and techniques. You routinely use them, and they work, but you may not totally understand why they work. As fundamental performance limitations and safety come into question, a deeper understanding becomes necessary. In addition, innovation demands understanding. The widely used PWM technique may fall into this category. Most engineers use it every day to drive a variety of devices, but only a few know why they use it and how it works.

A pulse signal is defined by its amplitude and pulse width. A periodic pulse train has a frequency, or pulse-repetition rate, and a duty cycle—the ratio of pulse width to repetition period, varying between 0 and 100%. PWM modulates the duty cycle and keeps the period fixed. Microcontrollers, which operate in the digital domain, can generate a PWM signal. Although an analog signal is continuous in both time and amplitude, a digital signal is discrete in time—that is, it is sampled at a certain rate—and quantized in amplitude using a finite number of bits. The output of a microcontroller is typically either digital or PWM. The PWM signal typically ranges from 0 to 5V; thus, you can use it to turn an electronic power switch, a transistor, on and off and to control the amount of power a load receives.

Talkback buttonWhy would anybody be interested in this type of signal? PWM avoids losses normally incurred when a power source is limited by resistive means. In PWM, the average delivered power is proportional to the modulation duty cycle. Thus, the switched circuits to control the voltage across or current through a load have low power loss because the switching devices are either off—and no current yields no power loss—or on, with low power loss due to low voltage drop. You can augment the PWM signal, with a sufficiently high modulation frequency, using a lowpass filter to smooth the pulse train and recover an average analog waveform. Some people refer to PWM as a poor man’s DAC.

What should the frequency of the PWM signal be? First, consider the case in which you are using the PWM signal as a DAC. Many microcontroller applications need analog output but do not require high-resolution DACs. In a typical PWM signal, the frequency is constant, but the pulse width, or duty cycle, is a variable, directly proportional to the amplitude of the original unmodulated signal. The bandwidth of the lowpass filter should equal the bandwidth of the unmodulated signal. Choose the PWM frequency to give an acceptable ripple magnitude in the analog signal. For example, if you use an RC lowpass filter, you derive the amplitude attenuation using the following equation:

Pulse-width modulation equation 1

To increase the attenuation, and thus reduce the ripple, you may need to use a higher-order filter or a higher PWM frequency.

Many devices inherently average an on/off signal to control their operation, based on the duty cycle. Examples include LEDs that humans and inductive loads view, such as motors and solenoids. For an inductive load, such as an LR circuit, you can derive the PWM voltage frequency so that the current waveform is within a certain percentage of the analog step response. A fundamental analysis of an LR circuit calculates the frequency according to the following equation:

Pulse-width modulation equation 2

where P is percentage.

A shroud of mystery often envelops devices and concepts, which can often lead to avoidance or misuse. Focusing on the fundamentals removes that mystery.


Kevin Craig headshotKevin C Craig, PhD, is the Robert C Greenheck chairman in engineering design and a professor of mechanical engineering at the College of Engineering at Marquette University. For more mechatronic news, visit mechatronicszone.com.

Loading comments...

Write a Comment

To comment please Log In

FEATURED RESOURCES