### Author Topic: Transistor Calculations  (Read 14954 times)

0 Members and 1 Guest are viewing this topic.

#### ShaunLeeClarke

• Contributor
• Posts: 14
• Country:
• Hi from Melbourne!
##### Transistor Calculations
« on: July 01, 2012, 10:03:39 am »
Hello everyone.

I've recently started playing around with the Arduino platform which has been a great experience.

One of the things I have learned about is using transistors to switch larger loads from the digital outputs on the Arduino.

My question is, how does one determine the value of the resistors which drive the transistors base?

So far, everything I've seen uses a standard 1K resistor between the Arduino output pin and the transistors base, but I have also seen very lengthy (and confusing) articles which explain how to calculate the correct resistor value. For example: http://www.ermicro.com/blog/?p=423

My question is, what is the correct practice when using a transistor in this application?
Full time IT/AV tech from Melbourne VIC Australia. Newbie to electronics here to learn and maybe meet some friends .

#### IanB

• Super Contributor
• Posts: 8400
• Country:
##### Re: Transistor Calculations
« Reply #1 on: July 01, 2012, 10:13:19 am »
It depends on the gain of the transistor (hfe on the data sheet).

For instance if you apply 5 V to a 1 k base resistor you will get a base current of about 5 mA. If the gain were 100 you would obtain a collector current of about 500 mA. For smaller transistors this is about as much as they could handle without overheating. For more current than that you would want a second power transistor after the first with greater capacity. (Look up Darlington transistor to see how that works.) The reason you might not use a single power transistor alone is that the gain of power transistors is typically lower than for small switching transistors and the Arduino might not be able to provide enough base current by itself to fully turn on a high power transistor.
I'm not an EE--what am I doing here?

#### Psi

• Super Contributor
• Posts: 6325
• Country:
##### Re: Transistor Calculations
« Reply #2 on: July 01, 2012, 10:19:39 am »
A transistor has a gain, (check datasheet of transistor for actual value) but lets say its 100
This means the current through the collector to emitter needs to be 100x the current through the base to emitter ground to turn the transistor fully on.

So if you want your transistor to switch 1A you will need 1A/100 = 0.01A or 10mA to flow into the base.
However, its not quite that easy because we want more current available to the base to account for errors in things, like temperature and gain error etc.. We want to be absolutely sure the transistor will turn fully on because otherwise it will burn off heat unnecessarily.

So if you aim for say 2-5 times the current really needed that will insure it works in all conditions.
For this example 5x 10mA = 50mA.
If you're driving the base from 5V then you need 5V/0.05A = 100R resistor.
An arduino/micro cannot supply 50mA on its I/O pins so you either need a transistor with more gain or a 2nd transistor to boost the power for switching the primary transistor. (or you could use a fet instead, which work differently)

As a rule of thump,
little to92 transistors are often around 100-300 gain
to220 around 50-150
to-3 maybe 10-40
But there are exceptions, so you need to check the datasheet for the transistor you're using.
Such as a Darlington transistor as IanB mentioned, which have very high gain.
« Last Edit: July 01, 2012, 10:30:26 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)

#### free_electron

• Super Contributor
• Posts: 6802
• Country:
##### Re: Transistor Calculations
« Reply #3 on: July 01, 2012, 11:09:37 am »
A lot of people have given the long-winded answer.
People earlier in the post have given you a formula but these are not really correct. the transistor is non-linear and you really need to look in the curves. you can't really ride it that hard as the equasions give you.
The fact of the matter is that manifacturers will tell you the base current necessary for the transistor to be saturated.
If a transistor is saturated the connection between collector and emitter is a s good as it will get. keeping increasing the base current does nothing apart from warming up the transistor.

you can find this parameter in the datasheets. it is typically given under Vcesat. the saturation voltage for the collector emitter. they will note the conditions.

