PDA

View Full Version : Two LEDs on one Pin



modifyit
- 5th June 2006, 20:30
I'm using a 12F675 for a project and I am looking for a creative way to use 1 pin to control two different LEDs independently. The theory is that 1 led will be on when the I/O is set Low, the other led is on when the I/O is set High, and they are both off when the I/O is set as an input.

Will this work can someone draw me a quick schematic? I am having a brain fart on this one.

Thanks in advance

Melanie
- 5th June 2006, 22:06
Drive PIC pin HIGH and D2 turns on via R2.

Drive PIC pin LOW and D1 turns on via R1.

Set PIC pin to INPUT, and both LEDs are OFF.

Not recommended for Battery driven circuits as there's a current flow through R1/R2 all the time.

Ron Marcus
- 6th June 2006, 00:33
The new high efficiency LEDs can run even with a 2.2K resistor in series. 4.4K is only a little over a mil of draw @ 5 VDC,with both LEDs off. I guess it depends on the brightness you need out of them.Nice,simple circuit Mel.

mister_e
- 6th June 2006, 03:20
Even if it's simple and it should work, can you try something and post the results of what i think, set the PIC i/o to High, Yeah it work... how about the brightness when you remove R1...it should be brighter right? Result should be the same when you set the i/o to low and remove R2?

But i agree, it's working.


I am having a brain fart on this one.

I really want to see that one day :D

Now if your led is a Bi-Color one... use a spare PWM channel to produce the Third color...

Melanie
- 6th June 2006, 07:02
Don't see how things would work if you remove the Resistors... they are there to provide a Potential Difference mid-way between VDD and VSS to which the LEDs are connected (as well as current limiting). If you remove R1 for example then D1 will NEVER turn on. If you short out R1, yes D1 will be very bright, but D2 will never turn on.

modifyit
- 6th June 2006, 13:23
Brain fart dissapated....thanks Melanie! :D

mister_e
- 6th June 2006, 13:32
The only thing i wanted to say, even if it doesn't worth to because it's going to work, is that the current will be splitted between a led AND a resisotr both in 'parrallel'. This just reduce the 'usual' led Brightness produced by a single resistor and LED in serie. Well, it's working, no complaint about that. I already used that method too in one of my project in the past. Using a better efficiency LED, as previously mentionned will solve it if you really need it BRIGHT without stressing too much the PIC i/o.

Everything is fine to me and of course to our friend who asked a simple solution. You can Set one or the other LED, and have the possibility to set both too. Hey what do you want more with a 4 components solution and only 1 PIC I/O?