Shop OBEX P1 Docs P2 Docs Learn Events
can somebody tell me about base resistors with bipolar transistors? Thank you! — Parallax Forums

can somebody tell me about base resistors with bipolar transistors? Thank you!

potatofacepotatoface Posts: 23
edited 2013-12-23 09:45 in General Discussion
Hello . I have a microcontroller that outputs about 40mA max and I want to use it to saturate a 2n2222 bipolar transistor gate. usually people install resistors between the pin and the base. For what reason is this? Is it because we are protecting the pin from excessive current flow, or is it to protect the transistor from excessive current at the base so it doesnt overheat? or is there another reason? My electronics book failed to provide me with a good explanation.


thank you
-joe


1715 459 4535

text capable answers as well.

Comments

  • davejamesdavejames Posts: 4,047
    edited 2013-12-21 20:52
    Hello potatoface,

    I don't have a quick answer for you, other than I go here when I need some insight and/or a refresher on certain topics:

    http://www.electronics-tutorials.ws/transistor/tran_1.html
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2013-12-21 21:02
    The B-E junction of a transistor is only about 650mV ... So essentially you need a current limiting resistor so that you do not deliver excessive voltage to the transistor and burn it and/or the I/O of your micro controller up.


    As far as saturation of the transistor, your talking Apples and Oranges, since the saturation is greatly dependent on the load your placing on the transistor (information we don't have from you).

    Also, depending on the hfe (current gain) which is also load dependent 40mA of base current still may not be enough for saturation. Still this is not a good practice, since you will want to give your processor some overhead by not devoting the full 40mA

    Lets start with what you are trying to drive with the 2n2222 transistor first and go from there.
  • al1970al1970 Posts: 64
    edited 2013-12-21 23:52
    Hi:

    The main reason is so the micro works right. Without any resistor in the B-E junction; the B-E junction of the transistor would clamp the micro output to about .6 volts. If the micro output can't go high when it wants to, it will cause all sorts of problems inside the chip. You would be chasing program bugs that aren't really bugs at all.

    Al

    The B-E junction of a transistor is only about 650mV ... So essentially you need a current limiting resistor so that you do not deliver excessive voltage to the transistor and burn it and/or the I/O of your micro controller up.


    As far as saturation of the transistor, your talking Apples and Oranges, since the saturation is greatly dependent on the load your placing on the transistor (information we don't have from you).

    Also, depending on the hfe (current gain) which is also load dependent 40mA of base current still may not be enough for saturation. Still this is not a good practice, since you will want to give your processor some overhead by not devoting the full 40mA

    Lets start with what you are trying to drive with the 2n2222 transistor first and go from there.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-12-22 00:58
    The transistor is operating as a current switching device where the base-emitter current is amplified (hfe) through to the collector-emitter (essentially). You can put that transistor in a 12V automotive circuit to switch a solenoid for instance but if you tried to connect the base directly to 12V you will have one very fried transistor blasted into non-existence as nothing is limiting the current to the base. It's not about voltage, it's about current, so even a good 1.5V battery without current limiting will destroy the transistor. Conversely you could have 100V into the base but suitably current limited without problems.

    Just because the specs on the Prop say "40ma" you can't assume that that is all it is going to supply without any external limiting. In fact that spec is from the "ABSOLUTE MAXIMUM RATINGS" not the operating conditions and that parameter is under "Max. allowable current per I/O pin" - so notice it said "allowable". This has nothing to do with normal operating conditions, it's a bit like knowing that the 747 you are flying in "might" be capable of a barrel roll but even if the plane survived it may have to undergo major maintenance but certainly there will be very undesirable side effects nonetheless, it ain't designed for that.

    As for the 600mV threshold it's a bit like a minimum operating pressure (voltage) for a one-way water valve (NP junction), once it's open it's open and water will flow (voltage clamped) but if you have too much current for it's delicate structure then it will fail. So always make sure the current is limited, don't ever rely on figures such as Absolute maximum ratings as a guide.

    BTW, even if you short the I/O output to ground for instance without current limiting the I/O will still operate normally from the processor's point of view (not necessarily the circuit's) as the output is latched and any read-modify-write instruction reads the state of the outputs from the latch, not the output buffers.
  • Mark_TMark_T Posts: 1,981
    edited 2013-12-22 05:30
    Think of the base of a transistor in common-emitter configuration as having an impedance of 0 ohms and
    it is current-controlled. So you need a resistor to set the current (below the limit for the pin in question).

    Generally old switching transistors like the 2N2222 need about 5 to 10% of the collector current on the
    base to saturate fully, more modern super-beta transistors have much more gain at saturation and saturate
    better, something like 1% to 2% of load current needed on the base... I'd use a modern device if I had the
    choice, much less critical to get right. ZTX450, ZTX851 are my favorites at the moment, the ZTX851 gives
    the performance of a MOSFET upto several amps in a tiny e-line package (well, not as fast, but low
    on resistance).

    Most bipolar transistors have a desultry little section in the datasheet showing saturation parameters for
    2 or may be 3 different load currents, so guesswork is involved (the typical performance graphs don't
    show manufacturing spread alas).
  • potatofacepotatoface Posts: 23
    edited 2013-12-22 10:00
    The B-E junction of a transistor is only about 650mV ... So essentially you need a current limiting resistor so that you do not deliver excessive voltage to the transistor and burn it and/or the I/O of your micro controller up.


    As far as saturation of the transistor, your talking Apples and Oranges, since the saturation is greatly dependent on the load your placing on the transistor (information we don't have from you).

    Also, depending on the hfe (current gain) which is also load dependent 40mA of base current still may not be enough for saturation. Still this is not a good practice, since you will want to give your processor some overhead by not devoting the full 40mA

    Lets start with what you are trying to drive with the 2n2222 transistor first and go from there.

    Ok . this right here is understandable. I have to limit the current and voltage into the bipolar transistor so it doesnt overheat, and also so my prop pins do not burn up. I want the bipolar transistor in saturation regin, and I do have equations that relate the load collector-emitter current and voltage to gain, and that allows you to calculate the Ib and Vb needed when everything else is known.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-12-22 15:32
    potatoface wrote: »
    Ok . this right here is understandable. I have to limit the current and voltage into the bipolar transistor so it doesnt overheat, and also so my prop pins do not burn up. I want the bipolar transistor in saturation regin, and I do have equations that relate the load collector-emitter current and voltage to gain, and that allows you to calculate the Ib and Vb needed when everything else is known.

    It's not about voltage, just limit the current. The gain varies depending upon Ice so don't expect high gain for high Ice, use the graphs as a guide. Generally in a switching situation if I had a fairly typical transistor and I wanted to switched 200ma I would put around 5 to 10ma through the base (R= (Vout-0.6)/Ibe where the Prop's Vout droops with the increased current draw). So I would normally use a 470R base resistor, maybe even 1K, and maybe 220R. Just remember that once you have a resistor in the circuit then it's a very easy matter to experiment with the value.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-12-22 18:51
    Hi Peter;
    Generally in a switching situation if I had a fairly typical transistor and I wanted to switched 200ma I would put around 5 to 10ma through the base
    The spec for the 2N2222A suggests the VCE(sat) between 150mA and 500mA should be operated with a gain of about 10.
    So if IC is 200mA IB should be about 20mA.
    And VBE(sat) can be over 1.2V
    This suggests that if the Prop is supplying the 20mA the resister needs to be:
    Micro_P8X32A_Pin-Source.png (I forgot who did this fine work, sorry?)
    He teaches us the Prop pin output resistance, Rpin, is about 28Ω.
    (VProp - VBE(sat)) / 20mA = RB
    (2.8V - 1.2V) / 20mA = 80Ω
    Ok that is a bit harsh, maybe VBE(sat) will be more like 0.9V:
    (2.8V - 0.9V) / 20mA = 95Ω or 100Ω for a standard value.
    But do experiment with this value somewhat.
    BTW, an alternate calculation method for RB
    VDD = 3.3V
    (VDD - VBE(sat)) / IB - Rpin = RB
    (3.3V - 0.9V) / 20mA - 28Ω = 92Ω or 100Ω for a standard value.

    Note, 20mA is probably near the maximum one should make a Prop Pin drive.

    Duane J
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-12-22 19:22
    Hi Peter;
    The spec for the 2N2222A suggests the VCE(sat) between 150mA and 500mA should be operated with a gain of about 10.
    So if IC is 200mA IB should be about 20mA.
    And VBE(sat) can be over 1.2V
    This suggests that if the Prop is supplying the 20mA the resister needs to be:
    Micro_P8X32A_Pin-Source.png (I forgot who did this fine work, sorry?)
    He teaches us the Prop pin output resistance, Rpin, is about 28Ω.
    (VProp - VBE(sat)) / 20mA = RB
    (2.8V - 1.2V) / 20mA = 80Ω
    Ok that is a bit harsh, maybe VBE(sat) will be more like 0.9V:
    (2.8V - 0.9V) / 20mA = 95Ω or 100Ω for a standard value.
    But do experiment with this value somewhat.
    BTW, an alternate calculation method for RB
    VDD = 3.3V
    (VDD - VBE(sat)) / IB - Rpin = RB
    (3.3V - 0.9V) / 20mA - 28Ω = 92Ω or 100Ω for a standard value.

    Note, 20mA is probably near the maximum one should make a Prop Pin drive.

    Duane J

    My fairly typical transistor is normally a BC817 or a DDTD digital transistor as there is no difference in price compared to a 2222 and these former devices prove superior. However if you take the 2222 to it's extremes then it might need a lower value resistor, but that would be highly unlikely in my experience in a wide range of circuits to require anything less than 220R.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-12-22 20:35
    Hi Jakacki;
    My fairly typical transistor is normally a BC817 or a DDTD digital transistor as there is no difference in price compared to a 2222 and these former devices prove superior. However if you take the 2222 to it's extremes then it might need a lower value resistor, but that would be highly unlikely in my experience in a wide range of circuits to require anything less than 220R.
    But Joe was asking about the 2N2222, probably a 2N2222A. in the hermetically sealed metal TO-18 package.
    You suggested operating at 200mA.
    The BC817 / BC337 is nearly identical to the 2N2222A bipolar except for a lower power dissipation. All of these suggest a saturation current gain of about 10.

    I don't know which DDTD transistor you are referring to but most of these also have a high current saturation current gain of about 10.

    Sure, I violate specifications all the time, but I too have a lot of experience designing stuff.
    When I go beyond the spec I directly test the parts before use.

    However, many on this forum are novices and want to learn how to properly use the parts they have.

    I try to teach how the component specifications are your friend. If they stay within the spec things will go well.

    If I was to show a better way, with different parts, I would almost always suggest the use of MOSFETs. They are superior to bipolar transistors in almost every way. But, again, Joe was asking about the 2N2222A.

    Duane J
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-12-22 21:01
    Hi Jakacki;
    But Joe was asking about the 2N2222, probably a 2N2222A. in the hermetically sealed metal TO-18 package.
    You suggested operating at 200mA.
    The BC817 / BC337 is nearly identical to the 2N2222A bipolar except for a lower power dissipation. All of these suggest a saturation current gain of about 10.

    I don't know which DDTD transistor you are referring to but most of these also have a high current saturation current gain of about 10.

    Sure, I violate specifications all the time, but I too have a lot of experience designing stuff.
    When I go beyond the spec I directly test the parts before use.

    However, many on this forum are novices and want to learn how to properly use the parts they have.

    I try to teach how the component specifications are your friend. If they stay within the spec things will go well.

    If I was to show a better way, with different parts, I would almost always suggest the use of MOSFETs. They are superior to bipolar transistors in almost every way. But, again, Joe was asking about the 2N2222A.

    Duane J

    Sounds like you are taking offence somehow but I did say "if I had a fairly typical transistor" and I wasn't taking it to the extremes though with a current gain of 10, ye gads! Here is a curve for the 817 which isn't quite saturated at Vce=1V but that gives you an idea, it is nowhere near a gain of 10 though.
    Screenshot from 2013-12-23 14:54:19.png
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-12-23 08:47
    Hi Peter;
    Sounds like you are taking offense somehow
    Not really, just attempting to help newbie circuit designers not get into trouble.
    but I did say "if I had a fairly typical transistor" and I wasn't taking it to the extremes though with a current gain of 10, ye gads!
    But all the bipolar transistors we have been discussing, according to their specs, have saturation current gains of about 10. Look it up.
    Here is a curve for the 817 which isn't quite saturated at VCE=1V but that gives you an idea, it is nowhere near a gain of 10 though.
    Screenshot from 2013-12-23 14:54:19.png
    Of course, all the bipolar transistors we have been discussing have similar Linear DC Current Gains. Such as the 2N2222A which Joe was asking about.

    Teachable Moment:
    Most bipolar transistors can be operated in 2 basic modes.
    1. Linear gain region. Often called hfe.
    2. Saturation region. Characterized by relatively low VCE and relatively high IB currents. Often 1/10th of the IC current.

    Why should we choose one design method or the other when designing circuits with these bipolar transistors?
    1. Linear amplifier circuits need good gains to amplify small signals into larger ones. The better circuits use negative feedback networks to limit and linearize the gain response over a wide range of input levels. Generally, the bipolar transistors need to have an hfe substantially higher than the circuit gain over the desired frequency range. The bipolar transistors are not allowed to go into saturation nor cutoff.
    A consequence of running in the linear region is higher power dissipation, not so good.
    Careful circuit design is needed so the transistor remains stable and doesn't self oscillate or ring.
    Oscillations or ringing would be a bad thing and can lead to even higher power dissipation.
    Worse yet, this can cause problems in other circuits.

    2. Switching transistor circuits attempt to operate the bipolar transistor in the saturation or cutoff region. To do this, higher overdrive IB currents are used to ensure VCE is well into saturation providing relatively low voltages and minimize power dissipation in the transistor.
    When in saturation the transistor will not self oscillate.
    Better yet. The bipolar switching transistor circuit with relatively low valued RB resistors switch faster resulting in less power dissipation during the transitions.

    Duane J
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-12-23 08:49
    Well, rather than all the math and theory... here are a few pragmatics.

    A. A bipolar transistor is a sandwich of PNP or NPN material with the Base being the middle of the sandwich. Being in the middle it certainly cannot handle as much voltage or power as the Emitter/Collector junction. So it needs some protection

    B. You microcontroller also needs some protection. Most cannot supply more 20ma at their appropriate voltage without suffering a failure of the i/o pin.

    ~~~~~~~~~~~
    So first.. protect your microcontroller by limiting the current output to below 20ma. In many cases saturation current is far less than that.

    Take a look at the absolute maximum ratings for the 2N2222a to see if you are doing something extreme and damaging. It says the emitter-base will tolerate up to 6 volts, so a 5 volt logic or a 3.3 logic is not going to hurt it.

    Go down the Vbe(sat) figures and you will see that a 15ma, it will provide 150ma of power at Ic. If you wanted 500ma of power, you would need 50 ma which would damage your microcontroller.

    And so...

    If you want a bigger boost of power, you require a different BJT. 150ma is more than enough to drive most relay coils

    Yes you could drive the one pin of the microcontroller at 40ma, but pins are generally grouped for distribution in banks. If you have a bank of 8 pins wired together than can only tolerate 200ma, you aren't going to be able to use all 8 pins simultaneously to get 320ma out of the microcontroller ---- something will break.

    I generally try to not demand more than 5ma of the microcontroller i/o outputs as things just last longer and don't break. There are tiny darlington transistors that will take the 5ma and do very well at providing 1 amp or more of current. But you mentioned the 2n2222a and 'in theory' it will drive about 600ma (probably the 500ma is wiser for long-life use).

    But according to the pdf, your 40ma won't provide 500ma at saturation, you need 50ma. You would need to change to another device.

    ~~~~~~~~~~~~
    In other words, your actual ability to saturate the transistor is dependent on how much you expect to load it. And your ability to saturate the 2n2222a is limited by the i/o pin of the microcontroller.

    You didn't provide a Load figure, so I can't be sure you have the right transistor.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-12-23 09:45
    Hi Loopy;
    Take a look at the absolute maximum ratings for the 2N2222A to see if you are doing something extreme and damaging. It says the emitter-base will tolerate up to 6 volts, so a 5 volt logic or a 3.3 logic is not going to hurt it.
    Ah that is not quite right.

    That VEBO is the reverse voltage that the base emitter junction can safely withstand.
    (Notice it is not VBEO)
    In normal switching circuits, with the emitter grounded, +5V or +3.3V from the micro will never reverse bias that junction. Actually they can only attempt to forward bias the base emitter junction so RB is required to set and limit base current.

    Duane J
Sign In or Register to comment.