for a BC847 : http://www.nxp.com/documents/data_sheet/BC847_BC547_SER.pdf
Code: [Select]
Page 6VCEsat collector-emitter saturation voltageIC = 10 mA; IB = 0.5 mA - 90 200 mVIC = 100 mA; IB = 5 mA - 200 400 mV  <- this is what you need
the last line is what you want.
if you want this particular transistor , which's max collector current is 100mA to be full on you need a base current of 5mA.

now , to calculate the resistor : take the output high voltage of the processor. typically 5 volts... substract the forward voltage of the BE junction at saturation, which you find on that same page 6 the line below :

Code: [Select]
VBEsat base-emitter saturation voltageIC = 10 mA; IB = 0.5 mA - 700 - mVIC = 100 mA; IB = 5 mA - 900 - mV   <- this is the one
in this case 0.9 volt.

so we have 5 volts ( cpu out ) - 0.9 volts ( Vbesat ) = 4.1 volts.
and we need 5 mA. so 4.1 volts / 5 mA gives you roughly 820 ohm. !K will work equally fine , but the transisotr will not be full-on as good as it could be in this case.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).

#### codeboy2k

• Super Contributor
• Posts: 1838
• Country:
##### Re: Transistor Calculations
« Reply #4 on: July 01, 2012, 05:19:26 pm »
Those numbers on the datasheet are the manufacturer test conditions.  The methods given above for finding the needed base current using the Hfe are still sound.

One thing that free_electron said, that people should heed, is look at the curves.

Quote
...the transistor is non-linear and you really need to look in the curves

This is the most important thing to take away from this thread. You can't just use the Hfe value from their characteristic  tables.  I've seen too many websites do that.  For example, the BC847 linked has Hfe of between 90 and 170 for just 2uA of collector current, and between 180-520 typical for 2mA collector current. I've seen people use these numbers for any current, and it doesn't work that way, "the transistor is non-linear"

So, for 100mA collector current, when you look at the curves, you see at room temperature the Hfe is just 80.

Then 100mA collector current with Hfe=80 is 100/80 = 1.25mA base current. minimum. But manufacturing processes cause slight differences, and you should never use this minimum current. so, the rule of thumb was devised: multiply the base current you get using the Hfe by 2x up to 5x , as Psi said. In this case choose 4.  4 x 1.25mA = 5mA. And 5mA is exactly the test current used in the manufacturers tables on page 6.  So in their test, they used the rule of thumb too. And yes, it will guarantee saturation at 100mA collector current.

free_electron also mentions Vbe(sat) This is important, especially at lower voltages like 3.3, 2.7, 1.8 I/O devices.  Lots of websites online ignore Vbe(sat).  At higher voltages you can probably ignore it because you've already factored in enough extra current by bumping the base current by 2-5 times more than calculated.

But at these  lower voltages you'd be best not to ignore Vbe(sat), because now it's a larger percentage of the available base voltages. In this case, at 100mA collector current, and 5mA base currnet, the Vbe(sat) is 900mV.  If you are using a 1.8V device, it's more than 50% of your voltage budget, so you can't ignore it anymore.

