The definition of pulse width is the exact duration of time a digital signal remains in its active (HIGH or ON) state during a single complete cycle of a periodic waveform. In practical electronics, adjusting this ON-time duration—while keeping the total cycle time constant—is the fundamental mechanism behind Pulse Width Modulation (PWM). By changing the pulse width, you directly change the average DC voltage and power delivered to a load, allowing you to control motor speed, LED brightness, or power supply output without wasting energy as heat.

Core Principle: Pulse width dictates the time the switch is closed; Duty Cycle is the ratio of that time to the total cycle; Average Voltage is the result seen by the load.

The Math Behind the Signal: Duty Cycle and Average Voltage

To use pulse width effectively, you must understand its relationship to the signal's period (the total time of one complete ON+OFF cycle) and the resulting duty cycle. Think of it like a water valve that you snap fully open and fully shut: the wider you leave it open during a fixed time window, the more water flows through on average.

The formulas governing this are straightforward:

  • Period (T): 1 / Frequency (f)
  • Duty Cycle (D): (Pulse Width / Period) × 100%
  • Average Voltage (V_avg): Peak Voltage (V_peak) × (Duty Cycle / 100)

Worked Numeric Example: Driving a 12V DC Fan

Suppose you are using an ESP32-WROOM-32 microcontroller to drive a 12V PC cooling fan via an IRLZ44N logic-level MOSFET. You want the fan to run at exactly 60% of its maximum speed.

The Setup:
• V_peak (Supply) = 12V
• Target V_avg = 7.2V (60% of 12V)
• Chosen PWM Frequency = 25 kHz (chosen specifically to push the switching noise above the human hearing range of 20 kHz, eliminating audible whine).

Step 1: Calculate the Period.
T = 1 / 25,000 Hz = 0.00004 seconds, or 40 µs.

Step 2: Determine the Required Pulse Width.
Since we need a 60% duty cycle, the pulse width must be 60% of the total period.
Pulse Width = 40 µs × 0.60 = 24 µs.

In your microcontroller code, you will configure the hardware timer to output a HIGH signal for 24 microseconds, followed by a LOW signal for 16 microseconds, repeating 25,000 times per second. The fan's internal inductance and mechanical inertia smooth these rapid pulses into a steady 7.2V equivalent, spinning the motor at 60% speed.

Where You Meet Pulse Width in Practice

Pulse width is not just a theoretical oscilloscope measurement; it is the primary control variable in several critical embedded and power systems.

  • RC Servo Positioning: Unlike motors where the ratio (duty cycle) matters, standard hobby servos (like the SG90 or MG996R) care about the absolute pulse width. A 50 Hz signal (20 ms period) is used, but the servo's internal potentiometer reads the exact HIGH time: 1.0 ms width = 0°, 1.5 ms width = 90° (center), and 2.0 ms width = 180°. The remaining 18-19 ms of LOW time is ignored by the servo's control board.
  • Switch-Mode Power Supplies (SMPS): In a buck converter, the pulse width of the high-side MOSFET directly determines the output voltage. If the input is 24V and the controller measures the output dropping below 5V, it increases the pulse width (and thus the duty cycle) to transfer more energy to the output inductor per cycle.
  • LED Dimming: The human eye integrates light over roughly 10-20 milliseconds. By pulsing an LED at 1 kHz (1 ms period) and varying the pulse width from 10 µs to 900 µs, you achieve smooth, flicker-free dimming while maintaining the LED's optimal forward voltage and color temperature, which would shift if you used analog voltage reduction.

Common Confusions: Pulse Width vs. Period vs. Amplitude

When debugging circuits with an oscilloscope, beginners frequently mix up three distinct waveform properties. Understanding the difference prevents catastrophic misconfigurations.

