Tri color LEDs... What are they?

What are Tri Color LEDs? Can they generate all colors using RGB spectrum or only limited colors? How much do they cost? where can i buy them?

also called RGB Led, just google a bit and you will find many. By adjusting the voltage of each pin, you will get different colors.

Be careful; terminology is ambiguous.
An LED can contain one, two, or three light-emitting chips.
If it has one chip, it has one color.
Two chips of different colors can have three colors (one chip on, other chip on, or both chips on), and these are SOMETIMES called "tri-color." The chips can be connected with a common cathode or anode (three-lead packages), or in "inverse parallel" (current in one direction for one color chip, the other direction for the other, or AC for both.)
A three chip LED usually has red, green, and blue chips, and can theoretically generate any color. Full "RGB" leds will have four leads so that you can control each chip independently. However, there are also three-chip LEDs with internal circuitry to sequence through multiple colors automatically. These will only have two leads, and you have no control over how they behave.

There are also weird variants of teh RGB LED that have 6 legs. 2 are common cathode or anode and then 1 for RED, 1 for GREEN and then 2 for BLUE (meaning they have 4 chips on board). Not sure why there are 2 blue and only 1 red and green though.

Not sure why there are 2 blue

In these type of LEDs the blue is no so bright so they put two in to make the light output comparable with the other two.

Ahh I see. But why the two anode/cathode legs? Why not just one?

But why the two anode/cathode legs? Why not just one?

Because this lead carries more current than the others so by having two in parallel the volts drop between the bonding wires and the chip is minimised. This is a trick used by a lot of high current ICs. I am working with a chip at work that has over 1500 pins and a good 400 of them are ground connections.

So can I simply chop one leg off if I solder a wire between the two at the top?

Yes

Cool. makes you wonder why they don't make them like that !

makes you wonder why they don't make them like that !

Simply cost, it's much cheaper to do it the way they did.

Something I noticed was the blending of colors...

Like westfw pointed out,

A three chip LED usually has red, green, and blue chips

These three chips are 3 different LEDs built into the same package (a Red LED, a Green LED and a Blue LED).

I can control which LEDs are turned on or off to make other colors, like Purple (both Red and Blue LEDs turned on at the same time).

If my eyes are really close to the RGB LED, I can see only the Red chip and the Blue chip light up. But, if I stand a few feet away, the colors of the two LEDs blend together (with respect to my distance) and look like Purple.

When I turn on all the colors (Red, Green, and Blue chip), I can see a white light if I stand a few steps back.

-Mike

Yes that is what they are for.

Using PWM which gives you 256 degrees of scale per colour you get 16777216 colour (256256256) combinations.

I've recently been fiddling with one to make some mood lamps as Xmas presents - RGB Lamp Test on Vimeo

I was jsut fiddeling with a RGB LED and came up with this code. It is light day now, so I have no idea how it looks :wink:

I am still looking for a nice function. I think Mike Mc's approach to select color randomly an then fade between them is much smarter. However here is my code:

/*
 * RGB Mood LED
 *
 */

float r,g,b,wr,wg,wb;

// Select which PWM-capable pins are to be used.
int redPin = 11;
int greenPin = 10;
int bluePin = 9;


// A function set an float RGB Value active-low or common-anode output.
//
void fsetRGB(float r, float g, float b)
{
  analogWrite(redPin,   int(r*255.0));
  analogWrite(greenPin, int(g*255.0));
  analogWrite(bluePin,  int(b*255.0));
}


// Set up our outputs, and give full high values so the
// LEDs start off.  Then fade in the blue LED.
//
void setup()
{
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
}


void loop()
{
  wr = wr + random(10)/3000.0;
  wg = wg + random(12)/3000.0;
  wb = wb + random(8)/3000.0;
  r=(sin(wr)+1.0)/2.0;
  g=(sin(wg)+1.0)/2.0;
  b=(sin(wb)+1.0)/2.0;
  fsetRGB(r,g,b);
  delay(5);
}