Shop OBEX P1 Docs P2 Docs Learn Events
RGB LED Not Working?? — Parallax Forums

RGB LED Not Working??

NoBo780NoBo780 Posts: 94
edited 2008-05-01 01:44 in BASIC Stamp
I never thought I would have to ask about having a problem with an LED, but this is a first. I bought a RGB ('full color') LED at radioshack for some color mixing to hopefully make a mood lamp, but I'm having some problems. This must be a unique LED, because according to the datasheet, there is ONE ANODE (+), and the other three leads are CATHODES (-). So I figured that you could light each individual LED in the package by keeping the one longest lead (supposedly VCC/+) HIGH, and bring one of the three other leads low. So I'm trying that, and it seems to work...almost. I am using an Arduino (the code is easy to read regardless of what language you are familiar with), and the code that I have running right now is SUPPOSED to light all THREE LED's at once (making the whole LED appear white). But only the Red LED lights. If you remove the lead for the red LED when the code is running, the green and blue LED's DO light together (making a turquoise color), and you can remove the blue lead to light just the green, and remove the green just to light the blue. But if I keep the red LED lead plugged in, you cannot see the green of blue LED's light. What is up with this LED??

Here's the code:

int onePin = 3;      //Cathode  (RED LED)
int twoPin = 5;      //ANODE  (pin 2 in datasheet)
int threePin = 6;   //Cathode (BLUE LED)
int fourPin = 9;    //Cathode  (GREEN LED)
int fivePin = 10;  //Ignore this
int sixPin = 11;   //...and this

void setup()
{
  Serial.begin(9600);
  pinMode(onePin, OUTPUT);
  pinMode(twoPin, OUTPUT);
  pinMode(threePin, OUTPUT);
  pinMode(fourPin, OUTPUT);
  pinMode(fivePin, OUTPUT);   //Ignore
  pinMode(sixPin, OUTPUT);    //Ignore
}

void loop() {
  digitalWrite(onePin, LOW);
  digitalWrite(threePin, LOW);
  digitalWrite(fourPin, LOW);
  digitalWrite(fivePin, LOW);  //Ignore
  digitalWrite(twoPin, HIGH);  //ANODE  (pin 2 in datasheet)
  delay(300);
  digitalWrite(twoPin, LOW);  //ANODE (pin 2 in datasheet)
  delay(300);
}




And HERE'S the datasheet.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!

Post Edited (NoBo780) : 4/28/2008 2:34:53 AM GMT

Comments

  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2008-04-28 02:59
    There are a couple things I would try:

    First, I wouldn't bother connecting the Anode to your module. Just tie it to your +V so it is always available. Next, I would put a small current limiting resistor on each one of the leads for the colors. Without current limiting resistors you may burn up the LED's. Since it sounds like you are just turning them on/off you'll only have a handful of color combinations. To get them to look right you'll probably have to adjust the current limiting resistors to adjust the colors relative to the others.

    I am not familiar with the Ardunio but it appears that you are just turning the outputs on and off. For any comments on the code you'll probably want to find an Ardunio specific forum.
  • NoBo780NoBo780 Posts: 94
    edited 2008-04-28 13:08
    I am going to eventually use PWM to mix the colors; I'm just STARTING OUT by using this simple ON/OFF code.

    Here's some help on the syntax:

    -the pinMode() sets the parameters for a pin (input or output)
    -the delay() function is the same as PAUSE
    -the digitalWrite() is the same as HIGH [noparse][[/noparse]pin] or LOW [noparse][[/noparse]pin]
    -the void setup(){} is just run ONCE at the beginning (it's pretty much like an initializer to the program)
    -the void loop(){} is like a DO...LOOP

    Ok, I'll try what you mentioned. Thanks.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Giggly Googley!
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-04-28 23:03

    ·s - a - n - d - b - o - x
  • FireHopperFireHopper Posts: 180
    edited 2008-04-29 00:39
    I have this same led, and I hooked the anode to vdd, and put 3 1K resistors inbetween the cathodes and pins 15, 14, and 13. and then a short program to do 7 color cycle. [noparse]:)[/noparse]
    fairly short and simple.
    13 is connected to red
    14 is connected to blue
    15 is connected to green

    then I do something like

    high 15
    high 14
    high 13
    (all colors off)
    low 13
    low 14
    low 15
    (white)

    and so on. [noparse]:)[/noparse] with a 500 ms pause inbetween. then do it again.. :

    what it sounds like you did is hook it direct or with just a single resistor, the red led chip tends to take juice away from the blue and green unless you put a resistor on each color.
    the red one has a lower forward voltage than the blue and green, meaning it eats up all the voltage/current
  • NoBo780NoBo780 Posts: 94
    edited 2008-05-01 01:44
    Ahhh! Thank you; that's the way it's supposed to be hooked up. Thanks for reading this post. That is a really bizarre LED, though. I got a RGB LED from sparkfun that was MUCH easier to use, although the casing was transparent, unlike this one which is translucent, which diffuses the colors better.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Giggly Googley!
Sign In or Register to comment.