Sie sind auf Seite 1von 1

Multi-Color LED Fun (RGB LEDs)

The Pieces
RGB LED
(common anode)

The Theory & Code


RGB LED An RGB LED is actually three single color LEDs (Red, Green and Blue) combined into a single package. Because of this controlling it is very similar to controlling a single color LED. The one difference is the 3 LEDs share a common anode (long lead (+)). .: A quick refresher on LED control can be found here tinyurl.com/cmn5nh :. Testing Plug the LED into the breadboard then connect the common anode to +5 volts (5V). Connect a current limiting resistor to the remaining 3 pins. Connect these resistors to ground (Gnd) to test each color. .: IMPORTANT: always use a current limiting resistor with the 3 cathodes :. Digital Test Code Controlling the RGB LED digitally 7 colors are achievable (see the color truth table below). .: Download a demo program from http://tinyurl.com/n36zql :. .: For more details visit http://tinyurl.com/mcwl73 :. Analog Test Code Controlling the RGB LED using the Arduinos PWM pins allows for almost infinite control of color. For a helping hand see the analog color wheel below. .: Download a demo program from http://tinyurl.com/nmmd89 :. .: For More details visit http://tinyurl.com/nnxbau :.

x3 270 ohm Resistor


(red-purple-brown)

x9

The Schematic
pin 3 pin 5 pin 6 pin 9 pin 10 pin 11 analog 0 (14) analog 1 (15) analog 2 (16)

resistor
(270ohm)

green

green

green

blue

blue

blue

nta

nta

ge

(viewed from top)

The Circuit

The Layout Sheet


A B C D E 1 2 3 F Gto Gnd H I J

analog one

to 5v
270ohm

red 4 com + 5 green 6 blue 7


8 9 10

analog two

270ohm

red 11 com + 12 green 13 blue 14


15 16 17 18

digital one

270ohm

to18 analog 0
19 20 21

red 19 com + 20 green 21 blue 22


23 24 25 26 27 28 29 30 A B C D E F G H I

to22 analog 1 to23 analog 2


24

CIRC-16 26
Multi-Color Lights 27 (RGB LEDs) 28
29 30 J

.: Instructions: print out, cut out, get making :. .: for more details visit: http://tinyurl.com/mzh3w5 :.

cyan

cyan

red cathode common anode green cathode blue cathode

ma

ma

ge

blu

blu

red

The Pin-out

red

+5 volts

red

Colour Truth Table red green blue yellow ON ON OFF cyan OFF ON ON magenta ON OFF ON white ON ON ON

Colour Wheels
digital
red
llo ye w gree n

analog
red
llo ye w gree n
1 2 3 4to 5 6 7to 8 9

pin 3 pin 5 pin 9

to pin 6

10 to 11 12 13 14 to 15 16 17

pin 10

to pin 11

25