Still not very good at transistors

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Still not very good at transistors

Postby Snipeye » Wed Feb 22, 2012 12:21 am

If you know (of) me at all, this is a recurring problem - I think I figure them out, spend a while away from electronics, end up needing to figure them out again. Here's some calculations I've done:

Screen shot 2012-02-21 at 10.15.13 PM.png
Screen shot 2012-02-21 at 10.15.13 PM.png (46.72 KiB) Viewed 750 times


So, correct me if I'm wrong at any point.

I'm using a shift register to control a bunch of LEDs, but they need more than 6 mA which is all the shift register can provide. So, the shift register outputs 6mA, and the that goes through a resistor to drop the voltage, then into the base. The VCC is 5v, so the Ve can be 4.2V (not saturated) and 168mA if the load is only 25ohms resistance?

Gah, this is frustrating. I've read a hundred guides, and they all spell it out like it's so simple an idiot can do it, but whenever I try to go to digikey and select a transistor for my project, I can't seem to understand it at all.

Help me? I spit out those numbers because that's what the sheet says, but how can I figure them out without an NPN transistor calculator? it's just.... frustrating.
Snipeye
 
Posts: 156
Joined: Thu Feb 25, 2010 9:03 am

Re: Still not very good at transistors

Postby mwilson » Wed Feb 22, 2012 6:56 am

Things like this I usually just breadboard to start. The kind of current driver you could use is:
Image

A plain unswitched LED would just have +5, the LED, and the 220R resistor to ground to limit current. You can add a transistor switch between the 220R and ground.

IMHO the best way to understand transistors is as current amplifiers. A current flowing from the Base to the Emitter enables a much larger current to flow from the Collector to the Emitter. How much larger is set by the Beta of the transistor -- 50 in your calculator, typically 100 to 300 in the 2N3904 I'm using. When you connect +5 to the terminal at the Base, current flows through the 1K5 resistor and the Base/Emitter junction. I measure this as 2.8 mA on the bench here. That will allow the 2N3904 to conduct something like 280 to 840 mA through the Collector (it won't actually do this because of the 220 ohm resistor, good, because the 2N3904 is only rated to 200mA.) I measure the actual Collector current through the 220 ohm resistor at 14 mA.

Increasing the Base resistor from 1K5 to 10K doesn't change the LED current at all -- the 220 ohm resistor really dominates that, but the Base current drops to 0.42 mA; this is the current your shift register has to supply.

I don't usually "select" switching transistors. I just look for bargains on "typical" switchers like 2N3904 or 2N5401 .
mwilson
 
Posts: 39
Joined: Sun Oct 23, 2011 10:17 am
Location: Toronto, Canada

Re: Still not very good at transistors

Postby uoip » Wed Feb 22, 2012 4:58 pm

As a rule of thumb (to which there can be exceptions, but not very many) don't assume any particular value of beta when designing a transistor circuit. Most well designed circuits should work equally well with a transistor that has a beta anywhere between 50 and 200, with no change in any other component values. The beta of a transistor isn't a very precisely controlled parameter, anyway.

The circuit mwilson described is the right one to use for a generic "NPN transistor as a switch" application. A relatively small current from the base to emitter allows a much larger current to flow from the collector to the emitter. Choose a resistor on the base to deliver a current in the range of half a milliamp to five mA, and the collector will sink more than enough milliamps to drive an LED, bringing the collector down within a fraction of a volt of ground. Choose a resistor on the collector sized to get the desired current through the LED.

You can certainly do a more sophisticated analysis and modelling of the transistor if it helps, but it may just confuse things. All you really need to know is that a small current through the base to emitter allows a large current to go from collector to emitter, where "small" and "large" are different by a factor of somewhere around 50 to 200.
uoip
 
Posts: 127
Joined: Wed Sep 23, 2009 4:48 pm

Re: Still not very good at transistors

Postby Snipeye » Thu Feb 23, 2012 11:40 pm

These answers and that diagram have helped immensely! Thank you!

