Nibbles and Bits
The Care and Feeding of My Pet Arduino


by Budd Churchward - WB7FHC - NIBBLES AND BITS LIBRARY

Sequencing RGB LEDs
«  1  2 3 4 5 6 »

Section 1 - Components
I purchased some RGB LEDs on eBay and they arrived today. So it is time to figure out how to use them.

The first thing you notice about them is that they have four leads instead of two. And the leads vary in length. I searched the Internet and found a pin diagram. The longest lead is a common cathode. The other three are connected to individual diodes in the bubble which each produce a different color.

RGB-LEDs - quantity needed: 1
Right away, I tested one out with a simple hook-up. Using my breadboard and Arduino (as a simple power supply) I hooked the cathode up to ground through a limiting resistor. I then made a probe by connecting one end of a jumper wire to 5v. Tapping the LED leads, I clearly saw three different colors light up brightly before my eyes. This isn't too hard!

I decided on a simple idea for my first RGB project:
I want to train Arduino to fetch clicks from a push button and cycle through the colors on the LED. Each time I press the button, I want the LED to light up with the next color:
red   green   blue

I'll be using a mini push button, momentary contact switch. These were a great buy on eBay. You will notice in the photo that they have four legs. The terminals that point their toes at each other are the same connection. You can use either side. When you install the switch across the center gap of your bread board you are, at the same time, linking the two opposite bands of common points together.
Momentary Contact Switch - quantity needed: 1
We will need two resistors for this project. And yes, I found them on eBay, too! Mine are 470 Ω. You should be able to use anything from 220 Ω to 1K Ω.

They can be the same value. One will be a 'limiting resistor' to keep from blowing out the LED. And the other will be a 'pull down resistor' to stablize the input so Arduino doesn't get all hyper thinking something is happening when it isn't. Without it, he can be as crazy as a lab with a tennis ball!

We will talk more about these resistors in the next section and then we will get on to populating the breadboard for this project.

Next Section »

470 resistors - quantity needed: 2