# Transistor base resitor selection

I have a lot to learn about transistors. Can somebody help me choose the correct base resistor for a BC547 transistor? Attached is the schematic and transistor datasheet. I can get it graded a b or c for the hfe range. The relay coil pulls 33.3mA at 12v and has a resistance of 360 Ohm. It will be triggered by the 5v output of an Arduino nano.

Generally for switching, you will set the base current as Ic/10.

You need to saturate* the transistor, rule of thumb base current 10% of collector current.
You want 33.3mA for the relay, so maybe 5mA for the base will be plenty. The base-emitter junction drops 0.7V from the 5V you have available.

Can I leave you to calculate the resistor from that?

*Saturate in practical terms means the transistor is hard on, no sorry, I can't say that, the transistor is well and truly on. There's a bit more to it than that, I leave you to look it up.

Since this is not a high current situation you can probably choose to waste less energy than the common practice of setting Ib = Ic/10.

The data sheets states that the absolute minimum hFE at Ic = 2 mA is 110. Assuming hFE = 50 should be a safe choice.

Rb = 50*4V/(0.033A) ~ 6.8K (pick 4.7K for Ib ~ 1 mA).

You need to saturate the transistor to turn it on fully, so the data sheet is saying you need 5mA of base current with a 1V drop across the base.

Those are rough figures from the data sheet but they will do as this calculation is not very critical.
So the output pin is 5V the base is 1V so the resistor must be such that 5-1 = 4 volts must be dropped across the resistor when 5mA is flowing through it.
That is just ohms law.

Medium/high power transistors must be driven at 5-10% for full saturation.
But a base current of 5% of the collector current is enough for a small signal transistor.
It even explains it in the table in post#0.
Vce(sat) 5mA@100mA.

2k2 would be ok, but 1k or 4k7 would also work.
Leo..

That BC547 is poor at saturation though, its not a switching transistor. The datasheet shows
Vce(sat) as 900mV for Ic=100mA Ib=5mA. Losing about a volt may be an issue and cause the
transistor to run hot.

The Fairchild datasheet for the BC547 claims 0.6V Vce(sat) in the same circumstances - so it
clearly depends on vendor too.

The 2N2222A manages 0.3V for 150mA - the 2N2222A is a switching transistor, the BC547 is not.

Is there a better transistor to use with the TO-92 footprint for my circuit?

With 33mA collector current, the BC547 is just fine.
At that current it might have a saturation voltage of 0.3volt.
Not a problem for dissipation (0.3*0.0333= <=1mW).
Not a problem for volt drop (0.3/12= 2.5%).

Sure, for >100mA you might need a ‘better’ switching transistor,
But for this application it’s just fine.
Leo…

2 last question. I can get it in 3 ranges for hFE, or ungraded. At least that's how I understand the model numbers. The ranges on are bottom of my attached spec sheet. Is one preferred over the other? 2nd question is should I use a pulldown resistor on the arduino output like is encouraged on the mosfet?

The 'B' is 'general purpose, and tested. But Hfe is irrelevant for switching.

The BC548 was AFAIK recommended for switching applications.
But almost any small transistor will do for a 33mA relay.

NPN transistors are current driven.
No base current, no collector current.
A 'floating pin can't provide 'current', so no pull down resistor needed.
Leo..

tsperry88:
Is there a better transistor to use with the TO-92 footprint for my circuit?

The "better transistor" will be a logic-level FET.
Edit: So for anyone later reading, ↑this link↑ points to a mendacious product listing, The BS170 is absolutely not a "logic-level FET"!

Why are you not using one?

Every drawing I have seen similar to what I am doing used the bc547. I am not very good at design right now, so I copy what I see other doing.

In this case, a 33mA relay, there is no real difference.
The BC547 is safer in the hands of a beginner though.
A BS170/2N7000 is very ESD sensitive, and handling/soldering could easily send it to silicon-heaven.
Leo..

You need to learn how to handle static sensitive components though, all CMOS devices and FETs are sensitive and
you can't really avoid them. First defence is never wear nylon or do electronics in a room with a nylon carpet (really,
nylon generates static like nothing else). Wood worksurfaces are naturally anti-static.

Components already mounted on a PCB are typically much more robust, but they are not immune to static
damage caused by bad handling. Always pick up a circuit by its grounded or insulated parts if possible.

tsperry88:
Every drawing I have seen similar to what I am doing used the bc547. I am not very good at design right now, so I copy what I see other doing.

They are also just copying. If the load current is not very large, it's not a terrible way to do it. Component availability can be an issue. Locales have different possibilities for obtaining parts - both online and in store. There is a chicken and egg phenomenon in hobby parts - shops will stock what sells, people use what they can buy. This is how obsolete components like the 555 timer, 741 op amp can still be around.

