Re: Newbie transistor question



On 29 May 2006 08:31:07 -0700, "realexander"
<realexander@xxxxxxxxxxxxx> wrote:

Hi,

I'm having trouble getting a transistor to work the way I thought it
should, and I hope someone could help me.

I'm using a PIC to drive common anode 14-segment LEDs. Since the PIC
I/O line can't supply enough current, I'm trying to use a 2N2222
transistor instead. The PIC directly drives the 2N2222's base (no
intervening resistor), the collector is tied to +5 and the emitter to
the common anode. The problem is that, while the LEDs light, they are
very, very dim - only visible in a dark room.

I thought maybe that the PIC wasn't saturating the transistor, so I put
in a pull-up resistor on the base. No difference. I connected the base
directly to +5, and the LEDs were still dim. The emitter shows +4V (5
volts in the collector, 4 volts out the emitter??!!) If I tie the LEDs
common anode to +5, they light up nicely, but of course I can't
multiplex a bunch of LEDs with the anodes tied to +5.

Am I using an inappropriate transistor? Am I using it wrong?

Thanks,
Bob Alexander


eh?

it depends what sort of current your LED requires, but the correctly
configured outputs of PICS are definately capable of directly sinking
and sourcing 25mA - more than enough for most LEDs. The data*** I
have in front of me (16F84) lists "High current sink/source for direct
LED drive" as one of the peripheral features on the over-view page
(with the pin-out diagram of the chip)

Obviously if you are driving something that requires more than 25mA
then you will need to buffer the signal, but not for "normal"
operations.

I drive LEDs direct from PICs with a 150R resistor which gives the LED
20mA - plenty bright enough for most indicators. As a newbie, this is
calculated as supply voltage-2 (the LED will roughly "use" 2 volts
from your supply) divided by current required...
which gives 3V / 0.02A = 150R Ohm's Law.

Why are you driving the anode through the transistor? You should
connect the anode directly to (in this case) +5V and then each segment
should be connected to the PIC pin via a 150R (or so) resistor.
Remember that with a common anode display, you need to drive the pins
in a reverse logic, so set a pin low to light the segment. So in any
output, 1 is seg off, 0 is seg on.

You need to re-do your drive circuit then go back to your code with a
single LED and make sure you can switch it on and off correctly. Then
connect up a segment of your display - with the same results - then
finish off by replicating your control code for all segments - it has
to work. Are you sure you are TRISing the port pins correctly? also,
make sure you have turned off any special features of the pins, i.e.
analogue input ports, PWM etc... Keep it really simple until you have
got control.

Might I also suggest that you take this thread to
sci.electronics.basics
as this group is populated by engineers that like to eat noobs :o)

Best of luck

H


.


Quantcast