

The 5 mm RGB LED, Common Cathode, is a versatile light-emitting diode that combines red, green, and blue LEDs into a single package. This component allows users to create a wide range of colors by adjusting the intensity of each LED. The "common cathode" configuration means that all three LEDs share a single cathode (negative) pin, while the anodes (positive pins) are separate for each color.








| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | Red (R) | Positive terminal for the red LED |
| 2 | Cathode | Common negative terminal for all LEDs |
| 3 | Green (G) | Positive terminal for the green LED |
| 4 | Blue (B) | Positive terminal for the blue LED |
Below is an example of how to connect and control the 5 mm RGB LED using an Arduino UNO.
// Define the RGB LED pins
const int redPin = 9; // Red LED connected to pin 9
const int greenPin = 10; // Green LED connected to pin 10
const int bluePin = 11; // Blue LED connected to pin 11
void setup() {
// Set the RGB pins as outputs
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop() {
// Example: Cycle through red, green, and blue colors
setColor(255, 0, 0); // Red
delay(1000); // Wait 1 second
setColor(0, 255, 0); // Green
delay(1000); // Wait 1 second
setColor(0, 0, 255); // Blue
delay(1000); // Wait 1 second
setColor(255, 255, 0); // Yellow (Red + Green)
delay(1000); // Wait 1 second
setColor(0, 255, 255); // Cyan (Green + Blue)
delay(1000); // Wait 1 second
setColor(255, 0, 255); // Magenta (Red + Blue)
delay(1000); // Wait 1 second
setColor(255, 255, 255); // White (Red + Green + Blue)
delay(1000); // Wait 1 second
}
// Function to set the RGB LED color
void setColor(int redValue, int greenValue, int blueValue) {
analogWrite(redPin, redValue); // Set red brightness (0-255)
analogWrite(greenPin, greenValue); // Set green brightness (0-255)
analogWrite(bluePin, blueValue); // Set blue brightness (0-255)
}
LED Not Lighting Up:
Dim or Flickering Light:
Incorrect Colors:
Overheating:
Q: Can I use the RGB LED without resistors?
A: No, resistors are essential to prevent excessive current, which can damage the LEDs.
Q: How do I create custom colors?
A: Use PWM to adjust the brightness of each color channel. Combine different intensities of red, green, and blue to achieve the desired color.
Q: Can I control the RGB LED with a 3.3V microcontroller?
A: Yes, but ensure the forward voltage of each LED is compatible with the 3.3V supply. Adjust resistor values accordingly.
Q: What is the lifespan of the RGB LED?
A: With proper usage (e.g., current limiting), the LED can last for tens of thousands of hours.
This concludes the documentation for the 5 mm RGB LED, Common Cathode.