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
- Arduino Uno Board
- 2-Color (Bi-Color) LED Module
- 220Ω Resistors (2 pieces recommended)
- Breadboard
- Jumper Wires
- USB Cable or 12V Power Adapter
Hardware Wiring Explanation
Follow the steps below to connect the LED module safely to the Arduino Uno:
- Connect the Red LED pin to Digital Pin 11 (PWM pin).
- Connect the Green LED pin to Digital Pin 10 (PWM pin).
- Connect the common cathode (or anode, depending on module type) to GND.
- Use a 220Ω resistor in series with each LED color to limit current and protect the LEDs.
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)
- Download and install the Arduino IDE from the official website.
- Connect your Arduino Uno to your computer using a USB cable.
- Select the correct board (Arduino Uno) from Tools > Board.
- Select the correct COM port from Tools > Port.
- Click Verify (✓) to compile the code.
- Click Upload (→) to upload the program to the Arduino.
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
- Understand how bi-color LEDs work.
- Learn to use PWM for brightness control.
- Practice Arduino digital and analog output functions.
- Understand current limiting using resistors.
- Gain hands-on experience with color blending techniques.
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.