This is still making my head hurt. This article agrees with what was told to me in this post, that hfe is irreverent when using the transistor as a switch. Then the author uses hfe to calculate the base resistor when using it as a switch?? Changing that number drastically changes the resistance in the calculation. If I am doing this correctly, I get the following using 100 for hfe.

.05/100 x 10 = 2.5ma
5-.7 / 2.5ma = 1720

Attached is the actual data from the BC547B part I got from digikey. I actually have no idea which value I would use for minimum hfe in my scenario.

BASE TO CONTROL
The question now is how do you control the transistor so it turns on and off? Well, we have to do two things: 1. Find the correct transistor base current (IB) that will saturate the transistor. 2. Calculate the resistance value for the base resistor RB (see Figure 1). The formula for finding the base current is:

IB(EOS) = IC(MAX)
Beta (min)

Notice here, in order to find the base current (IB), we divide the maximum collector current (IC(MAX)) we want to go through the LED (15 mA) by the minimum Beta listed on the datasheet (hFE). What is Beta? Beta — also known as DC current gain — is a ratio relating to how much current gain you can expect through a transistor’s collector terminal given a certain amount of current going into the base terminal. In other words, the base current controls the collector current. It’s kind of like a small water valve controlling the flow of water running through a large pipe.

Having said all that — and this is very important — Beta (gain) is only used in amplifier design. When you’re using a transistor as a switch (digital mode), Beta has little effect or meaning because the transistor is not operating in the active region that amplifiers work in. Once a transistor switch is in saturation mode, there’s no collector current gain beyond saturation.

In other words, once a transistor switch reaches the saturation point, the gain formula IC = Beta x IB no longer applies because the voltage drop across the collector/emitter terminals (VCE(sat)) has reached its lowest saturation voltage of .1V. When VCE(sat) reaches this voltage level, the collector current can’t increase beyond this point — even if the base current continues to increase.

Remember, a transistor operating in digital mode (on/off) is either in saturation mode (fully switched on) or in cut-off mode (fully switched off). Therefore, any level of collector current (Ic) in between the two states of saturation and cut-off is not important to the functioning of a transistor switch — it’s only important to amplifier designers.

Okay, so what value do we use for Beta in the formula to find the base current (IB)? Well, the standard rule of thumb states that you should use the minimum Beta (hFE) listed on the datasheet. Unfortunately, the minimum Beta listed on the datasheet will only place the transistor at the Edge of Saturation (EOS). Since transistors are sensitive to temperature changes, a change in temperature could force the transistor to move from the EOS into the “active” area (amplifier region).

Therefore, in order to eliminate this possibility, we use what is known as an “Overdrive Factor” (ODF). This is an arbitrary number between 2 and 10 that is used to insure that the transistor is driven hard into saturation (fully turned on) — and where temperature changes fail to drop the transistor out of saturation. Therefore, IB equals:

IB = IB(EOS) x ODF

IB = IC(MAX) x ODF
Beta (min)
IB = .015 x ODF
100
IB = .15 mA x 10
IB = 1.5 mA

Notice, in the formula above, by using an ODF of 10 we increase the base current from 150 µA to 1.5 mA, thereby assuring that the transistor is forced into deep saturation. For example, if a datasheet listed a Beta(min) of 75, and you needed a collector current (IC(MAX)) of 25 mA, IB would be .333 mA (.000333A). Unfortunately, 333 µA would only put the transistor at the EOS. By using an ODF of 10, we increase the base current (IB) to 3.3 mA — well beyond the EOS and into deep saturation.

Now that we have established a base current (IB) of 1.5 mA is required to saturate our transistor, let’s calculate the resistance value needed for the base resistor RB. Once again, we use Ohm’s Law to calculate for RB:

RB = VIN - VBE(sat)
IB
RB = 5 - .6
.0015
RB = 2933.33 ohms

For switching applications, you can get away with just turning it on hard.
Vbe (sat) for 100mA Ic is 0.9V and 5mA.
So you can roughly use (5V - 0.9V)/.005A = 820 ohm.

I usually go with Vbe of 0.7V, and 20mA,
then (5V - 0.7)/.02 = 215 ohm, so standard 220 ohm will turn it on pretty well.

I drew up and had 5 little PCBs made for basically the cost of shipping. Hard to believe they can be made for so cheep. All my recent questions were related to this little thing. I'm pleased with it. Going to build them all for practice. Ordered a few 2N7000 to try as well. The resistors in this photo are just what I had before my next box of stuff shows up. The last one I won't use pin headers and will solder everything direct. It's for my chicken coop.

BTW, the 2N7000 is not a very good MOSFET for experimenting with, however it is available in TO92 which is easy to handle.

FYI, some examples of logic level MOSFETs.