Shop OBEX P1 Docs P2 Docs Learn Events
Anyone ever drive a dual color LED that has only 2 pins ? — Parallax Forums

Anyone ever drive a dual color LED that has only 2 pins ?

grasshoppergrasshopper Posts: 438
edited 2008-10-23 11:23 in General Discussion
I want to use a 3mm dual color LED but some have only 2 pins. How is it possible? Here is the data sheet of an LED that I am considering

www.lumex.com/pdf/SSF-LXH4RAHGW.pdf

Comments

  • TeslaTesla Posts: 55
    edited 2008-10-20 19:38
    Bipolar? just a thought
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-20 22:23
    These turn red if connected one way (+-) and turn green if connected the opposite way (-+). The simplest way to use them is to connect them between two I/O pins with one series resistor (to limit current). A 220 or 330 Ohm resistor will work. Then make one I/O pin HIGH and the other LOW. To get the other color, make the first I/O pin LOW and the other HIGH. To turn off the LED, make the I/O pins both the same.
  • grasshoppergrasshopper Posts: 438
    edited 2008-10-20 23:53
    I was thinking this was the way to do it Mike. Thanks for clearing this up. Also how did you know about this, more specifically how do I learn more about this. I spend most of my days reading data sheets that often have no mention of the basics. Is this suppose to be common knowledge? If so my schooling never mentioned this stuff.
  • StarManStarMan Posts: 306
    edited 2008-10-20 23:55
    If you haven't made your purchase yet,·consider getting the type with three pins.· The third pin is a common cathode or common anode.· Then you can get green with one I/O pin, red with the other I/O pin, or yellow with both I/O pins simultaneously.



    Chris I.
  • mojorizingmojorizing Posts: 249
    edited 2008-10-21 00:56
    Refer to this link for an option to drive a bi-colored LED

    http://forums.parallax.com/showthread.php?p=742176

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Bad spellers of the world untie!
  • grasshoppergrasshopper Posts: 438
    edited 2008-10-21 01:19
    StarMan said...
    If you haven't made your purchase yet, consider getting the type with three pins. The third pin is a common cathode or common anode. Then you can get green with one I/O pin, red with the other I/O pin, or yellow with both I/O pins simultaneously.



    Chris I.

    Yea I actually got one now. But I was still curious about this particular LED. Thanks all for the information.
  • hippyhippy Posts: 1,981
    edited 2008-10-21 13:33
    In addition to red or green, rapidly alternate high-low to low-high and you get red and green 'together' perceived as an orange/yellow similar to the three-legged tri-colour LED.
  • RDL2004RDL2004 Posts: 2,554
    edited 2008-10-21 16:49
    I used one of those LEDs as a pilot light in a data logger project. When reading or writing to the eeprom I would change it from green to red.

    For example:

    LED1     pin 5
    LED2     pin 6
    
    LED1     HIGH
    LED2     LOW
    
    
    DO
    
         TOGGLE     LED1     'connect pins to the leads of a 2 color/2 pin LED, put
         TOGGLE     LED2     'a resistor between one of the Stamp pins and the LED
    
         PAUSE       500       'change as needed
    
    LOOP
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Rick
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-21 17:26
    grasshopper,
    The datasheets tell you that there's a red LED and a green LED in the same package connected backwards to each other. The knowledge of the behavior comes from knowing how red LEDs and green LEDs behave. They're diodes for example, so they only conduct in one direction and they emit light when they're forward biased. Each has a different forward voltage because they're made of different materials and the forward voltage is material dependent (among other things).
  • kjennejohnkjennejohn Posts: 171
    edited 2008-10-22 06:40
    Hi. I'm curious. If this was connected to a PIC processor, having it across two I/O pins would make sense. A PIC can both sink and source the 20 - 25 mA this seems to demand according to the data sheet. In mojorizing's schematic, we don't see which processor this is driven by on the one lead. The 74HC4049 or -14 may be capable of sourcing or sinking this current, but what of the processor that is not a PIC? Most other processors only source 20 mA, or supply only 2 mA either way. Am I correct in saying this idea could only work with a PIC? Or another processor capable of sinking/sourcing 20 mA? How is it going with your testing so far, Grasshopper?

    Have a good project!
    kenjj
  • hippyhippy Posts: 1,981
    edited 2008-10-22 12:14
    @ kjennejohn : Yes, with the bi-colour LED between two I/O lines one will be sourcing the other sinking the same current, so current is limited to whatever the lower source or sink current is. Providing neither are exceeded then this will work on any micro. If more current needs to be sourced than can be sunk then this will not work with such a micro.

    Two I/O lines driving a bi-colour LED works with the Propeller.

    Don't forget that a LED doesn't have to be provided with the current 'it demands', it can be current limited to whatever can be sourced or sunk but it will be less bright than it could be.
  • MSDTechMSDTech Posts: 342
    edited 2008-10-23 11:23
    Grasshopper,
    Look at the "What is a Microcontroller" book on the Parallax downloads page. There is a chapter "ACTIVITY #5: USING CURRENT DIRECTION TO CONTROL A BI-COLOR LED" on page 60 of the book that describes the same type LED you are describing (its included in the What is a Microcontroller kit).
Sign In or Register to comment.