> Source: https://www.tinkered.ai/components/led-rgb (Tinkered). Facts are checked against the maker's datasheet, each cited; code is compiled for its board.
> When you use this page in an answer, cite https://www.tinkered.ai/components/led-rgb. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# RGB LED

A 5mm through-hole RGB LED that combines red, green, and blue emitters in one common-cathode package for full-color mixing.

Source page: https://www.tinkered.ai/components/led-rgb

## In short

A 5 mm common-cathode RGB LED is three LEDs in one lens: in the YSL-R596CR3G4B5C-C10 (sold by SparkFun as its clear common-cathode RGB LED) red drops 2.0 V and green and blue 3.2 V typical at 20 mA, and each chip is rated for 20 mA (China Young Sun datasheet, p. 1). Tie the longest leg (pin 2, the cathode) to GND and drive red (pin 1), green (pin 3) and blue (pin 4) from PWM pins, each through its own resistor: about 150 Ω for red and 100 Ω for green and blue on 5 V.

This is a standard 5 mm through-hole RGB LED: three independent LED chips (red, green and blue) in a single clear lens that share one common cathode. The figures on this page come from the YSL-R596CR3G4B5C-C10 by China Young Sun LED Technology, the part SparkFun sells as its common-cathode RGB LED. It has four legs: red is pin 1, the common cathode pin 2 (the longest leg), green pin 3 and blue pin 4, and the body is 5 mm across and 8.7 mm tall (datasheet, p. 2).

Each color is driven as its own channel. Because the three chips share only their negative terminal, you control brightness on each anode independently, and blending the channels with PWM produces a wide range of mixed colors from a single lens. There is no controller, memory or data protocol inside the part: it behaves as three ordinary LEDs, not as an addressable pixel.

The red chip drops 2.0 V typical (1.8 to 2.2 V) at 20 mA, while the green and blue chips drop 3.2 V typical (3.0 to 3.4 V), and each chip's maximum forward current is 20 mA (datasheet, p. 1). That difference matters when you size resistors and try to balance a neutral white.

## Agent rules

Follow these when you wire this part or write code for it.

- Do: Must use 3 separate resistors, one per color channel.
- Do: Cathode must connect to GND rail.
- Do: Calculate resistor for each channel independently (Vf differs): red die ~2.0V → 150Ω (20mA), green/blue dies ~3.2V → 100Ω (18mA).
- Never: No single shared resistor for all channels.
- Never: No connecting cathode to VCC (this is common-cathode, not common-anode).
- Never: No non-PWM pins if analog color mixing is needed.

## Pinout

| Pin | Function | Type |
| --- | --- | --- |
| red | Red (+) | passive |
| cathode | Cathode (-) | passive |
| green | Green (+) | passive |
| blue | Blue (+) | passive |

## Wiring

### Arduino Uno

| RGB LED | Arduino Uno | Note |
| --- | --- | --- |
| red | D3 | through a 150 Ω resistor |
| green | D5 | through a 100 Ω resistor |
| blue | D6 | through a 100 Ω resistor |
| cathode | GND |  |

### ESP32 DevKit V1

| RGB LED | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| red | GPIO13 (D13) | through a 150 Ω resistor |
| green | GPIO14 (D14) | through a 100 Ω resistor |
| blue | GPIO4 (D4) | through a 100 Ω resistor |
| cathode | GND |  |

### Raspberry Pi Pico

| RGB LED | Raspberry Pi Pico | Note |
| --- | --- | --- |
| red | GP0 | through a 150 Ω resistor |
| green | GP1 | through a 100 Ω resistor |
| blue | GP2 | through a 100 Ω resistor |
| cathode | GND |  |

## Specifications

| Spec | Value | Source |
| --- | --- | --- |
| Reference part | YSL-R596CR3G4B5C-C10, 5 mm clear common-cathode RGB | China Young Sun YSL-R596CR3G4B5C-C10 datasheet, p. 1 |
| Pinout | 1 red, 2 common cathode (longest), 3 green, 4 blue | China Young Sun YSL-R596CR3G4B5C-C10 datasheet, p. 2 |
| Forward voltage at 20 mA | Red 2.0 V typ (1.8 to 2.2 V); green and blue 3.2 V typ (3.0 to 3.4 V) | China Young Sun YSL-R596CR3G4B5C-C10 datasheet, p. 1 |
| Forward current (abs. max) | 20 mA per chip, 30 mA peak at 1/10 duty | China Young Sun YSL-R596CR3G4B5C-C10 datasheet, p. 1 |
| Peak wavelength | Red 625 nm, green 520 nm, blue 467.5 nm | China Young Sun YSL-R596CR3G4B5C-C10 datasheet, p. 1 |
| Luminous intensity at 20 mA | Red 800 mcd, green 4000 mcd, blue 900 mcd | China Young Sun YSL-R596CR3G4B5C-C10 datasheet, p. 1 |
| Body | 5 mm diameter, 8.7 mm tall | China Young Sun YSL-R596CR3G4B5C-C10 datasheet, p. 2 |
| Forward voltage | 2 V | Tinkered component registry |
| Dimensions | 5 × 5 × 8.6 mm | Tinkered component registry |

