In this lesson, you will learn PWM, a technique to precisely control devices.

Pulse Width Modulation

Pulse Width Modulation, or PWM in short, is a square wave signal, commonly used to control LEDs, motors, or servos.

Typical characteristic of PWM includes:

  • Voltage
  • Duty cycle
  • Frequency

Voltage

Voltage of a PWM signal is the voltage when the signal is high, fixed at a certain voltage. The voltage depends on the device you control; 12 V for LED strips, 3.3 V or 5 V for sensors, etc. When the signal is at that voltage, it means high, “1” or “on”, and when the signal is 0 V, it means low, “0”, or “off”.

Duty cycle

Duty cycle is a duration; how long the signal is high. Bigger duty cycle means the signal is high for longer time. Duty cycle is expressed as percent; 50 % duty cycle means the signal is high 50 % of a cycle. 0 % duty cycle means the signal is always low, and 100 % duty cycle means the signal is always high.

You control a device by changing the duty cycle. For example, to decrease brightness of a LED, decrease the duty cycle, say 10 %. The LED turns on 10 % of a cycle, and turns off 90 % of a cycle. If you repeat this very quickly, the brightness of the LED is significantly low and you do not notice the LED is keep turning on and off because the speed of the change is too high for human eyes to see.

Frequency

Another characteristic of PWM is frequency; how many times a signal repeats the cycle in one second. The unit of frequency is Hz. 100 Hz means the signal repeats the cycle 100 times per second. The following chart has two different frequencies of the same duty cycle. The high frequency PWM repeats a cycle two times more than the low frequency PWM.

If you turn on and off an LED at a very low frequency, say, 50 Hz, you will see the LED is flickering. When the frequency is 1,000 Hz, or 1 kHz, you will not.

Other lessons

Other lessons in Electronics Basic Course:

  1. Simple Circuits Measurements Fundamentals
  2. Multimeter
  3. Ohm's Law
  4. LED and Vf
  5. Voltage Divider
  6. Current Divider
  7. Series and Parallel resistors
  8. Pulse Width Modulation This lesson
  9. Traffic signal