8
\$\begingroup\$

I'm going to be driving a bank of 20-25 LEDs from a single output of a PIC micro. Obviously, I need a transistor, because that's going to be somewhere in the vicinity of 400 mA (the LEDs are speced at 20 mA with 3.2V of drop, which I'll get close to by using a 100 ohm resistor and a 5V power supply).

I get into trouble when I try to figure out what sort of transistor I should use for this, because I don't understand how transistors are rated. In discussions of general transistors, the 2N3904G & 2N3906G come up as good, all-around NPN & PNP transistors. How do I look at the transistor data sheet and understand that these transistors will work? What parameters do I need to pay attention to? I want to be sure the transistor can handle the load, and I want to be sure that my PIC's output can force the transistor all the way on.

I've got some familiarity with digital electronics, but when we get into the analog world I just don't have enough of a frame of reference yet.

\$\endgroup\$
2
  • \$\begingroup\$ Amp and Volt symbols are both capital letters, btw. Sall v means velocity and small a is a rare tiny prefix. \$\endgroup\$ – XTL Nov 3 '10 at 8:43
  • \$\begingroup\$ Good units: A, amp, V, volt, s (for second) Not units: a, Amp, v, Volt, S (when you think it means second but really means siemen) \$\endgroup\$ – Nick T Nov 4 '10 at 2:35
5
\$\begingroup\$

The 2N2222 might be a better choice - inexpensive, commonly available, handles the current, and overall a good choice for switching.

The spec you want to look at most Icmax, or sometimes just Ic (The 'C' being a subscript) which is the maximum current you'd normally be able to put through a fully turned on (saturated) transistor.

The 2N2222 apparently is popular enough to get its own web domain http://2n2222datasheet.com/ where I found several PDF spec sheets. I see (pun not intended) that Ic is 600mA - you could use one transistor to drive all your LEDs.

Another spec to pay attention to is beta - the current gain. If you're switching 400mA and the transistor has a beta of, say , 100 then you'll need to supply 400mA/100 = 4mA to the base from your digital output. Beta isn't very consistent from transistor to transistor, even of the same type. Just make sure the math works out for the lower end of the beta range when choosing a resistor for the base.

Practically all the other specs aren't of as much importance, not a your low 5V supply, unless you're going to drive the LEDs very fast, e.g. a few MHz.

\$\endgroup\$
3
  • \$\begingroup\$ btw, 'hFE' is another symbol for current gain. \$\endgroup\$ – DarenW Nov 3 '10 at 6:11
  • 5
    \$\begingroup\$ If the variation in beta from transistor to transistor is important to your design, you're doing it wrong. \$\endgroup\$ – Kevin Vermeer Nov 3 '10 at 16:25
  • \$\begingroup\$ When you're looking at current gain, you need to make sure you're looking at what it is in saturation, which is sometimes called hFE, but is not hfe which is for small-signal conditions. \$\endgroup\$ – user1844 Nov 4 '10 at 20:49
3
\$\begingroup\$

You might be better off with a pchannel mosfet (inverted logic out) or low side n-channel mosfet as they will perform will as switches for this type of application, and reduce the voltage drop across the device to be directly proportional to the LED current. With the bipolar transistor the LED current will be proportional to the PIC output current, and you will always lose 0.7 V across the emitter. A mosfet will have a low Rdson which can result in much less losses across the switching device.

For selection purposes you need to know your maximum bus voltage, then double it, to give you margin of error, next look a device with the smallest Rdson for a given voltage and package and cost.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ 0.7V is from base (the resistor connected to the PIC) to the emitter. You can get as low as 0.2V from the collector to the emitter in saturation. \$\endgroup\$ – Kevin Vermeer Nov 3 '10 at 16:19
  • \$\begingroup\$ 'Use a mosfet' is fair advice, but the bit about base and LED current being proportional is not right at all, when the transistor is being used as a switch (i.e. in saturation) \$\endgroup\$ – user1844 Nov 4 '10 at 20:47
1
\$\begingroup\$

For bipolar transistors if you are in ballpark of voltage, current, frequency, then the only critical part is power. And for switching circuit the power is even not that important. So, any part with matching V, I, f and P will do.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.