Pulse Width Modulators

Pulse Width Modulators, also called PWMs, are relatively new in the world of electronics. Before PWMs, usually a variable resistance (a rheostat) was used to control the voltage applied to a motor, bulb, etc. But this was inefficient because energy was wasted.

Pulses generated by a PWM

Pulses generated by a PWM

A PWM solves this problem. With it, you can apply analog voltages using only digital means. Have a look at the signal on the right.

This is the kind of output generated by a PWM. There are two key properties associatedwith a PWM:

  1. Period: The amount of time between two consecutive highs. This is usually measured in Hz (as a frequency). Example: A 500 Hz PWM.
  2. Duty cycle: The amount of time a high remains a high. This is usually measured as a percentage. Example: The duty cycle is 50% the entire time period.

The PWM has several uses today. I'll go over two briefly.

Power control with PWMs

A pulse width modulator can be used to control the amount of power that is supplied. And it's as simple as changing the duty cycle.

Say a motor is connected to a PWM. The PWM can be made to generate the following two signal. When will the motor run faster?

Comparing the duty cycle of two PWMs

Comparing the duty cucle of two PWMs

Of course, the signal below. It has a greater duty cycle. More power is delivered to the motor. So it will rotate faster. When a PWM's signal is applied to an analog component, it behaves as if an equivalent constant voltage is applied on it. That is, analog components cannot distinguish voltage from a rheostat and a PWM.

Communication with PWMs

No, I'm not talking about talking. I'm talking about sending certain bytes of data from one chip to another. You know how important this is, right? You want faster RAMs, faster processors, lesser "lag" when you click a button. This is where you're trying to increase the speed of communication.

Give me your data... FAST

Give me your data... FAST

I won't go into extreme details, but here's the idea. You want to send things as "bits". And you also want the other chip to know when you go on to the next bit.

To do this, you need two PWMs. One to indicate when you're going to send the next bit, and one to indicate the actual bits:

Communication with two signals

Communication with two signals

The clock maintains the timing. On every rising edge, the next bit is sent out. This way, two chips can talk to each other over 3 wires (one clock, one from chip A to B, and one from chip B to A).

How to create a PWM

There are two major ways.

Use a microcontroller

Microcontrollers come with physical PWMs. They have actual silicon dedicated to PWMs. So they're quite efficient and easy to use.

Create a circuit You can create your own circuit. Some chips like the 555 timer IC can help you make these pulses easily!


Pulse Width Modulators (PWMs) are extremely useful things. They can control power, help in communication, etc. To create one, you either need a microcontroller or a custom built circuit.

Related posts

Utkarsh Sinha created AI Shack in 2010 and has since been working on computer vision and related fields. He is currently at Microsoft working on computer vision.