(do they make a transistor with a Schottky B-E junction?  I've never used one, but it would be useful as voltages get lower. Maybe we go back to germanium now)

#### ShaunLeeClarke

• Contributor
• Posts: 14
• Country:
• Hi from Melbourne!
##### Re: Transistor Calculations
« Reply #5 on: July 01, 2012, 06:00:53 pm »

The particular transistor I am looking at using is the 2N2222 as it seems quite popular with Arduino projects. I'm looking at the datasheet here: http://www.jaycar.com.au/products_uploaded/KSP2222A.pdf.

Here is an extract from the datasheet.

Is my reading correct in that applying a 15mA base current will allow 150mA through the transistor while applying 50mA to the base will allow the full 500mA to flow through the transistor?
Full time IT/AV tech from Melbourne VIC Australia. Newbie to electronics here to learn and maybe meet some friends .

#### notsob

• Frequent Contributor
• Posts: 611
• Country:
##### Re: Transistor Calculations
« Reply #6 on: July 01, 2012, 06:14:23 pm »
IF you wish to learn more about transistors, Georgios Lazaridis has a series on transistor theory and another on basic transistor circuits on his site, PCBHeaven.com

http://www.pcbheaven.com/wikipages/Transistor_theory/

http://www.pcbheaven.com/wikipages/Transistor_Circuits/

#### digsys

• Supporter
• Posts: 1598
• Country:
##### Re: Transistor Calculations
« Reply #7 on: July 01, 2012, 08:08:46 pm »
Quote
Is my reading correct in that applying a 15mA base current will allow 150mA through the transistor while applying 50mA
to the base will allow the full 500mA to flow through the transistor?
This stuff is confusing, and the posts are probably not helping :-) .. not that there's anything technically wrong.
How I would approach it is this (from those specs) -
1/ Lets ignore voltage drops for now - from the hFe table : If I want Ic = 150mA, I need Ibase 150mA/100x = 1.5mA
That's for a BAD transistor. For a GOOD transistor I only need 150mA/300x = 0.5mA
- Notice though, that IF I want more or less Ic, the hFe (gain) varies quite a bit, so IF I wanted MORE Ic, I'd use the
WORSE value hFe @ 500mA as example. Generally you use the TYP figure, and check 1-2 from the batch you bought.
In actual fact, this is a pretty cr@ppy transistor at low Ic, you can find much better.
Even it's Vce sat is lousy.
If you're selecting a transistor PURELY as a SWITCH device, these are the only 2 specs you really care about (oh and VCE breakdown),
otherwise it becomes more complex (NOT harder really). You need to juggle some of the other specs as well.
Hello <tap> <tap> .. is this thing on?

#### ShaunLeeClarke

• Contributor
• Posts: 14
• Country:
• Hi from Melbourne!
##### Re: Transistor Calculations
« Reply #8 on: July 01, 2012, 10:17:25 pm »
It seems there are two ways of working out the right base current. One would be to fully saturate the transformer, and the other would be to saturate it enough for the load I'm trying to switch.

What is the downside of fully saturating the transformer instead of calculating the base current? I'm guessing it wouldn't be as efficient?

Looking at the datasheet, I'm lost as to which figures I should be using to calculate both the Vce(sat) (as per my previous post) and the hFE.

For example, the hFE has 5 different values. How do I determine which one to pick?

They all have a Vce of 10V and varying Ic values.

The load I am trying to control is a 12 volt relay which has a 16.7mA rating @ 12V.
Full time IT/AV tech from Melbourne VIC Australia. Newbie to electronics here to learn and maybe meet some friends .

#### T4P

• Super Contributor
• Posts: 3706
• Country:
##### Re: Transistor Calculations
« Reply #9 on: July 01, 2012, 10:32:02 pm »
It means that if the gain is set at 10 and the Ic is at 500mA, Ib at 50mA
the collector-emitter junction will saturate at 1V
Which means that at 500mA and 50mA base current the most you can get pass 1V before it "locks up" and can't pass more then 500mA even at 51mA

Base-emitter junction is also similar...
You can push 2V through the base before it once again "locks up"
at 500mA and Ib at 50mA

#### codeboy2k

• Super Contributor
• Posts: 1838
• Country:
##### Re: Transistor Calculations
« Reply #10 on: July 01, 2012, 10:38:02 pm »
Is my reading correct in that applying a 15mA base current will allow 150mA through the transistor while applying 50mA to the base will allow the full 500mA to flow through the transistor?
Yes.

It seems there are two ways of working out the right base current. One would be to fully saturate the transformer, and the other would be to saturate it enough for the load I'm trying to switch.

What is the downside of fully saturating the transformer instead of calculating the base current? I'm guessing it wouldn't be as efficient?

