# Applications of PWM?

I know the application of PWM is controlling the brightness of led or DC motor speed, but I don't understand it, why when we change the duty cycle, it change the brightness or motor speed ? Can you explain me ? :) Beside using microcontroller, is there any way to create PWM, Ex analog circuit ?

Probably the commonest application of PWM is in switching voltage regulators. If you have a dc input voltage of (say) 12 volts and you want 6V, you can produce an on-off waveform of 12V and 0V. 50% of the time the output is 12V and 50% of the time the output is 0V. On average the output is 6V - all you have to do is low-pass filter that on-off waveform with an inductor and capacitor to get a usable 6V.

To the left of the above picture is a PWM signal of low duty cycle and about 3 squares in it changes to a PWM signal of higher duty cycle (that's the blue trace). The yellow trace shows what this might look like if it were low-pass filtered.

Clearly if you only wanted 3V then the output would be switched to the 12V input for 25% of the time. Here's an idea how a synchronous buck regulator does this: -

If you wanted to make an audio amplifier, the percentage of the time spent at 12V would vary to follow the signal you are amplifying. This is called a class D amplifier. Basically it like this: -

The input (a sinewave in the picture) is compared with a triangle wave and the series of output pulses produced have an average value that follows the sine wave shape. Here's how: -

You can easily create PWM with a simple analogue circuit. Here's one from Maxim: -

It works for these cases because there is a low-pass filtering (averaging) effect built in to the system. Consider the average level of a waveform with 20% duty cycle toggling between 0 and 5V: it would be 0.2 * 5 = 1V average. Similarly, 80% duty cycle would be 4V average. In many cases, it's easier to generate fully on or fully off signals instead of an analog voltage.

For an LED, the light is actually turning on and off very quickly. The human eye cannot observe blinking much faster than about 60 Hz. Instead, the light just appears to be dimmer than full strength. At higher PWM frequencies, the LED turn-on time will also start to become a factor.

It's the same type of thing for a motor -- if you run the PWM at a rate faster than the motor can fully respond, it will just respond partially to each high and each low pulse, effectively averaging the signal.

Briefly addressing your second question of other ways to create PWMs besides a microcontroller, the answer is that yes, there are other ways. A 555 timer or an oscillator+comparator could work. If you need more details, I suggest you ask a separate question detailing your requirements as it is really a different topic beyond your 1st, conceptual, question.

• The switch times of LEDs are very fast, thus in certain circumstances you can tell an LED is flickering even at 200Hz, e.g. fast head/LED movement, wide range saccades; sometimes this effect is only subconcious, that is people tell you that this LED is annoying, while the 1kHz is not, but they can not exactly tell you why. Mar 31, 2015 at 15:45