RGB LEDs are fun components to explore expressive and technical aspects of tangible media. You can control them in circuits with fixed resistors, or with code as digital or analog devices. The possibilities and combinations are endless.
RGB LEDs are also examples of parallel components — the three color channels are organized internally in parallel. This arrangement makes setup a little more difficult than simple LEDs but the potential color variations make it worth the effort.
Required Parts
- breadboard
- battery pack
- battery clip (wire)
- resistors assorted (start with 1kΩ)
- resistor 470Ω
- RGB LEDs (big white gumdrop)
Power connections
In this video I use a voltage regulator that we no longer have in our kits (hmm) . For a raw circuit (no code), you have two solutions possible with the current kit:
First, use the 9V battery pack we have been using in class and connect to the breadboard power rails. The resistors suggested will protect the LED at 9V
Second — and we may not have covered this in class — but you can use your Arduino as a power source. Connect the Arduino pin labelled +5V to the red breadboard rail and GND connected to the blue breadboard rail. This will provide a stable 5V supply.
Use dupont wires or cut your own to make these connections — double check for short circuits before you power up.
Arduino Connections for power
Video
Get The Slides
The Circuit
The RGB LED has three single color LEDs inside – red, green and blue. Each of these behaves in essentially the same way as a single color LED on its own. There are slight difference in the amount of voltage it takes to turn on each color in the RGB LED.
Finding Ground
Take a moment to find the ground leg of your RGB LEDs. The ground (GND) leg is the longest. There is no flat side on the case of these LEDs.
Hold your RGB led such that there is one shorter leg to the left of ground, and two shorter legs to the right of ground. If held like this, the legs go in order from left-to-right : RED – GROUND (GND)-GREEN-BLUE. In the symbol above, the leg below the LEDs is a common ground connection for all three internal LEDs. Keep track of the ground leg as you build.
Single resistor circuit.
Use this single resistor circuit to test each channel one at a time.
Try moving the top resistor ( 1k in schematic — connected between Arduino 5V [+ve] and the BLUE channel) to the RED and GREEN LED legs (excluding ground). You should be able to confirm the leg order described above and the channel colors.
Mixing Colors
Using the fixed resistors in your kit, try creating your favourite color. Try different values for the top 3 resistors in the schematic below. You can use any resistor from your kit AS LONG AS YOU ALSO LEAVE the 470 ohm resistor shown in place.
What is your favourite color?