The excess current goes out through the emitter (assuming an NPN).  The emitter internal resistance can be about .23 ohms if I remember correctly (it's way more complicated to actually calculate it, because it a dynamic value). Here's a simplified way to look at it.

If your calculations say you need 10mA, and you give it 3x as much, 30mA, but the silicon only really needs 15mA, then you will waste 15mA and send it out the emitter.  15mA excess across the emitter internal resistance adds aprox 3.75mv to the B-E junction drop. P=I^2*R, so the excess 15mA out the emitter wastes 51.75uW of power and contributes to device heating.

Quote
Looking at the datasheet, I'm lost as to which figures I should be using to calculate both the Vce(sat) (as per my previous post) and the hFE.

For example, the hFE has 5 different values. How do I determine which one to pick?
Always pick the worst one(the minimum). You never know what your actual transistor will be.
Sometimes they bin them into A, B, C class, and each class has a min/typical/max.
So if you have a BC847A then use the A class, and its min Hfe.

Quote
They all have a Vce of 10V and varying Ic values.
Those are just listed so you know the manufacturers test conditions.
Quote
The load I am trying to control is a 12 volt relay which has a 16.7mA rating @ 12V.

so you need to switch 16.7mA.  Divide this by the lowest Hfe, which is 35. Some people use the typical Hfe, but I don't like to.
so 16.7mA / 35 = 0.477 mA.  Multiply x5 for safety, and you have 2.4mA base current is needed to fully switch on 16.7mA collector current.

the x5 factor guarantees that no matter which 2n2222 you use, which manufacturer, which country it was made in, how they differ from one another, no matter what, it will always work as you designed it.
« Last Edit: July 01, 2012, 10:43:16 pm by codeboy2k »

#### SeanB

• Super Contributor
• Posts: 14663
• Country:
##### Re: Transistor Calculations
« Reply #11 on: July 01, 2012, 10:44:21 pm »
You need to look at the current the load draws. In your case 16mA, so probably best to base it on 20mA as that will be easier to read off the graph ( you will have a tolerance in any case due to different relays, temperature and of course the transistor will vary with time and temperature as well). So with an average transistor gain of 100 ( most of the 2N2222 will hopefully be more than this at 20mA, but you might get the one that was a close to limit device) the required base current will be in the order of 200 uA to turn it close to fully on. Taking the figure of thumb of 5times then you want to drive it with 1mA of base current. At 5V this means a resistor of around 5K, and if you take voltage drops into consideration ( both the Vbe of the transistor and the unstated high voltage of the micro which can be as low as 3.8V at a supply of 5V) a resistor value of 3K3 will do.

You can thus use almost any value lower than this, so any resistor from around 1k to 3K3 will work in this case, to drive a 20mA load. Tradeoffs are that higher current loads need more drive current, thus with the 33K resistor if you have a 40ma load there is a good likelihood that the transistor will not be saturated at all, but will still be driving the load with enough current to turn it on, though the transistor will likely be a little warmer than if it was saturated. The reason that most use 1K is that you are free to use any load up to the 800mA rating of the 2N2222, without worrying that it will be out of saturation.

Edited as i dropped a decimal point in the initial estimation.
« Last Edit: July 01, 2012, 10:54:24 pm by SeanB »

#### digsys

• Supporter
• Posts: 1598
• Country:
##### Re: Transistor Calculations
« Reply #12 on: July 01, 2012, 10:53:30 pm »
Quote
It seems there are two ways of working out the right base current. One would be to fully saturate the transformer (transistor),
and the other would be to saturate it enough for the load I'm trying to switch.
Don't worry, it DOES get easier with practice. Also, learning by "text message" is very slow and inefficient. If you want to pursue this
field, you should try to find a human interaction method. Maybe a tutor from a local college etc
It doesn't matter a whole lot how much over % you drive the transistor. It can be 200% - 1000%. We were just showing you the theory
of "how it works", so you could always design it yourself in future.
The limitation here is the MAX current the CPU / IC pin can deliver. You don't want to run it at MAX if you can avoid it. So, assume the
CPU pin can deliver 10mA max (the specs will be available), then I'd say I'll chose a resistor for 5mA max. Looking at your table,
worst case hFe is app 50, so with that transistor I have 50x5mA=250mA drive capability. You only need ~20mA, so it's HEAPS.
You can 1/2 the resistor current (X2 the value) and you'd still have plenty to spare.
Quote
What is the downside of fully saturating the transformer instead of calculating the base current? I'm guessing it wouldn't be as efficient?
Yes, but we're talking SAY 5V (CPU voltage?) x 2-3mA wasted =~ 15mW. If that's too high, then drop the base drive current further or
pick a better transistor, higher hFe.
Quote
For example, the hFE has 5 different values. How do I determine which one to pick?
You pick the closest Ic to what you want to switch. If you will switch a RANGE of Ic s, then pick the WORST case hFe
Quote
They all have a Vce of 10V and varying Ic values. The load I am trying to control is a 12 volt relay which has a 16.7mA rating @ 12V.
The 10V is just an example, the only time you need to look at the Vce max is if you're going to switch a high voltage.
Hello <tap> <tap> .. is this thing on?

#### MikeK

• Frequent Contributor
• Posts: 577
• Country:
##### Re: Transistor Calculations
« Reply #13 on: July 02, 2012, 01:03:33 am »
All really good information here.  I would just add two things.  If you need to restrict load current, then use a load resistor.  Trying to match the base current to the load current is futile.  That's what saturation is about...you push it beyond the exact value.  Also, make sure you have a protection diode at the relay!

#### free_electron

• Super Contributor
• Posts: 6802
• Country:
##### Re: Transistor Calculations
« Reply #14 on: July 02, 2012, 06:51:10 am »
people... you are making it waaaay to difficult. allt hose calculations are not required
Ideally you would look this up in the curves. but sadly manufacturers in many cases no longer publish those ....

For a transistor in saturation mode usage only one things matters:
- the base current required to get the trasnsitor in full conduction (saturation). Like i said earlier that is stated in the datasheet under the testconditions. They typically list two conditions, one at the maximum collector current , one at half or 1/4 of the maximum current.

For an 2n2222 the max current is 600mA , but you wont get that without artificial cooling.

So , for a collector current of 500mA you need a base current of 50mA. The beta (sometimes calle hFE) for a 2n2222 is very low , especially at higher currents it collapses to snot..
If you know that your load is more in the order of 100mA you can take the other scenario : they give the base current for a maximum of 150mA as well.

There is some transistor physics at work that is not easily castable in equations. A transistor in saturation has extreme nonlinear gain behavior if you modulate the collector current.
If you keep a b-e current of 15 mA and you drive up the collector-current the gain will collapse and VCE will rise very quickly. This has to do with the balance of the doping between the BE and CB junction and the physical construction. the recombination area in saturation is so full of electrons that they start rejecting each other... so VCE shoots up. You need to 'pull' harder on the base to keep em from assembling in the emitter. the collector potential in saturation is actually lower than the base potential ! ( Vbe is 0.7 volt while Vce can go as low as 0.2 volts.. ). in Saturation hFE does no longer apply.... the equasion is invalid. some manufacturers will actually specify a hfe1 and hfe2. hfe2 is when you are driving the transisotr pretty hard... hfe1 may be 150 .. 200 while hefe2 can go a s low as 10 for the same transistor.

If you really want to find out the optimum : use  a curvetracer and measure it. but that too is overkill. simply go by the manufacturer standard. they have done the test.

it is possible that with a 15mA base current and a 500mA collector current the VCE reaches maybe 5 volts... resulting in a fried transistor because you are trying to burn off 2.5 watts in that case with an Rtja of maybe 150 to 200 for a to-92 body ... that thing hits 500 degrees internally !

As collector current goes up you will need to pump in more base current. it's as simple as that.

So in short : look at what current your load draws , look under VCEsat in which category you fall and pick the appropriate base current given. done.
no need to complicate.
for low-voltage designs keep in mind that the vbe goes up as Ibe increases so you may need to tweak your series resistor.
and for large collector current you will need large base currents... make sure your chip can drive that .... a 2n2222 is an old piece of junk with crappy performance...

Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).

