How to Control an RGB LED With an Arduino

by DIYmasters in Circuits > Arduino

4928 Views, 16 Favorites, 0 Comments

How to Control an RGB LED With an Arduino

IMG_8099.JPG
IMG_8105.JPG

In this Instructable, I'll be showing you how to control an RGB LED with an Arduino.

To complete this project, you'll need:

1x Arduino (I'm using the Arduino Uno R3)
1x RGB LED
3x 150-220 ohm resistors
4x Jumper Wires
1x Breadboard
1x Computer with Arduino IDE installed.

So lets get working...

Connect the LED to the Breadboard.

IMG_8107.JPG

To begin with, you're going to need to connect your RGB LED any where on the breadboard. Just make sure that all four pins are available.

Connect the Ground Wire

IMG_8108.JPG
rgb_led_diagram.jpg

Next, we're going to connect the ground wire to the LED. If you're not sure what pin the ground is, pull the LED put again and find the longest pin; it is the ground pin. See the diagram above.

Add the Resistors.

IMG_8109.JPG

Now plug three 150-220 ohm resistors into the three remaining pins.

Connect the Jumper Wires

IMG_8110.JPG
IMG_8112.JPG
rgb_led_diagram.jpg

Now for the fun part. Connect three jumper wires to the red, green, and blue pins of the LED. I used jumper wires of the same color as the pins I was connecting them to.

If you're confused, pin 1 on the LED is blue, pin 2 is ground, pin 3 is green, and pin 4 is red.

Connecting the Wires to Your Arduino

Arduino RGB.jpg
IMG_8114.JPG
IMG_8115.JPG

Finally, you're going to need to connect all the wires to the Arduino's corresponding pins. The ground wire from the led connects to the GND pin on the Arduino, and the colored pins connect to pins 9,10, and 11 on the Arduino. It should look like the diagram above.

Check It to Make Sure...

IMG_8116.JPG

Plug It In!

IMG_8120.JPG

Now, plug the arduino into the computer's USB port.

Code

Open the Arduino IDE software that I'm assuming you've downloaded an installed already. You'll have to download the code from the button below. (sorry, the text editor kept squishing all the code into a paragraph. :-0)

Downloads

Yay!!!

IMG_8099.JPG

If you did everything right, the led should now be fading through all the colors!

Enjoy!