Author Topic: Bi color LED question  (Read 4549 times)

0 Members and 1 Guest are viewing this topic.

Offline Eco19RTopic starter

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Bi color LED question
« on: June 10, 2007, 06:14:33 PM »
Hey - I had a quick question,

Is there a way to control a Bi color LED with only one pin on a MCU?

I was thinking that you could have it hooked up like this


                                  +5V
                                     |
                                 Resistor
                                     |
MCU-- Resistor--------- >LED>
                                     |
                                 Resistor
                                     |
                                   GND
                           
If the MCU pin was set to input, the led would be off

if the MCU pin was set to high the LED would be one color

if the MCU pin was set to low the LED would be a different color

Would this work?

Thanks for any information you can provide.

Offline 555 timer chip guy

  • Full Member
  • ***
  • Posts: 105
  • Helpful? 0
    • Robots and Circuits
Re: Bi color LED question
« Reply #1 on: June 10, 2007, 10:36:16 PM »
in theory yes but I have been proved wrong before the only sure way to know is
to test it.

Offline frank26080115

  • Supreme Robot
  • *****
  • Posts: 322
  • Helpful? 2
Re: Bi color LED question
« Reply #2 on: June 10, 2007, 11:08:46 PM »
bi color LEDs don't work like the way you are describing, they have two anode leading to one cathode (or vice versa), cathode must always be ground for either to work

if you use a inverter on one pin you can switch between the two using one I/O but you cannot have both off

unless you have one of those weird ones you have to charlieplex, in which case you would still need two I/O to work (your diagram confused me)

what you are discribing is something like two diodes pointing in one direction, in which case you can have either both on, one on, or the other one on, it is impossible to turn it off as if the control pin is high-z state (or input state), current will flow right through both diodes at once
« Last Edit: June 11, 2007, 09:53:17 AM by frank26080115 »

Offline Eco19RTopic starter

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Re: Bi color LED question
« Reply #3 on: June 11, 2007, 12:13:09 AM »
Actually the bi color LED I am referring to only has two leads - its like two LEDS in one connected in parallel with reverse polarities.

Input state = high Impedance = no current would flow through LED,

Low = Current would flow through LED into MCU.

HIGH = Current would flow through LED to ground.

I think it would work - as long as the resistor values are correct.

Can anyone else share any insight into this subject?


Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: Bi color LED question
« Reply #4 on: June 11, 2007, 02:34:08 AM »
it will work if you connect it like this:


                                  +5V
                                     |
                                 Resistor
                                     |
MCU -----------<LED>-----+
                                     |
                                 Resistor
                                     |
                                   GND
                           
« Last Edit: June 11, 2007, 02:35:27 AM by Ro-Bot-X »
Check out the uBotino robot controller!

Offline Eco19RTopic starter

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Re: Bi color LED question
« Reply #5 on: June 11, 2007, 03:10:10 AM »
it will work if you connect it like this:


                                  +5V
                                     |
                                 Resistor
                                     |
MCU -----------<LED>-----+
                                     |
                                 Resistor
                                     |
                                   GND




Thats what I was trying to draw -

I have bad ASCII art.

Also both resistors would be the same Ohm value correct?

Thanks for the help
                           

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Bi color LED question
« Reply #6 on: June 11, 2007, 07:16:35 AM »
if you only want two states, why not just get a normal on/off LED? :P

Offline Eco19RTopic starter

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Re: Bi color LED question
« Reply #7 on: June 11, 2007, 10:21:39 AM »
Its 3 states....

Off,

On with one color,

On with a different color

Also if you  switch back and forth between them at a high speed you get a 3rd color.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Bi color LED question
« Reply #8 on: June 11, 2007, 10:32:45 AM »
well the point i was trying to make is that digital output pins on a MCU only have two states, meaning your LED can only have two states . . . so no reason to have anything other than a two state LED . . . :P

you will need an extra MCU pin to use all three states of a 2 color LED (color A, off, color B)

Offline Eco19RTopic starter

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Re: Bi color LED question
« Reply #9 on: June 11, 2007, 10:39:31 AM »
well the point i was trying to make is that digital output pins on a MCU only have two states, meaning your LED can only have two states . . . so no reason to have anything other than a two state LED . . . :P

you will need an extra MCU pin to use all three states of a 2 color LED (color A, off, color B)

Nope some MCUs have 3 states, High, Low and High Impedance, which is when its set to input

The circuit Ro-Bot-x drew would allow you to control a bi color led with only one MCU pin.

Eh - I am gonna try it and post back what happens,
« Last Edit: June 11, 2007, 10:44:23 AM by Eco19R »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Bi color LED question
« Reply #10 on: June 11, 2007, 10:48:12 AM »
oops I should have read the entire post . . .

I stand corrected :-X, never thought of doing that before . . .

be careful of the power draw through your MCU in the high state . . .

Offline Eco19RTopic starter

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Re: Bi color LED question
« Reply #11 on: June 11, 2007, 10:50:44 AM »
Eh, If I burn a 3 dollar chip I'm not out much, I will post back later and tell you if it works.

Offline Eco19RTopic starter

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Re: Bi color LED question
« Reply #12 on: June 12, 2007, 01:42:13 AM »
Its working great -I can get all 3 states just fine!


Red, Green And off

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: Bi color LED question
« Reply #13 on: June 12, 2007, 06:17:19 AM »
Great! What values did you use for the resistors?
Check out the uBotino robot controller!

Offline Eco19RTopic starter

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Re: Bi color LED question
« Reply #14 on: June 12, 2007, 09:15:44 AM »
I just used two 1k Ohm, Its not super bright but its defiantly visible,


 


Get Your Ad Here

data_list