#### Hero999

• Super Contributor
• Posts: 9924
• Country:
##### Re: Transistor Calculations
« Reply #15 on: July 08, 2012, 07:25:40 pm »
Don't forget it's also temperature dependant, the HFe and saturation will be lower at higher temperatures. If the base current is a little low at the ambient temperature, the saturation voltage will go down, providing the transistor is left on for long enough to warm up.

#### ShaunLeeClarke

• Contributor
• Posts: 14
• Country:
• Hi from Melbourne!
##### Re: Transistor Calculations
« Reply #16 on: July 08, 2012, 08:12:40 pm »
Firstly, thank you to everyone who has contributed to this thread.

I'm having trouble with these calculations, and I'm obviously missing something - but I can't see it.

It has been said that a 1K resistor at 5V will saturate the transistor. According to ohms law, I=V/R, I=5V/1000ohms, I=0.05A or 5mA - nice and low and perfect for an Arduino to drive.

But according to the datasheet, for the transistor needs 50mA to be fully saturated which just doesn't seem right not to mention the Arduino wouldn't cope with that.

What have I done wrong?
Full time IT/AV tech from Melbourne VIC Australia. Newbie to electronics here to learn and maybe meet some friends .

#### codeboy2k

• Super Contributor
• Posts: 1838
• Country:
##### Re: Transistor Calculations
« Reply #17 on: July 09, 2012, 10:34:44 am »
Firstly, thank you to everyone who has contributed to this thread.

