Arduino Uno 2-Color LED Module

In this project, we control a 2-color (bi-color) LED module using the Arduino Uno. The module typically contains red and green LEDs combined in a single package, allowing color switching or blending effects.

Using PWM (Pulse Width Modulation), we can smoothly fade between red and green, creating visually appealing transitions such as yellow (by mixing red and green at equal intensity). This project introduces beginners to LED interfacing, PWM control, and embedded programming fundamentals.

Components Required

Hardware Wiring Explanation

Follow the steps below to connect the LED module safely to the Arduino Uno:

Note: If you are using a common-anode LED module, connect the common pin to 5V instead of GND and invert the PWM logic in software.

Arduino Code (PWM Fading Example)

            // Code file not found: const int redPin = 11;
const int greenPin = 10;

void setup() {
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
}

void loop() {
  // Fade from red to green
  for (int i = 0; i <= 255; i++) {
    analogWrite(redPin, 255 - i);
    analogWrite(greenPin, i);
    delay(10);
  }

  // Fade from green back to red
  for (int i = 0; i <= 255; i++) {
    analogWrite(redPin, i);
    analogWrite(greenPin, 255 - i);
    delay(10);
  }
}
          

Software Setup (Arduino IDE)

Project Operation

Once powered, the LED module will smoothly transition between red and green colors. As one LED increases in brightness, the other decreases, producing a blended color effect.

When both LEDs glow at equal brightness, the combined output may appear yellow (depending on LED characteristics).

Working Principle

Pulse Width Modulation (PWM) controls the brightness of each LED by rapidly switching the signal ON and OFF. The ratio of ON time to OFF time (duty cycle) determines the perceived brightness.

By adjusting PWM values (0–255), we can independently control red and green intensities and blend them to create intermediate colors.

Learning Outcomes

Conclusion

The Arduino Uno 2-Color LED project is a beginner-friendly introduction to embedded systems, LED control, and PWM-based brightness modulation. It builds a strong foundation for advanced topics such as RGB LEDs, motor speed control, and signal modulation.