electroSome

PWM : Pulse Width Modulation

Pulse Duration Modulation or Pulse Width Modulation is a powerful technique used to control analog circuits using digital outputs. Nowadays PWM has a wide variety of applications such as to create analog voltage level, waveform generation, motor speed control, power control and conversion, measurements and communication etc.

PWM uses a rectangular pulse wave as shown in the figure below whose pulse width is modulated, which results in the variation in the average voltage of the waveform.

Pulse Width Modulation

PWM Period

The PWM Period is the time duration in which the Pulse Width Modulation takes place. In the diagram shown below PWM Period is marked as T. PWM Period should be chosen to give best results for a particular application.

 Duty Cycle

Duty Cycle

The duty cycle is the ratio of the time Tc during which the output is high to the total time period T.

PWM Resolution

Resolution of a PWM is the number of different steps you can have from zero power to full power. That is a 10 bit resolution means that you can have 1024  steps from zero to full power. Consider the example in which PWM is used to control the speed of a DC Motor. Using a PWM of 10 bit resolution we can have 1024 different speed for DC Motor.

PWM to Generate an Analog Voltage Level

In Switched Mode Power Supplies (SMPS) PWM is used to generate voltage levels. By changing the duty cycle of the PWM we can adjust the average voltage of the waveform. The PWM resolution should be selected to be greater than or equal to the required resolution of the Power Supply. For example a 5V power supply that can be adjusted to 1mV should use a PWM of resolution equal to or greater than 5000.

5/5000 = 1mV

Generating Analog Voltage Level using PWM

The above figure shows a PIC Microcontroller generating PWM wave at a frequency of 5KHz and 50% Duty Cycle. Two sections of Low Pass Filter are provided to filter out the ripples. The Output voltage will be the average value of the waveform, i.e 2.5V.

The Filter Frequency, F = 1/2∏RC

PWM to Generate an Analog Waveform

Any Analog Waveform can be generated by simply outputting a sequence of PWM waves to create analog voltage levels corresponding to different points in the waveform. When we use more points we can represent faster wave forms with greater accuracy but it requires greater resolution PWM and heavier filtering.

Selecting Points on a Sine Wave

PWM Duty Cycle can be of two types :

 ON – OFF PWM Duty Cycle

 

ON OFF PWM Duty Cycle

For a PWM wave of 16µS time period and 50% duty cycle , the wave starts with 8 high pulses at the first part and ends with 8 low pulses as shown in the figure above. There for the PWM frequency for any duty cycle is F = 1/16µS = 62.5 KHz.

Distributed PWM Cycle

 

Distributed PWM Cycle

It also uses 8 high pulses and 8 low pulses but spreads over the entire time period as shown above. Thus the PWM frequency for 50% duty cycle is F = 1/2µS = 500 kHz. But it gradually approaches 62.5 KHz as the Duty cycle move towards 0% or 100%.

PWM is a large amplitude signal that swings from one voltage level to another. This large voltage swing needs lot of filtering to smooth out. If we use the PWM frequency close the frequency of the waveform that we generates, it will smooth out the generated waveform and reduces its amplitude. So in actual practice we should keep the PWM frequency much higher than the frequency of waveform that we generates.

Due to these reasons Distributed PWM Cycle is more preferred compared to ON – OFF PWM Cycle.