RGB LED Mixer Using 3 LEDs (Arduino Project)

🌈 RGB LED Mixer Using Single RGB LED (Common Cathode Type) -NANO

💡 Project Overview

In this project, we’ll build an RGB LED color mixer using a single 4-pin RGB LED and an Arduino Nano (or Uno).
By controlling the brightness of the Red, Green, and Blue channels using PWM (Pulse Width Modulation), we can blend them to create almost any color — yellow, cyan, magenta, white, and more!

This is a fun beginner project to understand color mixing and how Arduino can vary light intensity digitally.


🧩 Components Required

ComponentQuantityDescription
Arduino Nano / Uno1Microcontroller board
RGB LED (4-pin, Common Cathode)1Red, Green, Blue LEDs inside one package
220 Ω Resistors3Current-limiting resistors for each color
Breadboard1For assembling the circuit
Jumper WiresMale-to-male wires for connections

⚙️ How the RGB LED Works

An RGB LED has four pins — one common cathode (GND) and three separate color pins:

  • R (Red)
  • G (Green)
  • B (Blue)
    By sending different PWM signals (0–255) from the Arduino to each color pin, we control the brightness of each internal LED.
    When the lights blend, they form new colors.
ColorRedGreenBlue
Red25500
Green02550
Blue00255
Yellow2552550
Cyan0255255
Magenta2550255
White255255255

🧭 Pin Identification of RGB LED

When you look at the LED from the flat edge side,
the pins are usually arranged as follows (from left to right):

1️⃣ Red   | 2️⃣ Common (Longest Leg – GND) | 3️⃣ Green | 4️⃣ Blue

If the longest leg connects to GND, it’s a Common Cathode RGB LED — exactly what we’re using here.


🔌 Circuit Diagram & Connections

Table: Arduino to RGB LED Connections

Arduino PinRGB LED PinConnection ThroughDescription
D9Red220 Ω resistorControls red brightness
D10Green220 Ω resistorControls green brightness
D11Blue220 Ω resistorControls blue brightness
GNDLongest (common) legCommon Cathode (Ground)

Text-Based Circuit View

          (Flat edge)
          [RGB LED]
          |   |   |   |
         R  COM  G   B
         |   |   |   |
        220Ω | 220Ω 220Ω
         |   |   |   |
        D9  GND D10 D11

💡 Each color pin gets its own resistor before connecting to the Arduino PWM pins.

Circuit Diagram


💻 Arduino Code (Tested for Common Cathode)


🧠 How the Code Works

  1. PWM Output: The pins 9, 10, and 11 are PWM-enabled, allowing brightness control from 0 (off) to 255 (full).
  2. setColor() Function: Simplifies color selection by taking 3 brightness values.
  3. Color Cycle: The LED cycles through primary and mixed colors every second.
  4. Result: Smooth color transitions that demonstrate additive color mixing.

🌟 Expected Output

Once you power up the Arduino Nano:

  • The single RGB LED will glow in Red → Green → Blue → Yellow → Cyan → Magenta → White → OFF sequence.
  • Each color blends perfectly inside the LED’s body — creating a smooth light-mixing effect.

🚀 Extensions and Ideas

  • Add three potentiometers to control each color manually (analog input).
  • Use a Bluetooth module (HC-05) to change colors from a smartphone.
  • Create a fading rainbow effect by gradually increasing/decreasing brightness in loops.
  • Combine with sound or light sensors for reactive lighting effects.

✅ Summary

FeatureDetails
LED Type4-pin RGB LED (Common Cathode)
Common Pin ConnectionGND
Arduino Pins UsedD9 (Red), D10 (Green), D11 (Blue)
Resistors220 Ω each
Power Supply5 V from Arduino
Code TypePWM control with color mixing

This Post Has One Comment

Leave a Reply