RGB LED Mixer
Calculate RGB LED color mixing for target color. Convert between RGB values and PWM duty cycles.
Key Formulas
Luminance = 0.299R + 0.587G + 0.114B
PWM% = Value / 255 × 100
Frequently Asked Questions
What does the RGB LED Mixer calculate?
The tool calculates the required PWM duty cycles (0–100%) for each red, green, and blue channel to achieve a target RGB color on common-anode or common-cathode LED configurations. It also computes current-limiting resistor values based on your supply voltage and LED forward voltages (assumed typical: 2.0V R, 3.2V G, 3.2V B), ensuring safe and accurate color mixing.
How do I use this tool for a common-cathode RGB LED?
For common-cathode LEDs, invert the calculated PWM duty cycles (i.e., use
100% – duty_cycle) since high signal turns the LED on. The tool assumes common-anode by default; no input change is needed—just reinterpret the output PWM values accordingly. Resistor calculations remain valid as they depend only on voltage drop and desired current.What are typical forward voltages used in the resistor calculation?
The calculator uses standard nominal forward voltages: 2.0 V for red, 3.2 V for green, and 3.2 V for blue LEDs. These values reflect typical high-brightness InGaN (G/B) and AlInGaP (R) diodes. For precision applications, replace these with datasheet values and adjust manually if higher accuracy is required.
Why does the tool ask for “Common Anode V (V)” instead of individual LED voltages?
This input sets the supply rail voltage (e.g., 5 V, 12 V) used to compute voltage drops across current-limiting resistors. Since forward voltages are fixed internally, only the system VCC is needed to determine resistor values per channel. It simplifies entry while maintaining practical design relevance for most constant-voltage driver setups.
Can I use this tool for addressable LEDs like WS2812B?
No—this tool is designed for discrete, analog-controlled RGB LEDs driven via PWM and resistors. Addressable LEDs (e.g., WS2812B) use digital protocols and internal constant-current drivers; their color control maps directly to 0–255 RGB values without external resistor or PWM duty-cycle conversion.
What PWM frequency should I use for smooth color mixing?
Use ≥400 Hz to avoid visible flicker; 1–2 kHz is ideal for most applications. Higher frequencies reduce audible noise from ceramic capacitors or inductors but may increase switching losses. Ensure your MCU timer or driver IC supports the chosen frequency and maintains sufficient resolution (e.g., 8-bit = 256 steps) for perceptible color gradation.
My mixed color looks dimmer than expected — what should I check?
Verify that your current-limiting resistors are sized for the *lowest* forward voltage channel (typically red), as it draws the most current at the same duty cycle. Also confirm LED brightness binning consistency—mismatched luminous intensities between R/G/B chips require gamma correction or calibrated PWM scaling, which this tool does not apply.
How do RGB values (0–255) relate to PWM duty cycle?
The tool maps linear 0–255 RGB inputs directly to 0–100% PWM duty cycles—e.g., R=128 → 50% duty cycle. Note that human vision perceives brightness logarithmically, so for photometric accuracy, apply gamma correction (typically γ ≈ 2.2) before converting RGB to PWM in production firmware.
What’s the recommended forward current for standard 5mm RGB LEDs?
20 mA per channel is standard for continuous operation in through-hole or basic surface-mount RGB LEDs. The calculator assumes this default current; if using high-power or SMD variants (e.g., 2020, 3535), consult the datasheet and adjust resistor calculations manually to match rated IF and thermal limits.
Does this tool account for LED efficiency differences between colors?
No—it performs linear RGB-to-PWM conversion without chromaticity or luminosity compensation. Red LEDs typically emit more lumens per mA than blue, so equal PWM values often yield oversaturated reds. For balanced white or pastel tones, use measured luminance ratios or pre-weighted RGB inputs before entering values.