askvity

How to Control a Common Anode RGB LED?

Published in LED Circuit Control 3 mins read

To control a common anode RGB LED, you need to apply a LOW signal or ground to the individual color leads (red, green, blue) while connecting the anode lead to the positive terminal of your power supply.

Understanding Common Anode RGB LEDs

In a common anode RGB LED, the positive terminals (anodes) of the internal red, green, and blue LEDs are all connected to a single external anode lead. This configuration requires a slightly different approach to control the individual colors compared to a common cathode RGB LED.

Control Mechanism

Applying Voltage

  • Anode Connection: The common anode lead is connected to the positive terminal of the power supply.
  • Color Control: To activate a specific color, you need to apply a LOW signal (ground) to the corresponding cathode lead.

How It Works

When you connect the anode to the positive voltage and ground the cathode lead of a specific color (e.g., red), you complete the circuit for that LED, allowing current to flow and the LED to light up.

Practical Implementation

Basic Setup

Component Connection
Common Anode (LED) Positive terminal of the power supply
Red Cathode (LED) Ground (to turn on red)
Green Cathode (LED) Ground (to turn on green)
Blue Cathode (LED) Ground (to turn on blue)

Example Circuit

  1. Power Supply: Connect the positive terminal of your power supply (e.g., 5V) to the common anode lead of the RGB LED.
  2. Grounding Cathodes:
    • To turn on the red LED, connect the red cathode lead to the ground.
    • To turn on the green LED, connect the green cathode lead to the ground.
    • To turn on the blue LED, connect the blue cathode lead to the ground.
  3. Mixing Colors: By grounding multiple cathode leads simultaneously, you can mix colors. For example, grounding both the red and green cathode leads will produce a yellow light.

Controlling with Microcontrollers

Using Arduino

When using a microcontroller like an Arduino, you can control the RGB LED by setting the digital output pins connected to the cathode leads to LOW to turn on a specific color.

Example Code (Arduino)

void setup() {
  pinMode(9, OUTPUT); // Red
  pinMode(10, OUTPUT); // Green
  pinMode(11, OUTPUT); // Blue
}

void loop() {
  // Turn on Red
  digitalWrite(9, LOW);
  digitalWrite(10, HIGH);
  digitalWrite(11, HIGH);
  delay(1000);

  // Turn on Green
  digitalWrite(9, HIGH);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH);
  delay(1000);

  // Turn on Blue
  digitalWrite(9, HIGH);
  digitalWrite(10, HIGH);
  digitalWrite(11, LOW);
  delay(1000);
}

Summary

  • Connection: Common anode to positive, individual color cathodes to ground to activate.
  • Control: Apply a LOW signal to the cathode leads to turn on the corresponding color.
  • Mixing: Ground multiple color leads to mix colors.
  • Microcontrollers: Use digital output pins set to LOW to control individual colors.

Related Articles