Re: PIC18 transistor LED drivers

From: Spehro Pefhany (speffSNIP_at_interlogDOTyou.knowwhat)
Date: 10/20/04


Date: Wed, 20 Oct 2004 16:14:06 -0400

On 20 Oct 2004 12:18:52 -0700, the renowned csembro@yahoo.com (Chuck)
wrote:

>Happy Halloween!
>
>Last year I built a collection of plywood pumpkins to stick in the
>yard on Halloween night. I installed superbright LED's in the eyes,
>nose, mouth, etc and was pretty pleased with the results. This year I
>want to animate the LED's.
>
>I bought a DLP-245PL which uses a PIC18LF8720 to drive it's digital
>I/O. I need a simple transistor circuit to drive each LED. There's
>about 22 of them. Typical LED voltage is 2.1V to 3.4V, current ranges
>from 20mA to 30mA.
>
>Last year I was driving the LED's from a simple 12V DC power supply.
>Their cathodes are connected together and to ground. The anodes
>connected to appropriate resistors. For the life of me, I can't
>remember the equations appropriate for switching transistors.
>
>It seems like optoisolators are a bit of overkill. Things I'm worried
>about are the base resistor and transistor selection, and the
>possibility of sending 12V into the TTL outputs of the PIC. It would
>be nice to reuse the transistors I have on hand, which are: 2n2222a,
>tip34, 2n3906.
>
>chuck
                   x------[Rx]----|<|---- +12 (12V)
                   | \\\
                   | LED
                   |
              B |/C
-----[2K7]-------|
                 |\E 2N2222A, 2N4401 etc.
                   |
                   |
0V (5V) -----------x----------------------- 0V (12V)

Only tie the 12V supply ground to the 5V supply ground at one point.
(Do not allow the LED current to flow through the 5V ground circuit).

If you're using 30mA maximum, then a forced beta of 20 would imply a
base current of 1.5mA, so 2.7K is about right.

To calculate Rx, you need to know the LED forward voltage Vf. If
you're not sure, use 2.5 for yellow or green LEDs, 3V for white or
blue, and 2.0 for red.

Then Rx = (12V - Vf)/Iled

Eg. if the Iled is 20mA and the Vf is 3.0V, the equation gives 450
ohms, so round it up to 470R as the closest standard value. The power
disipation is I^2*R = 0.188W, so a 1/4W resistor will suffice for this
kind of application.

Alternately, replace the 2K7s and transistors with ULN2003A/ULN2803
parts to drive 7 or 8 LEDs with one chip.

Best regards,
Spehro Pefhany

-- 
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com


Relevant Pages

  • Re: Very basic transistor usage
    ... >there is network activity and the blue LEDs to light when there is hard ... PNP transistors through the 2.2K resistors. ... current is around 1/10th of what you want to switch, ... Now you have to do the math on the series resistors that limit the current ...
    (sci.electronics.basics)
  • Re: current regulator -- explanation?
    ... I found a circuit for regulating the current through ... It has two transistors with one having the base-collector shorted. ... "LEDs driven by a simple current regulator". ... | VCC VCC ...
    (sci.electronics.basics)
  • Re: Astable Multivibrator help!
    ... In order to guarantee oscillation, you need to add a diode logic OR function which provides base drive only if one OR the other of the transistors is OFF, like shown below, a lock-up cannot occur because there will be insufficient base drive. ... Oddly, with the two diodes, it takes the circuit about 20 seconds to start up. ... the circuit will fire the LEDs up immediately and start the alternation in one or two seconds. ... Even at 9V, which I assume means an alkaline battery that will spend most of its time in the 7.2-8.4V range, you have the caps charging to ...
    (sci.electronics.design)
  • Re: Simple circuit, stupid problem
    ... >>actually pluck the capacitors right out of the circuit and both LEDs ... >>Does anyone have any suggestions as to what stupid mistake I'm making ... But that circuit has a stable non-oscillating state: both transistors ...
    (sci.electronics.basics)

Loading