# What is a Pulse Width Modulation (PWM) Signal and What is it Used For?

Updated May 2, 2018

## Reported In

### Hardware

• Multifunction I/O Device

## Issue Details

I have heard that I may be able to use Pulse Width Modulation for my application. What is a pulse width modulation (PWM) signal and what is it used for?

## Solution

A Pulse Width Modulation (PWM) Signal is a method for generating an analog signal using a digital source. A PWM signal consists of two main components that define its behavior: a duty cycle and a frequency. The duty cycle describes the amount of time the signal is in a high (on) state as a percentage of the total time of it takes to complete one cycle. The frequency determines how fast the PWM completes a cycle (i.e. 1000 Hz would be 1000 cycles per second), and therefore how fast it switches between high and low states. By cycling a digital signal off and on at a fast enough rate, and with a certain duty cycle, the output will appear to behave like a constant voltage analog signal when providing power to devices.

Example: To create a 3V signal given a digital source that can be either high (on) at 5V, or low (off) at 0V, you can use PWM with a duty cycle of 60% which outputs 5V 60% of the time. If the digital signal is cycled fast enough, then the voltage seen at the output appears to be the average voltage. If the digital low is 0V (which is usually the case) then the average voltage can be calculated by taking the digital high voltage multiplied by the duty cycle, or 5V x 0.6 = 3V. Selecting a duty cycle of 80% would yield 4V, 20% would yield 1V, and so on.

PWM signals are used for a wide variety of control applications. Their main use is for controlling DC motors but it can also be used to control valves, pumps, hydraulics, and other mechanical parts. The frequency that the PWM signal needs to be set at will be dependent on the application and the response time of the system that is being powered. Below are a few applications and some typical minimum PWM frequencies required:
• Heating elements or systems with slow response times: 10-100 Hz or higher
• DC electric motors: 5-10 kHz or higher
• Power supplies or audio amplifiers: 20-200 kHz or higher
Note: Certain systems may need faster frequencies than what is listed here depending on the type of response desired.

Below are some graphs demonstrating PWM signals with different duty cycles:

25% Duty Cycle

50% Duty Cycle

75% Duty Cycle