Parameter Definition What It Changes in the Circuit Common Mistake
Pulse Width Time the signal is HIGH (ON). Average power/voltage delivered to the load. Assuming a wider pulse means a higher peak voltage.
Period Total time of one ON + OFF cycle. Switching frequency (affects audible noise and EMI). Measuring from rising edge to falling edge instead of rising to rising.
Amplitude The peak voltage level of the HIGH state. Maximum instantaneous electrical stress on components. Confusing a 3.3V logic signal with a 5V logic signal, frying a 3.3V peripheral.
Bench Tip: If your MOSFET is overheating despite a low duty cycle, check your amplitude and gate drive. A 5V microcontroller pin might not provide enough amplitude to fully enhance a standard MOSFET (which might need 10V+ on the gate). The MOSFET operates in its high-resistance linear region, burning off the pulse width energy as heat. Always use logic-level MOSFETs (like the IRLZ44N) or a dedicated gate driver IC (like the TC4420) for 3.3V/5V logic.

Decision Tree: Choosing Your PWM Parameters

Selecting the right frequency and pulse width resolution depends entirely on your load. Use this decision path to lock in your hardware and software configuration.

If Your Load Is... Then Choose Frequency... And Pulse Width Strategy... Hardware / API Pick
Standard RC Servo 50 Hz (20 ms period) Absolute width: 1.0 to 2.0 ms Any MCU hardware timer
Brushed DC Motor 20 kHz to 25 kHz Relative ratio (10% to 90% duty) MOSFET + Gate Driver
High-Power LED 1 kHz to 5 kHz Relative ratio, high resolution needed Constant Current Driver (e.g., TLC5940)
General MCU Output 5 kHz (Default safe middle-ground) 10-bit resolution (1024 steps) ESP32-S3 LEDC Peripheral

The Concrete Default Pick: If you are building a general-purpose microcontroller project in 2026 and need to output PWM for an unspecified DC load, default to the ESP32-S3 utilizing its dedicated LEDC (LED Control) peripheral. Configure it via the ESP-IDF or Arduino core for 5 kHz frequency with a 10-bit resolution (0-1023 steps). This avoids audible whine, provides smooth 0.1% duty cycle adjustments, and completely offloads the timing from the CPU, preventing jitter caused by WiFi/Bluetooth interrupts.

Frequently Asked Questions

What happens if my pulse width is shorter than my MOSFET's switching time?

Every MOSFET has a gate charge (Qg) that takes time to fill. If you are switching at 100 kHz (10 µs period) and request a 1% duty cycle, your pulse width is only 100 nanoseconds. If your MOSFET takes 150 ns to turn on, it will never reach the fully enhanced state before the signal goes LOW. The MOSFET will remain in the high-resistance linear region, generating massive heat and potentially destroying the silicon. Always check the Turn-On Delay Time and Rise Time in the datasheet and ensure your minimum pulse width is at least 3x to 5x the total switching time.

Can I just use the analogWrite() function on an Arduino Uno for precision motor control?

You can, but it is not ideal for precision. The standard Arduino Uno analogWrite() function defaults to roughly 490 Hz on most pins (and 980 Hz on pins 5 and 6). At 490 Hz, a DC motor will emit a high-pitched, annoying whine. Furthermore, it only offers 8-bit resolution (0-255 steps). For motor control, you should reconfigure the AVR hardware timers (Timer1 or Timer2) to output at 20 kHz+ and use a 10-bit or 16-bit resolution mode.

Why does my LED flicker on camera when using PWM?

Camera sensors use rolling shutters that capture frames at specific intervals (often 30 fps or 60 fps, corresponding to 1/30s or 1/60s exposure times). If your PWM frequency is too low (e.g., 100 Hz), the camera will capture the distinct ON and OFF states of the pulse width, resulting in visible banding or flickering. To eliminate this for video lighting, push your PWM frequency above 2 kHz, or ideally into the 20 kHz range, which is far faster than any consumer camera shutter can resolve.

For deeper technical reading on microcontroller timer configurations and motor drive topologies, refer to the All About Circuits guide on PWM and the official Espressif ESP-IDF LEDC API documentation. For practical advice on mitigating EMI and brush arcing in DC motors, review the Adafruit learning system notes on PWM frequency selection.