I'm having trouble with these calculations, and I'm obviously missing something - but I can't see it.

It has been said that a 1K resistor at 5V will saturate the transistor. According to ohms law, I=V/R, I=5V/1000ohms, I=0.05A or 5mA - nice and low and perfect for an Arduino to drive.

Where has it been said?

Quote
But according to the datasheet, for the transistor needs 50mA to be fully saturated which just doesn't seem right not to mention the Arduino wouldn't cope with that.

What have I done wrong?

I don't think you've done anything wrong.  Why do you want to fully saturate the transistor, if you are not switching 500mA?

And saturation simply means that at 50mA, no matter how much MORE base current you try to push into it, you can not get anymore than 500mA collector current. But you don't need 50mA base current if all you want to switch is a 16mA LED, or a 50mA relay, etc.

From that 2N2222 datasheet, you also saw this:

Quote
Is my reading correct in that applying a 15mA base current will allow 150mA through the transistor while applying 50mA to the base will allow the full 500mA to flow through the transistor?

Yes, you are correct. 15mA base current will allow you to switch up to 150mA collector current, and 50mA will saturate it at 500mA.

That's why everyone has been trying to tell you to use the Hfe numbers, or the datasheet charts if it's there.
For example, if the hfe is 30, then 5mA base current will theoretically switch up to 150mA, but you usually want to de-rate that by multiplying the base current needed x 3 (to switch 150mA) . So 5mA x 3 (derating factor) = 15mA base current for 150mA guaranteed 99.99%.

With only 5mA base current available (because of the 1k), then you can derate in the other direction, which means that  you can only guarantee 99.99% to switch about 150mA/3 = 50mA.

so 5ma can switch 50mA with that 1k on the Arduino. That's all you can guarantee, 99.99%, with a 2N2222.

I keep saying 99.99% because you can be sure that it will do it, but there might be 1 transistor out of 10000 that cannot.

And yes, you can use the Vce(sat) shown on the datasheet (15mA for 150mA), so you can try to put 15mA into the base from your Arduino, but excess is wasteful, why do it if you don't need to. If you only need to switch 15mA, or 20mA, then you don't need 15mA of base current.

#### ShaunLeeClarke

• Contributor
• Posts: 14
• Country:
• Hi from Melbourne!
##### Re: Transistor Calculations
« Reply #18 on: July 09, 2012, 07:38:32 pm »
codeboy2k,

This is the part which confused me:
The reason that most use 1K is that you are free to use any load up to the 800mA rating of the 2N2222, without worrying that it will be out of saturation.

I think it's starting to make sense now.