I understood (and now better understand) the general function of a transistor a lot better, but I'm still a little confused when it comes to selecting one on digikey - what whould my voltage collector-emitter breakdown be? Saturation? Etc - am I better off just not worrying about those and going with a general use transistor like the ones you listed?
Snipeye
 
Posts: 156
Joined: Thu Feb 25, 2010 9:03 am

Re: Still not very good at transistors

Postby sgomes » Fri Feb 24, 2012 2:34 am

I'm not sure what happened to my post on this subject but here goes again...

Use your favorite search engine to look for "logic-level FET". If you are interested in just using a transistor as a switch they can't be beat. Start with something like a 2N7002. Connect the gate to your IO pin. Connect the source to ground. Connect your LED with series resistor to the drain. Done. No VBEs. No betas. No base currents. No saturation. Just high/low - on/off.
sgomes
 
Posts: 4
Joined: Wed Nov 30, 2011 5:11 pm

Re: Still not very good at transistors

Postby uoip » Fri Feb 24, 2012 2:12 pm

There's nothing wrong with the logic level mosfet approach, and it may be easier sometimes. Each approach has its plusses and minuses. For turning on an LED, either approach will certainly work, and the mosfet might even be easier. But if you're careful about limiting inrush current into the gate capacitance, you need a resistor on the gate, so the final parts count ends up equal. I'll stick to the original NPN approach for now.

I'm still a little confused when it comes to selecting one on digikey


Understandable: Here are some rules of thumb to narrow down the process

1. For semiconductor physics reasons, NPN generally works better than PNP, so choose an NPN transistor by default, unless you have a reason to choose PNP. (See the TV-B-Gone for an example of a legitimate reason to use a PNP transistor -- it's used to switch a bunch of NPN transistors, and doing it this way spreads a large current load over many transistors).

2. When digikey presents you with too many choices, click the "in stock" button and sort the list by quantity available. This will give you an idea of the popular general purpose parts versus the rare esoteric devices. Take the precise rankings with a grain of salt of course, but unless you know you have a good reason to do otherwise, you probably want to choose a part that's reasonably high on the popularity list.

3. For general hobby use and ease of breadboarding, you probably want a TO-93-3 through hole package, so a filter on that will eliminate surface mount devices (if you're mass producing via automated assembly, or if you want the tiniest miniaturization, go with SMD).

4. As a general purpose NPN switching transistor, you won't go far wrong with a 2N2222 or 2N3904. Choose one, buy a hundred for your parts bin and you're set until you have unusual requirements.

Don't let any of these general shortcut rules discourage you from downloading data sheets, reading them, and understanding as much as you can. Data sheets are your friend, and learning how to read them will be very helpful if you want to progress from the "tinkering and hacking" stage into the "understanding and carefully designing" stage.


For the specific parameters you asked about:

The ce breakdown voltage tells the maximum voltage the transistor can handle between its collector and emitter without letting out smoke. This should be comfortably higher than the maximum voltage your circuit will present between the collector and emitter. Most general purpose transistors will be able to handle 30V or more easily, so unless your supply is higher than this, you don't need to worry about it.

"Vce saturation" tells you something about how ideal the switch is. When a transistor is fully "on" (in saturation), to a crude first approximation, you might think of it as having the collector and emitter shorted together. But to refine this crude approximation, you can think of it as the transistor maintaining this "Vce saturation" voltage between the collector and emitter. (You can still further refine this crude approximation by looking at the data sheet). The remaining parts of your load will only see your supply voltage LESS this Vce saturation voltage. This may become more important if you're running at a low supply voltage.
uoip
 
Posts: 127
Joined: Wed Sep 23, 2009 4:48 pm

Re: Still not very good at transistors

Postby Snipeye » Fri Feb 24, 2012 9:26 pm

That was a VERY useful explanation, thank you SO much!

I thoroughly enjoy helpful communities such as this, because now I understand it - again, thank you!
Snipeye
 
Posts: 156
Joined: Thu Feb 25, 2010 9:03 am


Return to General Project help

Who is online

Users browsing this forum: No registered users and 4 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [108]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[31]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[34]
LCDs & Displays[48]
Components & Parts[70]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[111]
 
Wireless[14]
Cables[62]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]