

The 5 mm RGB LED, Common Anode, is a versatile light-emitting diode that combines red, blue, and green 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 anode" configuration means that all three LEDs share a single positive terminal, while the negative terminals for each color are controlled individually.








| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | Common Anode | Shared positive terminal for all three LEDs |
| 2 | Red Cathode | Negative terminal for the red LED |
| 3 | Blue Cathode | Negative terminal for the blue LED |
| 4 | Green Cathode | Negative terminal for the green LED |
Below is an example of how to connect and control the 5 mm RGB LED using an Arduino UNO.
// Define pins for the RGB LED cathodes
const int redPin = 9; // Red cathode connected to pin D9
const int bluePin = 10; // Blue cathode connected to pin D10
const int greenPin = 11; // Green cathode connected to pin D11
void setup() {
// Set RGB pins as outputs
pinMode(redPin, OUTPUT);
pinMode(bluePin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop() {
// Example: Cycle through colors
setColor(255, 0, 0); // Red
delay(1000);
setColor(0, 255, 0); // Green
delay(1000);
setColor(0, 0, 255); // Blue
delay(1000);
setColor(255, 255, 0); // Yellow
delay(1000);
setColor(0, 255, 255); // Cyan
delay(1000);
setColor(255, 0, 255); // Magenta
delay(1000);
setColor(255, 255, 255); // White
delay(1000);
}
// Function to set RGB LED color
void setColor(int redValue, int greenValue, int blueValue) {
analogWrite(redPin, 255 - redValue); // Invert value for common anode
analogWrite(greenPin, 255 - greenValue); // Invert value for common anode
analogWrite(bluePin, 255 - blueValue); // Invert value for common anode
}
LED Not Lighting Up:
Incorrect Colors:
Dim or Flickering LEDs:
Overheating:
Can I use this LED with a 3.3V system? Yes, but you may need to adjust the resistor values to ensure proper current limiting.
Why do I need to invert PWM values for a common anode LED? In a common anode configuration, the cathodes are controlled by sinking current. A lower PWM value corresponds to higher brightness.
Can I control this LED without a microcontroller? Yes, you can use switches or potentiometers to manually control the cathodes.
This documentation provides all the necessary details to effectively use the 5 mm RGB LED, Common Anode, in your projects.