Others were saying that if I was using the transistor purely as a switch, then all I had to worry about was the current required to saturate the transistor. But this doesn't seem to practical if I want to drive the transistor from a micro such as the Arduino as it requires more current than the Arduino will provide (50mA).

OK, so I'll try a calculation...

My load is a 12V relay that draws 16.7mA and say I want to drive it from a 5V trigger.

Looking at the hFE table, I presume I would base it on the 10mA hFE of 75.

So, 16.7mA / 75 = 0.22mA.

If I triple this for some buffer - it gives me 0.66mA.

So, with ohms law, R=V/I, R=5V/0.00066A = ~7K5.

Am I good so far?

I know I have to select a preferred resistor value also, but I found this website handy for that:
http://www.electronics2000.co.uk/data/itemsmr/res_val.php

I'm assuming a 5% standard 1/4W resistor will be fine. and 7K5 is a standard E24 value. How does this sound?
Full time IT/AV tech from Melbourne VIC Australia. Newbie to electronics here to learn and maybe meet some friends .

#### SeanB

• Super Contributor
• Posts: 14663
• Country:
##### Re: Transistor Calculations
« Reply #19 on: July 10, 2012, 02:18:02 am »
Correct, and it will work.

#### Mint.

• Frequent Contributor
• Posts: 523
• Country:
• Account is inactive now. Thanks everybody!
##### Re: Transistor Calculations
« Reply #20 on: July 11, 2012, 10:06:26 am »

-other portion of text-

OK, so I'll try a calculation...

My load is a 12V relay that draws 16.7mA and say I want to drive it from a 5V trigger.

Looking at the hFE table, I presume I would base it on the 10mA hFE of 75.

So, 16.7mA / 75 = 0.22mA.

If I triple this for some buffer - it gives me 0.66mA.

So, with ohms law, R=V/I, R=5V/0.00066A = ~7K5.

Am I good so far?

I know I have to select a preferred resistor value also, but I found this website handy for that:
http://www.electronics2000.co.uk/data/itemsmr/res_val.php

I'm assuming a 5% standard 1/4W resistor will be fine. and 7K5 is a standard E24 value. How does this sound?

Is this how electrical engineers design circuits with transistor switches in them, is this the proper method to calculate the values or does this one have some downsides to it?
EDIT: Can I also point out where you do ohms law to find the base resistor, I think you have to use 5v-0.7v instead of just 5v, can somebody else also confirm this?
« Last Edit: July 11, 2012, 12:41:43 pm by Mint. »
Personal Blog (Not Active Anymore), Mint Electronics:
http://mintelectronics.wordpress.com/

#### IanB

• Super Contributor
• Posts: 8400
• Country:
##### Re: Transistor Calculations
« Reply #21 on: July 11, 2012, 04:16:02 pm »
Can I also point out where you do ohms law to find the base resistor, I think you have to use 5v-0.7v instead of just 5v, can somebody else also confirm this?

When you're going to multiply the base current by a factor of 3 it scarcely makes any difference.
I'm not an EE--what am I doing here?

#### Mint.

• Frequent Contributor
• Posts: 523
• Country:
• Account is inactive now. Thanks everybody!
##### Re: Transistor Calculations
« Reply #22 on: July 15, 2012, 10:24:35 am »
Is this how electrical engineers design circuits with transistor switches in them, is this the proper method to calculate the values or does this one have some downsides to it?
Personal Blog (Not Active Anymore), Mint Electronics:
http://mintelectronics.wordpress.com/

#### codeboy2k

• Super Contributor
• Posts: 1838
• Country:
##### Re: Transistor Calculations
« Reply #23 on: July 15, 2012, 12:06:19 pm »
Is this how electrical engineers design circuits with transistor switches in them, is this the proper method to calculate the values or does this one have some downsides to it?

For basic saturated switching, yes, this is the way it's done.

