Posts: 66
Joined: Sun Apr 07, 2013 2:14 pm

Simple transistor question

Sat Jan 04, 2014 12:28 pm

Very simple question - I'm using a transistor to drive an LED. I have the LED wired in series with a 390 ohm resistor, and I've got a p.d. across the LED ~1.2V. Powered by a 6V battery pack. Meaning I've got a current of about 12mA (so let's say I work on 15mA), and I don't want this to be reduced by adding the transistor.

The transistor I'm using is the BC548B. It tells me the hFE has a minimum value of 200 and a maximum of 450. Which one of these do I use? Anyway this would give me a minimum required base current of 33uA, and a maximum of 75uA.

So this base current will be supplied by my Pi, and given that the output voltage is 3.3V, the calculations say I should put in around a 44k limiting resistor (based on a 75uA base current). Somehow this doesn't sound right... Am I right? If not where have I gone wrong?

Thanks, circuit diagram is shown below
circuit diagram.jpg
circuit diagram.jpg (27.82 KiB) Viewed 1669 times
Last edited by JizzaDaMan on Sat Jan 04, 2014 12:51 pm, edited 1 time in total.

Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Simple transistor question

Sat Jan 04, 2014 12:50 pm

That sounds right, but you wouldn't do that. Here's a blog post from someone else figuring out the same thing:
http://www.sqlskills.com/blogs/paulsele ... stors.aspx

In practice you'd use some small-value resistor from your junk box like 1k, 2k2, 4k7 or something.

Posts: 66
Joined: Sun Apr 07, 2013 2:14 pm

Re: Simple transistor question

Sat Jan 04, 2014 1:05 pm

Thanks :) so I've got a 5k24 resistor and it seems to be lighting the LED brightly so I'm happy with that :)

Posts: 3526
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Simple transistor question

Sat Jan 04, 2014 2:44 pm

Oops I erased the previous post since I was wrong.

B.T.W. the resistor you choose is perfect. but change the 390 ohm to 300..330 ohm for 15 ma.

This is the correct calculation

The transistor gain Hfe gives you an expecting range. It is very good when you design analog device. In digital , you use the Hfe to figure out the minimum current you need to have. But in reality you always but more current because you want to drive the transistor full ON or OFF, not in the middle

Put even 10 times the current needed on the base is not an issue. Just need to calculate the power dissipation with
(IB * VBE) + (IC * VCE)

If you check the speck http://www.farnell.com/datasheets/11802.pdf

You use the transistor in ON/OFF way , you will need to look at the VCE saturation which tell you that it is typical at 0.09 V for 10 ma and 0.2V for 100ma.

When you calculate the resistor value for the led to get 15 ma. you need to consider the transistor drop also. which is usually 0.2V for low current. (It will vary and it could be up to 0.6V).

Normally I use the minimum Hfe value for my calculation. Just to verify.

Then to get 15ma it will be

For the resistor in serie with the LED
(6V - Led Voltage at 15ma - 0.2V transistor drop )/15 ma = ~ (6v- 1.175v -0.2)/15ma = 308 ohm => 300 ohm

For the resistor at the base

Minimum Base Current = 15ma / (100hfe) = 150 micro-amp.

Since you put a 10K at the base of the transistor , the resistor is serie will need to provide around 0.75V at the base for 15ma IC current. (speck figure 2).

I assume a 0.3V drop on GPIO.

Then the maximum resistor possible will be (3v -0.75v) / (( 0.75V /10K) + 150 ua) = 10000K

So the Maximum Resistor possible will be around 10K but something smaller will be safe.

Around 5K is a good choice.

B.T.W. Something wrong with your calculation according to the pictures.

You got 13ma and you have a led voltage to 1.175V then

(13 ma * 390 ohm) + 1.175V = 6.245 V ???? If you have 6V supply this is impossible. And you transistor will drop some voltage. When you add a current meter in the circuit, you change the system because current meter has a resistor value.

I suspect that you check the voltage on the led, add the meter in "milli-ampere" mode to read the current. This is wrong since the meter will add a resistor into the circuit. The best way is to check the voltage on the 390 ohm resistor and calculate the voltage.


Posts: 223
Joined: Fri May 31, 2013 11:29 am
Contact: Website

Re: Simple transistor question

Sat Jan 04, 2014 3:36 pm

You can experiment the circuit with a Spice program too. For example with the LTSpice


User avatar
Posts: 287
Joined: Fri May 24, 2013 2:29 am
Location: St Thomas, Ontario Canada

Re: Simple transistor question

Sat Jan 04, 2014 3:54 pm

danjperron and others already gave detailed answers, I would just like to add this:

the dc current gain hFE is specified with 5V across the transistor. this is not what we want in this case. we want the transistor to saturate, so it does not dissipate a lot of power. so we cannot use even the minimum value 200 for the current gain.

if we look at the datasheet value for Vce(sat) we see that it is specified as 0.09V (typical) when Ic=10mA and Ib=0.5mA. this means that the base current is 1/20 of the collector current. this gives us a clue about how much current to put into the base.

on the next page (of the Onsemi data sheet) there are curves that show the collector saturation region. if we look at the curve for 20mA collector current we see that the voltage across the transistor starts to increase when the base current is reduced below 0.1mA. this means the transistor (typically) starts to go out of saturation when the base current is below 1/200 of the collector current.

so if we assume that we have a transistor with typical characteristics we should put at least 13mA/200=65uA into the base. but to be totally sure we would use 13mA/20=650uA. at least, then we can be sure that the voltage drop across the transistor is not more than 0.25V (read from max value for Vce(sat) at 10mA/0.5mA).

next thing is to figure out how much voltage we have on the base. there are curves for that too, and it gives us 0.75V. so we select a base resistor that is (3.3V-0.75V)/650uA=3.9k
there will be some voltage drop in the GPIO when the pin is sourcing current, so to be on the safe side we should measure the actual high voltage with the transistor connected and adjust the resistor value if necessary. I agree that it is better to measure the voltage across the resistor and calculate the current instead of using a mA meter (because of the additional voltage drop inside the meter).

I usually look at the hFE minimum value as a relatively useless piece of information because it is measured at 5V and I am using the transistor as a switch in this situation, so I need to figure out how much base current is needed in order to turn the transistor fully ON. it takes some reading of the datasheet to figure that out, as each transistor is a bit different.

Posts: 52
Joined: Sat Jan 04, 2014 2:09 pm

Re: Simple transistor question

Sat Jan 04, 2014 4:17 pm

Don't over think this kind of thing if you're just lighting an LED. That NPN will be saturated with a low drop as cited above, so just tweak the 390 resistor to get the desired intensity (within the spec limits of the LED).

User avatar
Forum Moderator
Forum Moderator
Posts: 13368
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Simple transistor question

Sat Jan 04, 2014 5:24 pm

yes, really the only thing you need is that Hfe isn't valid for transistors in saturation, and the "current gain" in saturation is really only a fraction of Hfe, so if you have a transistor with say a Hfe of 500 then probably the current gain is only 1/10th of the Hfe, or something like 50. Meaning that to switch an 1A current you will need 1A/50 = 20mA base current, which is a bit much, and it explains the use of darlington transistors (as in the ULNxxxx range of driver IC's). Obviously an n-FET with a gate turn on voltage below 3.3V would be a better solution still.

Return to “Automation, sensing and robotics”