

Pulse Width Modulation (PWM) is a technique used to control the amount of power delivered to an electrical load by varying the width of the pulses in a pulse train. By adjusting the duty cycle (the percentage of time the signal is "on" versus "off"), PWM enables precise control over power delivery without significant energy loss.
PWM is widely used in applications such as:
PWM is not a physical component but rather a method implemented in microcontrollers, integrated circuits, or dedicated PWM controllers.








PWM signals are characterized by the following parameters:
The Arduino UNO has several pins capable of generating PWM signals using the analogWrite() function. These pins are marked with a ~ symbol on the board.
| Pin Number | PWM Capable | Description |
|---|---|---|
| 3 | Yes | General-purpose PWM output |
| 5 | Yes | General-purpose PWM output |
| 6 | Yes | General-purpose PWM output |
| 9 | Yes | General-purpose PWM output |
| 10 | Yes | General-purpose PWM output |
| 11 | Yes | General-purpose PWM output |
Below is an example of controlling the brightness of an LED using PWM on an Arduino UNO.
// Define the PWM pin connected to the LED
const int pwmPin = 9; // Pin 9 supports PWM output
void setup() {
pinMode(pwmPin, OUTPUT); // Set the pin as an output
}
void loop() {
// Gradually increase brightness
for (int dutyCycle = 0; dutyCycle <= 255; dutyCycle++) {
analogWrite(pwmPin, dutyCycle); // Set PWM duty cycle (0-255)
delay(10); // Wait 10ms for smooth transition
}
// Gradually decrease brightness
for (int dutyCycle = 255; dutyCycle >= 0; dutyCycle--) {
analogWrite(pwmPin, dutyCycle); // Set PWM duty cycle (0-255)
delay(10); // Wait 10ms for smooth transition
}
}
Flickering LEDs:
Motor Noise or Vibration:
Overheating Components:
No Output Signal:
Q: Can I use PWM to control an AC motor?
A: PWM is typically used for DC motors. For AC motors, you may need a specialized motor driver or inverter circuit.
Q: What is the maximum frequency I can use with PWM?
A: The maximum frequency depends on the microcontroller or PWM controller. For example, the Arduino UNO can generate PWM signals up to approximately 62.5 kHz.
Q: How do I smooth a PWM signal into a steady DC voltage?
A: Use a low-pass RC filter (resistor-capacitor network) to filter out the high-frequency components of the PWM signal.
By following this documentation, you can effectively implement PWM in your projects for precise power control and modulation.