Pulse Width Modulation (PWM) is a useful method for controlling an analog device using a train of pulses with a digital device. Such analog devices can be, but are not limited to, a motor or a lamp, whose rotational speed and luminous intensity can be varied, respectively. Such digital devices can be, but are not limited to, a PWM-enabled pin of a MCU. The PWM signal itself is made from a modified square wave, i.e., a portion of the signal is dedicated to a LOW period (tL) of 0V, whilst the remaining portion is dedicated to a HIGH period (tH) of 3.3V, totalling to a PWM period of (tPWM), as shown in Figure 1.

Figure 1: PWM Breakdown

The Duty Cycle is the percentage of time the signal resides in the HIGH level with respect to tPWM, as shown in Equation 1.

\begin{equation}
\tag{1}
 Duty = \frac{t_{H}}{t_{PWM}} \cdot 100~\%
\end{equation}

For example, if the Duty Cycle is 75%, the voltage output is 75% of 3.3V, i.e., approximately 2.48V. If the Duty Cycle is 50%, the voltage output is 50% of 3.3V, i.e., 1.65V. The LOW and HIGH periods keep repeating in a continuous pulse-train, i.e., the PWM frequency. Figure 2 represents an example schematic of an MCU controlling a load (RL) using PWM and a MOSFET Enhancement N-Channel transistor. As long as the maximum voltage of the PWM signal is greater than the Gate threshold voltage (VGS) of the MOSFET, the MCU is able to control the flow of current through RL.

Figure 2: PWM Schematic