Searching \ for 'Driving LEDs' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: piclist.com/techref/displays.htm?key=leds
Search entire site for: 'Driving LEDs'.

Truncated match.
PICList Thread
'Driving LEDs'
1996\06\06@013039 by Onat Ahmet

flavicon
face
       > I would suggest an easy remedy to this is to use a bipolar LED
       one of
       > the two-lead red/green types, available at Radio Shack or any
       mail-order
       > electronics house) connected as shown:
       >
       > Gnd----[220ohm]---+---[220ohm]----+5
       >                   |
       >                   +---[LED]------- Port pin
       >
       > that this can be a useful trick for driving more than one
       "independently-
       Hmmm, I was having a discussion about bipolar LED's driven by PIC
       pins in
       one of my classes I'm teaching this summer just this morning. The
       objective
       was to drive 6 bi-polar LEDS (2 pin) using as few PIC port pins as
       possible.
       Each LED should be able to show red,green,yellow, and off.

       The design I hit upon after thinking a bit revolved around
       multiplexing
       the 6 LEDs utilizing a common pin on one side. Something like:

        Port pin---+-[220ohm]--+---[LED]------  Port pin
                   |
                   +-[220ohm]--+---[LED]------- Port pin
                   |
                   +-[220ohm]--+---[LED]------- Port pin
                   |
                   +-[220ohm]--+---[LED]------- Port pin

       And so on. One led can be selected by tristating all but one port
       pin
       on the right side. The selected LED's color can be picked by
       twiddling
       with the left port pin and the one non-tristated port pin.

Actually, I think there is nothing new under the sun really ;)
If you know about LED sign boards, this is how they work! You
seem to have simplified it into a single line! (the initial
poster did it down to a single pixel!) I think it is a nice idea
though!

       The question that popped into my mind during this design discussion
       was the relevance of the position of the resistor. Does it matter if
       the resistor is on the anode or the cathode side of an LED.

       BAJ

