EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: redgear on September 23, 2020, 09:18:51 am

Title: How to calculate base resistor for transistor?
Post by: redgear on September 23, 2020, 09:18:51 am
My relay coil is rated 5v and the resistance is 60ohms(+/-10%). So the minimum current I need is 75mA which can go up to 95mA worst case. I am using BC337 (http://www.farnell.com/datasheets/2923271.pdf) transistor. How to calculate the base current required for driving the transistor in saturation mode? The data gives VCE(sat) as <0.7v when IB is 50mA and IC is 500mA. Does that mean the transistor enters saturation when IB > 1/10 IC.

Rb = (V - VBE)/IB

V is 5v and VBE is < 1.2V  when VCE is 1V and IC is 500mA. For 95mA, I need a base drive of 95/10 = 9.5mA, am I correct? My Rb works out to be 400 ohms. Is that correct?

I earlier used a BC547B which required a base drive of 3.75mA, so I chose a 1k resistor. Can I use the same for this?

Thanks
Title: Re: How to calculate base resistor for transistor?
Post by: Ian.M on September 23, 2020, 10:39:28 am
A more comprehensive datasheet may help.  e.g https://www.onsemi.com/pub/Collateral/BC337-D.PDF (https://www.onsemi.com/pub/Collateral/BC337-D.PDF) which has (fig.4) Vce vs Ib curves for various Ic.   Figure out the max Vce you can tolerate, read off the min. Ib for an average BC337,  then scale it up by the ratio of the typical hFE @100mA (from fig.3) to the min. guaranteed hFE (tabulated specs.) + whatever safety margin you deem appropriate.

Assuming you settle for the hard-saturated 'forced-beta' 10:1 rule of thumb, (which is a good place to start unless you *NEED* to reduce the base current e.g. due to needing to drive it from a weak I/O), you'd be looking at 10mA base current (its not worth sweating over the difference between 95mA and 100mA so round it and be happy you've got 5% extra margin), so read off the  (saturated) Vbe from fig.5,  then if your gadget must work at low temperatures, correct it to your minimum operating temperature, with the data from fig.6 which gives a Vbe temperature coefficient of slightly over -1.8mV/degC @100mA Ic, so if for instance you needed to operate down to -25 deg C,  you'd expect an extra 0.1V Vbe. 

You will also need to figure out the worst case 'droop' of your driving voltage source when loaded with your chosen Ib, to get Voh_min.  Subtract (corrected) Vbe from Voh_min to give you the *MINIMUM* voltage that will be across your base resistor.  Then its simply a matter of Ohm's law and dropping in the next lower preferred value resistor.

I cant verify your 400 ohms result unless you specify what's driving it and at what supply voltage.
Title: Re: How to calculate base resistor for transistor?
Post by: redgear on September 23, 2020, 11:47:41 am
A more comprehensive datasheet may help.  e.g https://www.onsemi.com/pub/Collateral/BC337-D.PDF (https://www.onsemi.com/pub/Collateral/BC337-D.PDF) which has (fig.4) Vce vs Ib curves for various Ic.   Figure out the max Vce you can tolerate, read off the min. Ib for an average BC337,  then scale it up by the ratio of the typical hFE @100mA (from fig.3) to the min. guaranteed hFE (tabulated specs.) + whatever safety margin you deem appropriate.

Assuming you settle for the hard-saturated 'forced-beta' 10:1 rule of thumb, (which is a good place to start unless you *NEED* to reduce the base current e.g. due to needing to drive it from a weak I/O), you'd be looking at 10mA base current (its not worth sweating over the difference between 95mA and 100mA so round it and be happy you've got 5% extra margin), so read off the  (saturated) Vbe from fig.5,  then if your gadget must work at low temperatures, correct it to your minimum operating temperature, with the data from fig.6 which gives a Vbe temperature coefficient of slightly over -1.8mV/degC @100mA Ic, so if for instance you needed to operate down to -25 deg C,  you'd expect an extra 0.1V Vbe. 

You will also need to figure out the worst case 'droop' of your driving voltage source when loaded with your chosen Ib, to get Voh_min.  Subtract (corrected) Vbe from Voh_min to give you the *MINIMUM* voltage that will be across your base resistor.  Then its simply a matter of Ohm's law and dropping in the next lower preferred value resistor.

I cant verify your 400 ohms result unless you specify what's driving it and at what supply voltage.
Thanks.
This is seems a bit difficult than what I expected. I think it would be better to go with hard saturation.
Would the specs of both BC337's be the same even if the manufacturers differ? I will driving it from a microcontroller. 5v will be the supply voltage.
Title: Re: How to calculate base resistor for transistor?
Post by: Ian.M on September 23, 2020, 12:30:40 pm
Even if you go for hard saturation and desigh to the forced beta 10:1 rule of thumb, so 10mA Ib, you've still got to work out how much voltage you'll have across the base resistor before you can calculate its resistance, so need reasonably good figures (or pessimistic worst case assumptions) for Vbe and Voh.

