LEDs are great. But with any project there comes a point where flashing is simply not enough. For these cases an RGB (Red, Green, BLue) LED is the answer.
With an RGB LED you'll be able to produce any colour glow your heart desires.
At first using an RGB LED seems quite complex, but it quite quickly becomes clear that its no more difficult than controlling one of their single colour counter parts.
What follows is a quick guide to get you started controlling an RGB LED first with wires then with an Arduino microcontroller.
If you'd like to jump ahead to any part here's your chance.
Step 1 The Parts
Step 2 Testing
Step 3 Arduino Controlled Example Circuit
Step 4 Digital Control of Colour
Step 5 Analog Control of Colour
Interested in getting a few RGB LEDs to play around with and in the UK? a component bundle can be bought at our online store oomlout.co.uk
Step 1: Parts
RGB LED (common anode)
- A common anode RGB LED is nothing more complicated than three one colour LEDs (one red, one green, and one blue) housed in a single package.
- Rather than having 6 leads (a cathode and anode for each LED) it has only 4 one cathode for each colour, and one common anode. (see the schematic diagram below)
- A common anode RGB LED is the most popular type. It is most commonly found in either a 5mm bulb size or as a 5mm pirahna form factor.
- Most LEDs are designed to work with a voltage between 1.5v and 3v. As most microcontrollers (including the Arduino) operate on 5 volts a current limiting resistor is required.
- Consult your LEDs datasheet for maximum ratings but we like to use 270 ohm resistors. This limits the current to ~20mA, well within most LEDs and microcontroller ratings.
- A great open source microcontroller platform (for more details visit arduino.cc)