-
Notifications
You must be signed in to change notification settings - Fork 356
PWM Output
#PWM Output#
##Background## This discussion assumes you understand the principles of digital output. If not read about them here. A Pulse Width Modulation (PWM) signal is a kind of a digital output, which has a certain structure in its temporal behavior. Specifically, the signal has a fixed period. Every time a period starts, the signal moved from LOW to HIGH. Then it stays HIGH for a certain duration, called the pulse width, after which it becomes LOW again for the rest of the period. The pulse width may change over time, but the period stays the same. The figure below presents a typical waveform of a PWM signal.
The ratio between the pulse width and the period is called "duty cycle" and is normally presented in percent. In the example above, the first five periods has a duty cycle of 50% and the last five period have a duty cycle of 10%. Also, it is very common to talk about the frequency rather than the period. The frequency is simply the number of periods per second, so the translation between period and frequency is very simple. If the X-axis units in the example above are microseconds, we can see that the period is 100us, thus the frequency is 10KHz, or 10,000 cycles per second.
Roughly speaking, PWM signal has two distinct uses. The first one is to simulate or approximate an analog output. The way it works is that if we consider the average voltage of a PWM signal of 0V / 3.3V, it will be (duty cycle) * 3.3V. For example, if the duty cycle is 10%, the average output voltage will be 0.33V.