# Introduction to Pulse Width Modulation (PWM)

## Motivating the use of Pulse Width Modulation (PWM)

The world of computers and digital electronics is the world of ones and zeros, of on and of off. The world in which we live is comprised of "analog" quantities that can take on any value. Consider, for example a Light Emitting Diode (LED) or some other electrical load (a motor, a heater...). It is easy to design a circuit that turns the load on and off; one is shown to the right with a voltage source, a load, and a switch. If the switch is open (which we could represent by a "0") no current flows, and the light is off. If the switch is closed (represented by "1"), current flows and the light is on. The circuit works, but what happens if we want to have the light at some intermediate brightness? We could build a control circuit (which could be as simple as a resistor) that reduces the current through the LED to reduce the brightness. The ability to control the intensity of the LED (or speed of a motor...) has obvious advantages over digital (on/off) control. However there are two disadvantages.

• First, an analog control circuit is typically much more complicated than simple on/off control (which can be done with a circuit as simple as a single transistor) especially when high power loads (a motor, or heater...) are involved.
• Second, it is inefficient — if the control circuit has current through it and voltage across it, it is dissipating power that manifests as wasted heat. If the voltage happens to be the same across the load and the control circuit, efficiency is only 50%(!) because the same power is dissipated (and wasted) in the control circuit and in the load. The digital control circuit (i.e., the switch) never dissipates power because when the switch is open the current is zero, and when the switch is closed the voltage across it is zero — the power is zero in both cases. Pulse Width Modulation is a way to get the advantages of both systems.

In a Pulse Width Modulated system the transistor is turned on and off rapidly (we will define "rapidly" in the next page). In the case of an LED we blink the light rapidly (in this case "rapidly" means much faster blinking than the human eye can perceive). If the light is on (switch is closed, current is flowing) 10% of the time and off (switch is open, no current flows) 90 % of the time, it will appear to be dim. If the light is on 90% of the time, and off 10% of the time, the light will be brighter. If it is on 50%, and off 50%, it will be at an intermediate brightness. The percent of time that the load is on is called the "duty cycle" and varies from 0% to 100% (or 0 to 1).

A brushed DC electric motor, on the other hand, has a response time that depends on the inductance (L) and resistance (R) of the wires that make up the electromagnetic coils in the motor. We build a circuit that places either a large voltage, or 0 voltage across the motor (somewhat different than the picture above), and switch rapidly compared to the L/R time constant of the motor. The result is that the current through the motor is practically constant.

Most microwaves have an ability to set the power from 1 to 10 (or some other range). If we set the power at 5, this corresponds to a 50% duty cycle, and food will take longer to cook than if we use full power (i.e., set it to 10). If you listen carefully you can often hear the transmitter in the microwave turning on and off with a period of about 10 seconds. This tells us that the "response time" (i.e., how long it takes the food to heat up) is likely much longer than 10 seconds, so that the on-off cycle is "rapid" compared to how long it takes the food to heat up.

## Moving on

• Simple PWM. The next page explains pwm in a little more depth and then goes through a simple PWM circuit with a resistor and capacitor. The analysis is approximate and the goal is to develop an intuition for how PWM works.
• All the math. This page does all of the math for a PWM system. You can skip this if you want, but it is included for those who want more detail. Also there are both time domain and frequency domain (Fourier) derivations, in case you find one more useful than the other.
• Practical points. This page shows the dynamics of a pwm as the duty cycle changes system, as well as a way to make a bidirectional controller (which is useful for motors).

References

Replace