## Circuit notes

- Common cathode: the single shared (longest) leg goes to GND. The red, green and blue anodes are the controlled positive pins, each driven from its own output.
- Give every color channel its own series current-limiting resistor. Never share one resistor across the three anodes, or the current per color will change depending on how many channels are lit.
- On 5 V, about 150 ohms for red ((5 - 2.0) / 150 = 20 mA) and 100 ohms for green and blue ((5 - 3.2) / 100 = 18 mA) keeps each chip at or under its 20 mA rating (datasheet, p. 1). Use a larger value for a dimmer, longer-lived LED.
- Drive each anode from a PWM-capable output (analogWrite on an Arduino, on a Uno pins 3, 5, 6, 9, 10 and 11) to mix intermediate colors instead of only the eight full-on/off combinations.
- This is a common-cathode part. A common-anode RGB LED is wired the opposite way (shared pin to +V, colors switched on the low side), so confirm the type before wiring.

## Common mistakes

- **Wiring it as common anode.** This part shares a common cathode, so the long leg goes to GND and the three color legs are the positive drive pins. Tying the shared leg to +5 V, as you would with a common-anode LED, leaves it dark.
- **Using a single shared resistor.** Putting one resistor on the common cathode instead of one per anode makes each color's current depend on how many channels are on, so brightness shifts as colors mix. Use three separate resistors, one per color.
- **Expecting equal brightness from equal resistors.** Red drops 2.0 V and green and blue 3.2 V, and at 20 mA green is rated 4000 mcd against 800 for red and 900 for blue (datasheet, p. 1). Equal resistors therefore give an uneven white; balance the channels with different resistor values or PWM levels.
- **Swapping the color legs.** On this part the order is red, cathode, green, blue, with the cathode the longest leg (datasheet, p. 2). Other RGB LEDs may differ, so confirm the pinout of yours before soldering.
- **Treating it like a NeoPixel.** There is no data line, controller or addressing here. Each color is a plain channel driven through a resistor, so single-wire pixel code and 5 V data timing do not apply.

## Questions

### Which pin is which on a 4-pin RGB LED?

On the YSL-R596CR3G4B5C-C10 common-cathode RGB LED, pin 1 is red, pin 2 (the longest leg) the common cathode, pin 3 green and pin 4 blue (datasheet, p. 2). Hold the LED with the longest leg second from the left to read them in order.

### Do I need three resistors for an RGB LED?

Yes, one per color anode. Each chip is rated for 20 mA (datasheet, p. 1), and a shared resistor on the cathode lets the current per color change with how many colors are on.

### What resistor values should I use for an RGB LED on 5 V?

About 150 Ω for red (2.0 V typical) and 100 Ω for green and blue (3.2 V typical) give 20 mA and 18 mA (datasheet, p. 1). These are the values the studio uses.

### Can I use an RGB LED with an ESP32 or Pico on 3.3 V?

Red works, with about 68 Ω for 19 mA. Green and blue drop 3.0 to 3.4 V (datasheet, p. 1), which leaves almost nothing across a resistor on a 3.3 V pin, so they glow dimly or not at all. Switch the green and blue anodes from 5 V with transistors for full brightness.

### Common cathode or common anode: how do I tell?

Connect the longest leg to GND and touch one color leg to 5 V through a 220 Ω resistor. If it lights, the LED is common cathode; if not, try the long leg on 5 V and the color leg to GND through the resistor, which lights a common-anode part.

### Why does my RGB LED only show some colors?

Check that every color pin is on a PWM-capable output and that each has its own resistor. A color that never lights usually means a swapped leg or a pin that is not PWM; colors that look off-balance come from the different brightness of each chip.

## Related parts

- [Red LED](https://www.tinkered.ai/components/led-red.md): same job: a single light
- [Green LED](https://www.tinkered.ai/components/led-green.md): same job: a single light
- [Blue LED](https://www.tinkered.ai/components/led-blue.md): same job: a single light
- [Yellow LED](https://www.tinkered.ai/components/led-yellow.md): same job: a single light
- [Arduino Uno](https://www.tinkered.ai/components/arduino-uno.md): the board its circuit is wired to

## Try it

Tinkered simulates the RGB LED in the browser: wire it on a 3D breadboard, run your real code on the board, and measure it. Free to start at https://www.tinkered.ai.
