A PWM chip is a dedicated integrated circuit that generates precise pulse-width modulated square waves to control power delivery to loads like LEDs or motors, independently of the main microcontroller's processing cycle. Adding a dedicated PWM IC to your circuit fundamentally changes your power and timing architecture: it frees up your microcontroller's internal hardware timers, eliminates interrupt jitter on time-critical signals, and allows you to drive high-current loads directly without routing that current through your MCU's fragile GPIO pins. Makers commonly confuse dedicated PWM chips with software PWM (bit-banging a pin in code) or the microcontroller's built-in hardware PWM peripherals, but an external IC operates entirely autonomously once configured via I2C or SPI.
Why Offload PWM from Your Microcontroller?
Microcontrollers like the Arduino Uno (ATmega328P) or the ESP32 have built-in hardware timers that generate PWM signals. However, these resources are strictly limited and heavily contested. The ATmega328P only has three hardware timers, which are shared across six pins. If you use the standard Servo.h library, it hijacks Timer1. If you then try to use analogWrite() on pins 9 or 10, those pins will fail or behave erratically because the timer they rely on has been reconfigured for servo pulses.
The ESP32 is more capable, featuring the LEDC (LED Control) peripheral with 16 channels. However, these 16 channels share only 4 internal timers. If you assign two different PWM frequencies to channels sharing the same timer, the hardware forces them to match, silently breaking your motor control or LED dimming. Furthermore, every time your MCU handles a high-priority interrupt (like reading a rotary encoder or servicing a WiFi stack), software-based PWM or poorly configured hardware PWM can experience microsecond-level jitter. For a 50Hz hobby servo, a 20µs jitter translates to physical twitching in your robotic arm. A dedicated PWM chip isolates the pulse generation from the MCU's interrupt latency entirely.
Worked Example: Sizing a PCA9685 for a 16-Servo Robotic Arm
Let's look at the math for driving 16 standard SG90 micro servos using an NXP PCA9685 I2C PWM chip. The PCA9685 offers 12-bit resolution, meaning it divides the PWM period into 4,096 discrete steps.
Standard hobby servos expect a 50Hz signal, which means a 20ms (20,000µs) period. The control pulse width varies from 1ms (1,000µs) to 2ms (2,000µs). Let's calculate the physical resolution:
- Step Size: 20,000µs / 4,096 steps = 4.88 µs per step.
- Usable Range: The 1ms to 2ms pulse width gives you 1,000µs of travel.
- Positional Steps: 1,000µs / 4.88µs = ~204 discrete positional steps.
204 steps across a 180-degree arc gives you roughly 0.88 degrees of resolution per step, which is exceptionally smooth for hobby robotics.
Now, let's calculate the power requirements, which is where most builders fail. An SG90 servo draws about 10mA at idle, but its stall current (when the motor is blocked or starting under load) is roughly 650mA. If all 16 servos stall simultaneously during a power-up sequence or a complex movement:
16 servos × 0.65A = 10.4 Amps peak draw.
Where You Meet PWM Chips in Practice
You will encounter dedicated PWM chips in several specific embedded applications where MCU pins fall short:
- High-Channel LED Matrices: When building architectural RGB lighting or large LED cubes, you need dozens of channels. The Texas Instruments TLC5940 provides 16 channels of constant-current PWM via SPI, allowing you to daisy-chain multiple chips to drive hundreds of LEDs without needing individual current-limiting resistors.
- Hexapod and Bipedal Robotics: Walking robots require 18 to 32 servos. Using multiple PCA9685 boards on a single I2C bus ensures all joint movements update simultaneously without blocking the main MCU's inverse kinematics calculations.
- Digital Power Supplies: In custom bench power supplies or MPPT solar charge controllers, chips like the TL494 are used to generate high-frequency (100kHz+) PWM to drive MOSFET gates in buck/boost converters, a frequency far beyond standard MCU servo timers.
Decision Tree: Which PWM Chip Should You Put on the PCB?
Choosing the right IC depends on your load type, required frequency, and interface. Use this decision matrix to select your component:
| Application Scenario | Required Feature | Recommended PWM Chip | Interface |
|---|---|---|---|
| Driving 2 to 16 hobby servos or standard 5V LEDs | Independent frequency per board, simple I2C wiring, 12-bit resolution | PCA9685 | I2C |
| Driving high-power RGB LED strips or multiplexed LED matrices | Constant-current sink (no resistors needed), high grayscale resolution | TLC5940 | SPI |
| High-frequency DC motor control or custom SMPS design | Adjustable frequency up to 300kHz, dual outputs, dead-time control | TL494 | Analog/Pins |
| Addressable LED strips (WS2812B / SK6812) | Strict 800kHz timing with embedded data protocol | Not a standard PWM chip (Use MCU RMT or dedicated LED driver) | 1-Wire |
Common Confusions: Hardware PWM vs. Software Bit-Banging vs. PWM ICs
To debug timing issues, you must understand the hierarchy of PWM generation:
- Software PWM (Bit-Banging): The MCU uses code loops or timer interrupts to manually toggle a GPIO pin high and low. Drawback: Highly susceptible to interrupt jitter. If a WiFi packet arrives on the ESP32, the software PWM pauses, causing LEDs to flicker or servos to twitch.
- MCU Hardware PWM: The MCU's internal peripheral (like the ESP32 LEDC or ATmega Timer) toggles the pin automatically in the silicon background. Drawback: Limited channel count, shared timer constraints, and limited current sourcing (usually max 40mA per pin).
- Dedicated PWM Chips: An external IC with its own internal oscillator and registers. The MCU only sends an I2C/SPI command to set the duty cycle, then the MCU can go to sleep or do heavy math while the chip maintains the square wave flawlessly.
FAQ: Debugging I2C and SPI PWM Expanders
Q: My ESP32 isn't detecting the PCA9685 on the I2C bus. The scanner returns nothing.
A: This is almost always a logic-level or pull-up resistor issue. The PCA9685 is typically powered at 5V on the breakout board's VDD pin. Standard I2C requires the SDA/SCL high voltage to be at least 0.7 × VDD (which is 3.5V). The ESP32 only outputs 3.3V. While many modern PCA9685 breakouts include onboard pull-ups to 3.3V and tolerate this mismatch, if yours doesn't, you need a bidirectional I2C logic level shifter (like the BSS138-based modules) between the ESP32 and the PWM chip.
Q: Can I daisy-chain multiple TLC5940 chips for a 64-channel LED wall?
A: Yes. The TLC5940 uses SPI. You wire the SCLK (clock) and SIN (serial data in) in parallel to all chips, but you chain the SOUT (serial data out) of the first chip to the SIN of the second chip, and so on. You will need to shift out 192 bits (12 bits × 16 channels) per chip in the chain before pulsing the XLAT (latch) pin to update the outputs simultaneously.
Q: Do I need to add a capacitor to the PWM chip's power rail?
A: Absolutely. When driving inductive loads like servos or long LED strips, the rapid switching of the PWM signals creates voltage spikes and ground bounce. Place a 100µF electrolytic capacitor and a 0.1µF ceramic decoupling capacitor directly across the V+ and GND terminals of the PWM breakout board to absorb transient current spikes and prevent the chip from resetting mid-operation.