Although from the postings in this thread, you've seen it can be done actually 3 different ways
1) using just the test values from datasheets, i.e. Vce(sat) usually shown at a few different test currents
2) using the charts (find the collector current you need, scan across the chart to get the base current needed)
3) using the Hfe(min) or Hfe(typ) values.  Some people use the typical values, others prefer the minimum values.

then adding 2x to  3x more base current than actually calculated, "just to be safe" and to cover all the variability in manufacturing or sourcing equivalent parts from different manufacturers.

As for the ohms law question, calculating the base resistor using  ( 5V - 0.7V  ) is actually more correct, but it usually doesn't matter, if your base voltage is high enough, since you will always multiply the calculated base current by 2x or 3x anyways. So using 5V or (5V - 0.7V ) is not an issue.  Give it a try, and convince yourself that in the saturated switch case, it doesn't matter, especially after you just take the base current calculated x2 or x3 anyways.

It does start to matter when you have much lower base voltages. So if your base voltage was 1.0V, then 1.0V is much different than (1.0V - 0.7)=0.3V. And if you wanted 15ma base current, you can see the difference here in the calculations:

R=E/I = 1.0 / 15ma = 66 ohms,  or
R=E/I = 0.3 / 15ma = 20 ohms

So if you ignored the Vbe drop of 0.7V and used the first equation, and put a 66 ohm resistor there, using a 1.0V base voltage, you would have an actual base current of I=E/R = (1.0 - 0.7) / 66 = 4.5ma and the switch would probably not turn on enough to supply the needed collector current. So at lower base voltages you can't take such liberties.  At higher base voltages there is usually enough wiggle room that it can be safely ignored.

The other time when you shouldn't ignore the Vbe drop is in amplifier design, where you are not making a simple current switch, and are actually trying to use the transistor in it's forward biased active region.

#### Mint.

• Frequent Contributor
• Posts: 523
• Country:
• Account is inactive now. Thanks everybody!
##### Re: Transistor Calculations
« Reply #24 on: July 15, 2012, 02:18:29 pm »
Is this how electrical engineers design circuits with transistor switches in them, is this the proper method to calculate the values or does this one have some downsides to it?

For basic saturated switching, yes, this is the way it's done.

Although from the postings in this thread, you've seen it can be done actually 3 different ways
1) using just the test values from datasheets, i.e. Vce(sat) usually shown at a few different test currents
2) using the charts (find the collector current you need, scan across the chart to get the base current needed)
3) using the Hfe(min) or Hfe(typ) values.  Some people use the typical values, others prefer the minimum values.

then adding 2x to  3x more base current than actually calculated, "just to be safe" and to cover all the variability in manufacturing or sourcing equivalent parts from different manufacturers.

As for the ohms law question, calculating the base resistor using  ( 5V - 0.7V  ) is actually more correct, but it usually doesn't matter, if your base voltage is high enough, since you will always multiply the calculated base current by 2x or 3x anyways. So using 5V or (5V - 0.7V ) is not an issue.  Give it a try, and convince yourself that in the saturated switch case, it doesn't matter, especially after you just take the base current calculated x2 or x3 anyways.

It does start to matter when you have much lower base voltages. So if your base voltage was 1.0V, then 1.0V is much different than (1.0V - 0.7)=0.3V. And if you wanted 15ma base current, you can see the difference here in the calculations:

R=E/I = 1.0 / 15ma = 66 ohms,  or
R=E/I = 0.3 / 15ma = 20 ohms

So if you ignored the Vbe drop of 0.7V and used the first equation, and put a 66 ohm resistor there, using a 1.0V base voltage, you would have an actual base current of I=E/R = (1.0 - 0.7) / 66 = 4.5ma and the switch would probably not turn on enough to supply the needed collector current. So at lower base voltages you can't take such liberties.  At higher base voltages there is usually enough wiggle room that it can be safely ignored.

The other time when you shouldn't ignore the Vbe drop is in amplifier design, where you are not making a simple current switch, and are actually trying to use the transistor in it's forward biased active region.

Thank you!
Personal Blog (Not Active Anymore), Mint Electronics:
http://mintelectronics.wordpress.com/

Smf