'BC337' is a Pro Electron (https://en.wikipedia.org/wiki/Pro_Electron) registered type, so if its from a reputable manufacturer it will at least meet the common minimum tabulated specs for that type.  Typical performance is *NOT* guaranteed, but with only two PN junctions and the minimum specs constraint its pretty hard to FUBAR, so the On-Semi datasheet will be a reasonable guide to what you can expect from other brands if you don't try to push the limits in your design.  OTOH if you've bought remarked Chinese floor-sweepings off Ebay, all bets are off.  You may not even get a small signal NPN transistor, and *IF* its a NPN transistor, even odds it wont have the right pinout!
Title: Re: How to calculate base resistor for transistor?
Post by: Zero999 on September 23, 2020, 12:39:40 pm
The specification for the BC337 varies. It's binned into differnet gain groups, so a BC337-16 will have a gain of 100 to 250 and a BC337-25 a gain of 160 to 400. If you just choose the plain BC337, the gain could be anywhere between 100 and 600.

To answer the original question.  It depends on how saturated it needs to be i.e. what voltage drop across the transistor is acceptable and what current the device driving the transistor can source?

If you want hard saturation, then go with 10mA, but if 1V is acceprable, then you only need 1mA. Practical experiance tells me you won't see that much of a difference in voltage drop, beween an IB of 1mA and 10mA, when IC = 100mA, so I'd use 1mA to save power. In other words, this isn't critical, a base resistor of 1k would be fine.
Title: Re: How to calculate base resistor for transistor?
Post by: Ian.M on September 23, 2020, 12:52:11 pm
Whether or not Zero999's (good) suggestion is acceptable depends on how much margin you have between the min. supply voltage to the relay coil and the relay's minimum operating voltage, and if its a bit close for comfort, that determines  how much Vce drop you can tolerate.   Personally I'd always allow a 50% margin* so wouldn't go below 2mA Ib for a transistor of min. hFE 100 @100mA Ic, even when Vce * Ic power dissipation considerations are not significant.  Also, it only applies to a 'shirtsleeve' environment - you'll get a nasty surprise if you design a circuit that lives in your freezer or has to function outside in winter in arctic conditions if its on the 'bare edge' of acceptable operation at 25 deg C.

 N.B. The relay may not meet specs for contact closure time and contact bounce at minimum operating voltage so if you are switching a high energy load and are concerned about contact burn, you may need to target driving the relay coil with as close as possible to its nominal operating voltage not its minimum.

* i.e. overall system performance can drop by 50% from designed nominal without loss of function.  If you calculate it the other way from bare minimum function, doubling <whatever> would be a 100% increase!  :horse:
Title: Re: How to calculate base resistor for transistor?
Post by: rstofer on September 23, 2020, 02:39:35 pm
Just build it up on the breadboard with a couple of DMMs.  You want to have Ib approximately 1/10th of Ic but most important, you want to drive VceSat as low as possible.  I would be looking for a value down around 0.2V or less.  Look at Figure 5 here:

https://www.onsemi.com/pub/Collateral/BC337-D.PDF (https://www.onsemi.com/pub/Collateral/BC337-D.PDF)

VceSat can be quite low when you run on the Ic/Ib=10 line. Less than 0.1V

Once you have the transistor in saturation (with the actual load), you can measure Ic, VceSat, Vb and Ib.  The resistor is just (Voh-Vb)/Ib.  The thing is, if the Voh is coning from some other device, like a uC, Voh may not go as high as Vcc.  Voh will sag and so will Ib.  That's the reason for breadboarding the setup.  But when you're using Ib=1/10 Ic, you have a lot of latitude.

Frankly, I just use Voh=Vcc, Ib=1/10 Ic and Vbe = 0.7, hoping for VceSat of 0.2V and it seems to work out fine.
Title: Re: How to calculate base resistor for transistor?
Post by: redgear on September 23, 2020, 03:05:37 pm
The specification for the BC337 varies. It's binned into differnet gain groups, so a BC337-16 will have a gain of 100 to 250 and a BC337-25 a gain of 160 to 400. If you just choose the plain BC337, the gain could be anywhere between 100 and 600.

To answer the original question.  It depends on how saturated it needs to be i.e. what voltage drop across the transistor is acceptable and what current the device driving the transistor can source?

If you want hard saturation, then go with 10mA, but if 1V is acceprable, then you only need 1mA. Practical experiance tells me you won't see that much of a difference in voltage drop, beween an IB of 1mA and 10mA, when IC = 100mA, so I'd use 1mA to save power. In other words, this isn't critical, a base resistor of 1k would be fine.

Whether or not Zero999's (good) suggestion is acceptable depends on how much margin you have between the min. supply voltage to the relay coil and the relay's minimum operating voltage, and if its a bit close for comfort, that determines  how much Vce drop you can tolerate.   Personally I'd always allow a 50% margin so wouldn't go below 2mA Ib for a transistor of min. hFE 100 @100mA Ic.  Also, it only applies to a 'shirtsleeve' environment - you'll get a nasty surprise if you design a circuit that lives in your freezer or has to function outside in winter in arctic conditions if its on the 'bare edge' of acceptable operation at 25 deg C.

 N.B. The relay may not meet specs for contact closure time and contact bounce at minimum operating voltage so if you are switching a high energy load and are concerned about contact burn, you may need to target driving the relay coil with as close as possible to its nominal operating voltage not its minimum.

Thank you both. The relay's minimum operating voltage is 3.5v. The supply voltage is 5v. With the 1k resistor I think I can get around 4mA of base drive. The transistor will be driven from relay, so I guess sources upto 10mA will not be an issue. But if the 1k would do the job I won't change the schematic.

Just build it up on the breadboard with a couple of DMMs.  You want to have Ib approximately 1/10th of Ic but most important, you want to drive VceSat as low as possible.  I would be looking for a value down around 0.2V or less.  Look at Figure 5 here:

https://www.onsemi.com/pub/Collateral/BC337-D.PDF (https://www.onsemi.com/pub/Collateral/BC337-D.PDF)

VceSat can be quite low when you run on the Ic/Ib=10 line. Less than 0.1V

Once you have the transistor in saturation (with the actual load), you can measure Ic, VceSat, Vb and Ib.  The resistor is just (Voh-Vb)/Ib.  The thing is, if the Voh is coning from some other device, like a uC, Voh may not go as high as Vcc.  Voh will sag and so will Ib.  That's the reason for breadboarding the setup.  But when you're using Ib=1/10 Ic, you have a lot of latitude.

Frankly, I just use Voh=Vcc, Ib=1/10 Ic and Vbe = 0.7, hoping for VceSat of 0.2V and it seems to work out fine.


Thank You. So, going by your calculations I think the 1k will just do fine.
Title: Re: How to calculate base resistor for transistor?
Post by: rstofer on September 23, 2020, 06:09:14 pm
Thank You. So, going by your calculations I think the 1k will just do fine.

Prove it!  Build it up on a breadboard and get some real measurements.  You could even swap transistors, perhaps keep the readings in a spreadsheet.

All the calculations are important but sometimes there are variances between theory and practice.

Title: Re: How to calculate base resistor for transistor?
Post by: redgear on September 24, 2020, 02:29:11 pm
Thank You. So, going by your calculations I think the 1k will just do fine.

Prove it!  Build it up on a breadboard and get some real measurements.  You could even swap transistors, perhaps keep the readings in a spreadsheet.

All the calculations are important but sometimes there are variances between theory and practice.

Agreed. Will test it out on the breadboard.
Title: Re: How to calculate base resistor for transistor?
Post by: rstofer on September 24, 2020, 07:21:52 pm
Thank You. So, going by your calculations I think the 1k will just do fine.

Prove it!  Build it up on a breadboard and get some real measurements.  You could even swap transistors, perhaps keep the readings in a spreadsheet.

All the calculations are important but sometimes there are variances between theory and practice.

Agreed. Will test it out on the breadboard.

You will learn far more from the experiments than you will from some dry equations.  The equations are critical, no doubt, but they don't make the same mental impact as real measurements and the thought process behind why they are what they are.

I used to use a resistance substitution box for this kind of thing.  I could change the resistance with a rotary switch

https://www.amazon.com/Elenco-Resistance-Substitution-Range-Precision/dp/B0002KX76M (https://www.amazon.com/Elenco-Resistance-Substitution-Range-Precision/dp/B0002KX76M)

Any of the choices will work


Title: Re: How to calculate base resistor for transistor?
Post by: Doctorandus_P on September 25, 2020, 11:47:53 am

I actually prefer the much smaller seven decade PCB thingies with 0.1" wire jumpers:
https://html.duckduckgo.com/html?q=aliexpress+Seven+Decade+Programmable+Resistor+Board (https://html.duckduckgo.com/html?q=aliexpress+Seven+Decade+Programmable+Resistor+Board)

Especially if you also get some wire jumpers with extra long tabs to grab with your fingers, but I always have tweezers around when working with electronics, so not such a big deal for me.

Those big boxes are unwieldy when working with breadboards.

Tip:
For working with breadboards, glued a big Lego base plate on a piece of MDF, and I glued some thin 2x4 to 2x 12 strips on the bottom of all kinds of components, such as the breadboard itself, programmers, USB hub, Resisor substitution PCB, screw connector terminals, BBB, and other stuff that's just to big or unwieldy for on the breadboard itself. This prevents relative movements between all those parts and makes breadboarding much more reliable. You can also pick up the whole thing and put it in the closet for the next weekend or evening.
Title: Re: How to calculate base resistor for transistor?
Post by: rstofer on September 25, 2020, 02:26:51 pm
That substitution board is pretty nice - I bought a couple from Amazon

https://www.amazon.com/Electronics-Salon-1R-9999999R-Programmable-Resistor/dp/B01CZLPAOM (https://www.amazon.com/Electronics-Salon-1R-9999999R-Programmable-Resistor/dp/B01CZLPAOM)

They get here a lot faster, I buy from Amazon nearly every day, but they are twice the price as buying direct from China.  It's a choice...