Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Bi-Colour LED coontrol with one pin?

2006-03-02 by Russell Shaw

Peter Gargano wrote:
> I can't figure this out simply. I'm sure there is a simple solution 
> tho'. Chip is the Mega-168 that I want to add an extra function to.
> 
> Assume I have either a two or three pin bi-colour LED (ie. either back 
> to back LEDs with two pins, or two LEDs with a common pin).
> 
> I have a single pin on an AVR processor that can either be LOW, HIGH, 
> or Tri-state.
> 
> I want to drive the LEDs either both OFF, one on, or the other on, but 
> NOT both on.
> 
> SO, I have three states the pin can be in, and three states for the 
> LED to be in.
> 
> I can't figure out a simple circuit to drive the LEDs with just one 
> processor pin. Does anyone have any ideas how to do it using no more 
> than two transistors? I'm using Vcc=5 Volts and I have a free 2 Volt 
> (low current) reference point I can use.
> 
> I'd be most appreciative of a solution. BTW, the solution cannot use 
> PWM or anything processor intensive. The spare pin is either and ADC 
> input or an I/O pin.
> 
> Alternative solution: can anyone suggest how I can use the RESET pin 
> as an output and still retain ISP capability (this is a QFP part that 
> is programmed after assembly).
                                        +5VCC
                                  --+----------+--
                                    |          |
AVR                                |c   NPN   >
---+       LEDs                     \|b__     < 10k
    |     +-->|---+                  /|   |    >
    |pin  |       |     220ohms     |e    |    |
    +-----+       +-----\/\/\-------+     +----+
    |     |       |                 |e    |    |
    |     +--|<---+                  \|b__|    >
---+                                /|        < 10k
                                    |c   PNP   >
                                    |          |
                                ----+----------+---- GND

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.