3-Color LED Module
TThe 3-Color LED Module project demonstrates how to control an RGB LED using an Arduino Mega. RGB LEDs can emit a wide range of colors by combining different intensities of red, green, and blue light. This project will cycle through various colors, showcasing how to use PWM (Pulse Width Modulation) to achieve different color outputs.
Components Needed
- Arduino Mega
- 3-Color LED Module (RGB LED)
- Jumper Wires
- Resistors (optional, to limit current through LEDs)
- Breadboard
- Power Supply
Block Diagram
Circuit Setup
Connect the 3-Color LED Module to Arduino Mega:
Connect the red LED pin of the module to digital pin 9 on the Arduino Mega.
Connect the green LED pin of the module to digital pin 10 on the Arduino Mega.
Connect the blue LED pin of the module to digital pin 11 on the Arduino Mega.
Connect the common cathode or anode of the LED module to GND or VCC accordingly.
Instructions
Circuit Setup:
Wire the 3-color LED module to the Arduino Mega as described in the circuit setup section.
Optionally, use resistors in series with each LED pin to limit current and protect the LEDs.
Code Upload:
Open the Arduino IDE and paste the provided code.
Upload the code to the Arduino Mega.
Testing:
Once the code is uploaded, the RGB LED should cycle through various colors with a one-second delay.
Open the serial monitor to see the RGB values for each color being displayed.
Applications
Notes
Ensure the correct connection of the common terminal (cathode or anode) of the RGB LED module based on its type.
Adjust the delay time as needed to change the rate of color switching.
Experiment with additional color combinations to create custom lighting effects.
Use appropriate resistors to protect the LEDs from excessive current.