Theoretically both are identical. You don't need to put a resistor
to both ends of a bipolar LED either. I do not know how this setup
works with high frequencies (well, we have seen radio beacons
recently), so I cannot comment on that... (Not that many people would
drive their LED's at these frequencies!)

Is there any "catch 22" to this?


| Ahmet ONAT  Kyoto Univ. Japan                                 |
| E-mail    : spam_OUTonatTakeThisOuTspamkuee.kyoto-u.ac.jp                           |
| WWW page  : http://turbine.kuee.kyoto-u.ac.jp/staff/onat.html |
|             My 6 leg walker, RC airplanes & more in home page |

1996\06\06@031027 by Keith Dowsett

flavicon
face
>        the 6 LEDs utilizing a common pin on one side. Something like:
>
>         Port pin---+-[220ohm]--+---[LED]------  Port pin
>                    |
>                    +-[220ohm]--+---[LED]------- Port pin
>                    |
>                    +-[220ohm]--+---[LED]------- Port pin
>                    |
>                    +-[220ohm]--+---[LED]------- Port pin

Hi,

  the problem with this design arises when you want all four LEDs running.
If we allow for 10mA through each LED the common pin has to source and sink
40mA. According to the 16C5X data sheet in front of me the specification is
sink 25mA and source 20mA. In addition to which there are limits on total
currents for each port, and for the total device.

One way around this is to use the common pin to drive a pair of transistors
but that increases the part count and we are still faced with a 40mA per
port limitation. Perhaps someone has a better solution.

Keith.
==========================================================
Keith Dowsett         "Variables won't; constants aren't."

E-mail:      .....kdowsettKILLspamspam@spam@rpms.ac.uk
Phone:       0181-740-3162
Fax:         0181-743-3987

Snail mail:  MRC Clinical Sciences Centre, Cyclotron Unit.
                Hammersmith Hospital. London W12 0NN.

1996\06\06@135517 by Byron A Jeff

face picon face
>
> >        the 6 LEDs utilizing a common pin on one side. Something like:
> >
> >         Port pin---+-[220ohm]--+---[LED]------  Port pin
> >                    |
> >                    +-[220ohm]--+---[LED]------- Port pin
> >                    |
> >                    +-[220ohm]--+---[LED]------- Port pin
> >                    |
> >                    +-[220ohm]--+---[LED]------- Port pin
>
> Hi,
>
>    the problem with this design arises when you want all four LEDs running.

I definitely do not want all four LEDs running at the same time. That defeats
the original spec which is that each bi-polar LED can have a color independant
of the others. If all four are driven simulteanously then only two of the
possible 4 colors can be achieved (One color and off).

The plan is to multiplex them: i.e. turn on one LED at a time with the corrent
color, show that color for a while, turn that LED off and move on to the next
one which can be turned on with a completely different color. If you do this
fast enough, the eye blends the flashing LED's into a solid (but dimmer)
color.

And as Rick Miller pointed out in another post, with careful programming
it's not even necessary to have one resistor per led but one resistor
period. The current will only flow through the LED activated. And it seems
that the order of the LED and resistor isn't important. That's good to know.

> If we allow for 10mA through each LED the common pin has to source and sink
> 40mA. According to the 16C5X data sheet in front of me the specification is
> sink 25mA and source 20mA. In addition to which there are limits on total
> currents for each port, and for the total device.

I'd pull the full 20ma through the currently activated LED.. It's only one
LED, not all 6 that turn on at once so there's no need to limit the current to
10 ma
>
> One way around this is to use the common pin to drive a pair of transistors
> but that increases the part count and we are still faced with a 40mA per
> port limitation. Perhaps someone has a better solution.

Correct. If brightness is a real problem (and in this application it isn't)
then each port pin would have to drive a transistor pair. But that raises
the next question: Can a transistor pair be tri-stated? If so how would you
do it?

Thanks for the reply,

BAJ

1996\06\06@212913 by Steve Hardy

flavicon
face
{Quote hidden}

A transistor buffer can be tristated using only one output port, providing
that the output leakage is insufficient to bias either transistor.  In the
case of leakage, beware that the following circuit divides the output
impedance by the transistor beta (approximately).

                  Vcc
                  /
          -------|NPN
         |        \
port -----|         +---- out
         |        /
         --------|PNP
                  \
                  GND

(Geez I hate ascii graphics).  The emitters are tied together.  The output
follows the state of the port (High, Low or hi-Z).  The only problem is that
to output is no longer that good old rail-to-rail CMOS swing.  Instead,
the output falls short of the supply by one Vbe. (about 0.6V).

The available current is the port current times the transistor beta; in
practise limited by the allowable transistor collector current - approx 500mA.

One question I have is whether the datasheet limitations for port current
may be exceeded if a reduced duty cycle is used.  E.g. for continuous
operation 25mA is OK, is 100mA OK for 25% duty cycle?  My guess is
probably not due to excessive voltage drop in the output drivers due to
FET channel resistance, however it would be interesting to experiment.

Regards,
SJH
Canberra, Australia

1996\06\07@104539 by Mark K Sullivan

flavicon
face
>A transistor buffer can be tristated using only one output port, providing
>that the output leakage is insufficient to bias either transistor.  In the
>case of leakage, beware that the following circuit divides the output
>impedance by the transistor beta (approximately).

Won't your circuit hold the port pin

1996\06\08@162506 by Dwayne Reid

flavicon
face
>                   Vcc
>                   /
>           -------|NPN
>          |        \
>port -----|--/\/\/-+---- out
>          |        /
>          --------|PNP
>                   \
>                   GND
>

>SJH
>Canberra, Australia
>

Steve - if you add a 10K resistor from bases to emitters, leakage becomes
MUCH less of a factor.

Dwayne

1996\06\09@072743 by David Knell

flavicon
face
[diagram snipped]

>Steve - if you add a 10K resistor from bases to emitters, leakage becomes
>MUCH less of a factor.

And, if the Vbe drop is a problem, you can swap the transistors over,
resulting in output swinging to the rails - Vce(sat) (typically 0.2-0.3V).

                    Vcc
                    /
           -------|PNP
           |        \
port -/\/\/ +        +---- out
           |        /
           --------|NPN
                    \
                    GND

This has a disadvantage that it can't be tristated & that both transistors
are turned on during switching, resulting in potentially large amounts
of current being drawn.

Rearranging like this:

                       Vcc
                 +--+-----
                 |  |
                 /  |
                 \  /
           --/\/\+-|PNP
           |        \
port -------+        +---- out
           |        /
           --/\/\+-|NPN
                 \  \
                 /  |
                 |  |  GND
                 +--+-----

with about a 5:1 ratio between the series resistors and the B-E
resistors ought to be OK for a 5V Vcc.  Your resistors need to
be large enough for the standing current drawn to be acceptable,
and small enough so that there's enough base drive to the transistors.

I guess that another worthwhile observation is that the PIC port
outputs cease to swing rail-rail as soon as you draw any current;
I think I remember measuring one at something like Vcc-0.4 V when
sourcing 4mA.  The original circuit adds a further 0.7V drop to this;
the one above should be generally oblivious to such things.

Dave
------------------------------------------------------------
David Knell
Tel: 01843 846558
Fax: 01843 846608
E-mail: .....daveKILLspamspam.....dave-ltd.co.uk

1996\06\10@184335 by Dwayne Reid

flavicon
face
OUCH, Dave!

>And, if the Vbe drop is a problem, you can swap the transistors over,
>resulting in output swinging to the rails - Vce(sat) (typically 0.2-0.3V).
>
>                     Vcc
>                     /
>            -------|PNP
>            |        \
>port -/\/\/ +        +---- out
>            |        /
>            --------|NPN
>                     \
>                     GND
>

NO! NO!  BOTH transistors will immediately destroy themselves with VCC
anything above 2Vbe!  Note: each emitter-base junction is forward biased and
with the bases tied together, it doesn't matter what the port pin is doing!
Its crispy critter time!  Using individual base resistors is barely better
since stored charge means that both transistors will conduct during the
switching transition.

{Quote hidden}

This is somewhat better - but you will still have a problem during the
switching transition where both transistors are conducting at the same time.
This WILL cause an enormous current glitch on your power supply.

>
>I guess that another worthwhile observation is that the PIC port
>outputs cease to swing rail-rail as soon as you draw any current;
>I think I remember measuring one at something like Vcc-0.4 V when
>sourcing 4mA.  The original circuit adds a further 0.7V drop to this;
>the one above should be generally oblivious to such things.

The original circuit should swing to within about 0.8v since the current
drawn from the port pins is Io/beta - assuming typical 2n4401 / 2n4403
transistors with gain of about 100 at 200 mA - even at 200 mA output that is
only about 2 mA from the port pin.

If you modify your circuit to include some current limit, it will work without
collapsing your supply.

dwayne

1996\06\11@051224 by David Knell

flavicon
face
>OUCH, Dave!

[duff circuit snipped]

>NO! NO!  BOTH transistors will immediately destroy themselves with VCC
>anything above 2Vbe!  Note: each emitter-base junction is forward biased and
>with the bases tied together, it doesn't matter what the port pin is doing!
>Its crispy critter time!  Using individual base resistors is barely better
>since stored charge means that both transistors will conduct during the
>switching transition.

Err - I guess that's probably what I meant to draw.  I'll go and touch the
hot end of my soldering iron (that's the one with the metal point on, isn't
it?) with a finger to simulate the result of the above.

{Quote hidden}

Erm - will it?  With the port pin mid-rail (on its way up or down) both
transistors have a Vbe of about 0.4V & are therefore turned off, which is
the same state as with the port pin tri-stated.  Whether there is a period
when they both conduct will depend on the slew rate of the driving pin, the
amount of stored charge on the transistor's BE junction and the value of the
resistor between base and emitter.

Dave


'Driving LEDs'
1998\01\31@075248 by Mike DeMetz
flavicon
face
For driving 1 to 51/2  7 segment(and DP) common cathode displays
take a look at the Motorola MC14489. This CMOS chip directly controls
the displays with only one resistor to set current limit. It has a 3
wire SPI serial interface. Has circuitry to minimize EMI and software
dimming. Using something called BitGrabber it determines by the
number of bits written wether the code sent is control or data.
They can be cascaded. Also can be used to drive up to 25 discrete
LEDs.

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...