When a bipolar junction transistor (BJT) is used to switch a load (e.g. a relay, an LED, a buzzer, a small motor, etc) ON and OFF, it is most often operated as a "saturated switch". This article explains saturation in BJTs - why it is used, and how to calculate the base resistor to ensure saturation.
General circuit arrangement
Here is the general way a transistor (Q1) is used as a saturated switch to drive some kind of load (represented here as a 160Ω resistor), under the control of a logic signal coming from the device at the left, which would typically be a microcontroller or a logic gate.
When the controlling device's output is low, no current flows through RB, and Q1 is turned OFF. Therefore, no current flows through the load in the collector circuit. If the load is an LED (with a series resistor), it does not illuminate. If the load is a relay coil (with a reverse diode across it for back EMF suppression), it does not energise.
When the controlling device's output is high, current flows through RB into Q1's base, biasing Q1 into conduction. Current flows from V1, through the load, into Q1's collector, out Q1's emitter, and back to 0V. The load is energised: an LED lights up, or a relay activates and closes its contacts.
A common question is: "How do I calculate the value of RB?"
Start with the maximum collector current IC
If the load is resistive, you can calculate the maximum collector current IC(max) using Ohm's Law, from the supply voltage V1 and the load's resistance. If the load is an LED with a series resistor, you probably already know the current. If it's a buzzer or a relay coil, the resistance and/or current are given in the data sheet. If it's a motor, use the starting or stall current (whichever is higher) from the data sheet.
This current, and the V1 voltage, enable you to select a suitable transistor for Q1. When you're choosing Q1, also consider the minimum current gain, hFE(min), at that collector current. A higher hFE makes the transistor easier to drive - i.e. it needs less base current. Larger transistors normally have lower current gains. So choose one that's comfortably over-rated (at least 50% higher than IC(max)) but not unnecessarily over-rated.
Also it's important to know that hFE decreases as IC increases, for any given device. The relationship is usually shown in a typical characteristics graph. This is why it's important to use the data sheet figure for the guaranteed minimum hFE at the correct collector current. If no figure is given for that current, you can estimate it using the minimum hFE figures for other collector currents in conjunction with the shape of the graph, but typical characteristics are not guaranteed.
If IC is more than about 200~500 mA, you may need an extra stage between the driving device and the transistor. This note doesn't cover that situation.
Calculate the nominal base current, IB(nominal)
Divide the maximum collector current (IC) by the minimum current gain (hFE) at that collector current.
For example, say IC(max) = 30 mA and hFE(min) = 83 at IC = 30 mA. The result is that IB(nominal) is about 360 µA.
Multiply IB(nominal) by a "saturation factor" - a number between 2 and 10 - to ensure that the transistor saturates. I'll use a saturation factor of 3 and I'll explain the saturation factor in detail below. So we want about 1.1 mA base current.
Calculate the voltage that will appear across the base resistor. When you're drawing several milliamps from the driving device, its output may be dragged down somewhat, especially if it's a low-power device. The data sheet may give a specification, or a typical performance graph, to show you how much the output will drop when supplying that much current.
So you can estimate the voltage at the left end of RB, and you can estimate the voltage at the right end of RB as around 0.8V, the approximate base-emitter voltage of a transistor under bias. The voltage across RB will be the difference between those voltages.
Let's assume the driving device is powered from +5V and its output will drop from 5V to 4.8V under a 1.1 mA load. So the resistor will have 4.0V across it. So from Ohm's Law: R = V / I = 4.0 / 0.0011 = 3636Ω. You don't want less than that amount of current, so you use a resistance that's equal or lower. So I would use a 3k6 or 3k3 resistor.
In this example, the voltage drop across RB is significant - estimated at 4.0V. In cases where the driving device is powered from a low voltage (say, anything less than 3.3V), you should also investigate the actual VBE voltage, instead of using the typical voltage of 0.8V, because with a low driving voltage, small differences in VBE will significantly affect the voltage drop across RB, and therefore, the base current.
In this case, the driving device is powered from +5V, the same voltage that powers the load, but that's not always the case. Often, the load is powered from a higher voltage than the control circuitry.
The factor of 2~10 that I mentioned is needed because you want to ensure that the transistor saturates properly. Saturation (for a BJT) is defined in several ways, but generally it relates to the collector-emitter voltage VCE.
Here is an LTSpice simulation of a 2N4401 transistor driving a 160 ohm load with a 5V supply, which corresponds to about 30 mA collector current with the transistor turned ON.
In this simulation, the base current is ramped steadily from zero to 5 mA over a five second period. The graph below shows the base current (the straight green line) and the collector-emitter voltage (the red curve) over that range. (VC and VCE are the same thing, because the emitter is connected to 0V.)
In the left hand part of the graph, you can see the transistor operating in its "linear region", where IC is proportional to IB.
To start with, IB is zero, so no collector current flows, so no voltage is dropped across the collector load resistor, so the collector voltage is equal to the supply voltage. As IB is increased, IC increases proportionally, causing an increasing voltage drop across the collector load resistor, causing VC to drop steadily.
But at a certain point, the collector current starts to become limited by the collector circuit.
With a 5V supply and a 160 ohm resistor, the maximum possible current is 31.25 mA. The transistor wants its collector current to increase, because its base current is continuing to increase, but it can't, because the collector circuit is limiting the current.
Or another way to put it is that the transistor is running out of collector-emitter voltage. The power supply is only 5V. To get more collector current through that fixed load resistor, it would have to drive its collector negative! And it can't do that.
This is what saturation means. You could define it as being when IC can no longer increase in proportion to IB, or when VCE drops below a certain voltage, or when there is a certain amount of current flowing in the collector-base junction (!), or in terms of the physics of the device, which I don't understand. But that's the general idea.
When you're switching a load ON and OFF, you want to saturate the switching device in the ON state, because you want to minimise VCE, to maximise the voltage across the load. This circuit is then called a "saturated switch".
You do this by providing a base current that's significantly more than IB(nominal), the basic value you calculated by dividing IC by hFE using worst case numbers for both.
Close-up of the saturation region
Here's a close-up view of the VCE vs. IB graph, showing only the saturation region - the part of the graph where VCE is less than 200 mV.
As you can see, the VCE curve starts to level out at around 120 mV, at the point marked "A", which corresponds to IB = 750 µA, roughly. This is about twice the 360 µA base current I calculated as IB(nominal).
If you increase the base current to ten times IB(nominal), which is 3.6 mA at point "B", VCE only drops from 120 mV to 80 mV.
Increasing IB beyond that point enters the area of rapidly diminishing returns, i.e. it just wastes base current for no significant drop in VCE.
So the optimum reasonable base current probably lies somewhere between 2 IB(nominal) and 10 IB(nominal). Where you operate the transistor depends on how much base current you want to waste, how important it is for you to fully saturate the transistor, and whether you're Republican or Democrat.
Other factors you may need to take into account if they are quite variable are:
These guidelines apply to circuits with moderate voltages (up to around 40V), moderate currents (up to 200~500 mA) and moderate switching speeds (up to the low kHz range), and where the driving device can comfortably supply the required base current to drive a single transistor output stage.
- Temperature (if the circuit needs to operate at low temperatures you may need to be more conservative as well, i.e. use a higher IB);
- Aging (hFE deteriorates gradually with age, especially if the component is stressed);
- Peak vs. average current (even more carefully);
- Individual component variations, e.g. output voltage from the driving device;
- Tolerances in the RB resistor, the load, and the supply voltage(s).
In many situations, MOSFETs are a better choice for saturated switching. They require zero gate current except during transitions from OFF to ON and ON to OFF, so the average current can be very low if the switching frequency is low, and in saturation they behave like a resistor, which in modern devices can have an extremely low value - less than 0.001Ω! They have their own issues though. Read some application notes from Fairchild, ON Semiconductor, STMicroelectronics and other MOSFET manufacturers.