Two LEDs on one Pin


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2005
    Posts
    96

    Default Two LEDs on one Pin

    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

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    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.
    Attached Images Attached Images  

  3. #3
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    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.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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.

    Quote Originally Posted by modifyit
    I am having a brain fart on this one.
    I really want to see that one day

    Now if your led is a Bi-Color one... use a spare PWM channel to produce the Third color...
    Last edited by mister_e; - 6th June 2006 at 03:40.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    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.

  6. #6
    Join Date
    Apr 2005
    Posts
    96


    Did you find this post helpful? Yes | No

    Default

    Brain fart dissapated....thanks Melanie!

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Is this a K Type sensor?
    By jessey in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 21st November 2009, 13:55
  2. DS1820 with 16f688
    By jessey in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 23rd May 2009, 05:07
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19
  5. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 17:07

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts