1

I am having problem getting this red and green led to switch on in its yellow color state. Red + green = yellow!! But it simply refused to do so. It's more like an annoyance than a real big deal problem to me, but It's also pretty interest if I can still able to fix it using software, which I am not sure if I could.

Here is the LED: (red 2v, green 3v) enter image description here

Here is how it looks like. The green colored leds should be turning yellow, and when I stare close enough, I can actually see the red led being turned on, but not bright enough. Normally, one would assume that the red led will be brighter than the green led because red is lower voltage, but strangely, it's the opposite.

enter image description here

Here is the circuit!! It's huge, please open it in a new tab and zoom in to see the detail. Basically the left part of the led is the red led. enter image description here

Here is the code that I use to run the leds. It's nothing fancy, just a simple old multiplexing.

  if(counter==0){
    PORTC &=~(1<<0);
    PORTD= ~(led[counter]);   
    PORTB=1<<0;
    }

  if(counter>0 && counter<8){
    PORTB =0;  
    PORTD= ~(led[counter]);     
    PORTB=1<<counter;    
    }

  if(counter==8){
    PORTB =0;
  PORTD= ~(led[counter]);       
    PORTC |=1<<0;
    }

  counter++;
   if(counter>8) {
   counter=0;
   for( byte i=0; i<9; i++){
    led[i]=0;
    } 

So, to make it clear, Q1, why no yellow? Q2, is it fixable using software? Q3, if so how? Q4, in case it's not fixable by software, what do I need to fix it in hardware. adding 12 resistors to red leds?

Update: Here I try to toggle the first dual led on and off, the last photo showing them switching on/off very fast, and clearly, it's not yellow. enter image description here

  • Are LED1 through LED60 your tri-color LED's? The LED's symbols are for conventional LEDs. – Michael Gorsich May 21 '18 at 09:59
  • @Michael Gorsich They are not. total 60 led, only 12 of those leds are dual color leds, from led 1, 6, 11, 16 and etc. The rest are normal red leds. –  May 21 '18 at 10:04
  • What R and G duty cycle are you using? What's the brigtness of R and G at some given current in the datasheet? – winny May 21 '18 at 10:12
  • I am used to seeing tri-color LEDs that bring only two pins to the outside and you switch polarity for color change. It looks like these LEDs bring all four pins out, so can't you just wire the green and red LEDs in parallel to get yellow? – Michael Gorsich May 21 '18 at 10:12
  • @winny red300MCD, green700MCD; red 620NM green520NM; same 10MA current; They are being switched on/off with the same speed. –  May 21 '18 at 10:24
  • Since you are sharing resistors with multiple LEDs, it could be that the other red LEDs have slightly lower Vf, so they turn on at lower voltages, which in turn prevents the red led on the dual package from lighting up fully. – Wesley Lee May 21 '18 at 10:30
  • Do you ever want the tricolor LEDs to be any color besides yellow? Also, speed and duty-cycle are not the same thing. Did you mean by "same speed" that they are on a 50% duty cycle? – Michael Gorsich May 21 '18 at 10:30
  • @Michael Gorsich plz. These are not tircolor leds, but dual color led ONLY. Red combines with green can only give you yellow color. I think I see the problem now. –  May 21 '18 at 10:32
  • I think this is a semantic difference. Each package can be red, green, or yellow, right? That makes it literally tri-color. Sorry for the confusion. – Michael Gorsich May 21 '18 at 10:34
  • @Michael Gorsich I think you are confused. If you look at the package, they are not common anode nor common cathode, meaning, they are just 2 LEDs, not a tri-color led. –  May 21 '18 at 10:42
  • What do you want to call an LED package capable of three colors so that, in conversation, you can tell the difference between it (three color) and an LED that can only display one color?Also, two-lead tricolor LEDs are neither common anode, nor common cathode (which would be the same thing when there's only two leads). – Michael Gorsich May 21 '18 at 10:50
  • Wait, what? How are you pulling up/supplying Vcc to the LEDs? If green is 700 mCd (m for milli, M for mega) and red is 300 mCd, you need much less duty cycle for the green to make them mix as yellow. Try 3/7 = 43 %. – winny May 21 '18 at 11:30

1 Answers1

1

Closely related to this Q&A.

Our eyes are more sensitive to green; if the LEDs are equally efficient, you need about twice the current in Red in order for them to appear equally bright, which will presumably generate a good yellow.

A first step will be to experiment with a single LED and two current sources (or variable resistors or two PWM channels on your MCU) to find what relative currents or ON periods give the colour you want.

A second step would be to generate that current ratio somehow; perhaps with a larger resistor in series with Green and a smaller one with Red. Or connect the LEDs in antiphase and drive them one way round for green, another for red, adjustable in software. Or some other means according to the hardware or software changes yo uare willing to make.