Base resistors for bipolar transistors in Arduino applications.

 Base resistors for bipolar transistors in Arduino applications.



I'm going to disagree with the folks who are calculating the minimum base current you can get away with in the PN2222A BJT. In this application, you want the BJT either cut all the way off, or fully saturated conducting. Operating the BJT in its "active region" would be bad. For the off state, the AVR chip will drive well below 0.4V when sinking hardly any current, so you don't really need that external resistor. But it wouldn't hurt, for peace of mind. 15K would be enough. 2.2K would be ok, no need for anything lower. For saturation, the data sheet says 100 < gain < 300 and the test conditions go up to 50 mA base current. (They don't specify a maximum base current.) So I'm pretty safe shooting for 4 or 5 mA base current, and that would just barely saturate a gain=100 BJT when it's sinking 500 ma. In this design I don't see any advantage in a lower base current. Use a 1K resistor between the AVR GPIO pin and the BJT base. The transistor will either be fully off or fully saturated and able to sink five times more current than the load demands, and it will dissipate less power that way than it would with less base current and a higher C-E almost-saturation voltage. Try it on a breadboard and see. If I'm wrong, tell me. 

https://cdn-shop.adafruit.com/datasheets/PN2222A.pdf

Some fool told me the base resistor is optional. The base-emitter junction in a BJT like PN2222A looks a lot like a small-signal diode such as BAV70 or 1n4148. It will conduct as much current as it can to keep its forward voltage drop less than 1V. The AVR GPIO pin driven HIGH will put out as much current as it can to drive the base higher than that. Do you see the problem? Internet folklore says the AVR GPIO pin is good for 50 mA but you will not get a valid logic level that way. That's the "absolute maximum" current they'll guarantee won't damage the chip. The data sheet is cagey about that, they never tell you a guaranteed minimum current at valid logic levels. Play around with it on a breadboard and you'll find 5 mA is about the limit if you want the pin to swing all the way HIGH and all the way LOW. But you'll get pretty close at 10 ma.

In the circuit shown, say the diode drop is 2V and the CE drop in the transistor is 0.15V.  12 - 2 - 0.15 = 9.85 volts across the 100 ohm resistor.  9.85/100= 98.5 mA.   Just right for a 100 mA laser diode.  


Comments

Popular posts from this blog

RAID1 array for our home theater. LVM + md + ZFS or XFS

Software product web sites suck.