A transistor is a semiconductor that can be used as a switch or an amplifier. As a basic introduction, we examine the bipolar junction transistor to switch an LED on and off using a control voltage. We also find out how to calculate the different resistor values to get the optimal working switch circuit.
Though all transistors switch or amplify, not all use the same internal physics to accomplish these tasks. For example, bipolar junction transistors (BJT) are quite different from Field Effect (FET) or MOSFET transistors. They have their own strengths and weaknesses.
We will purely focus on the bipolar junction transistor in this article. A simple switch circuit with an NPN transistor.
Bipolar Junction Transistor
Bipolar transistors are current regulating devices. They’re normally in the off state. So no current flows. But with only a small current applied to the base lead, we can control a much larger current to flow. Transistors have three terminals and come in PNP and NPN formats.
- Base (b)The control lead of the transistor. Here we switch the transistor on, off or everything in between.
- Collector and emitter (c and e)When the transistor is ‘open’, current flows from the collector to the emitter. A tiny bit of current flows from the base to the emitter as well.
But what about the NPN and PNP type differences? Below the definition I freely extracted from Practical Electronics for Inventors.
- NPNTurns on with only a small input current and a small positive voltage at its base (b) relative to its emitter (e). It then permits a larger current to flow between collector and emitter. The voltage at the collector must be greater than the voltage at the emitter (Vc > Ve).
- PNPTurns on with only a small output current and a negative voltage at its base (b) relative to its emitter (e) turns it on. It then permits a larger current to flow between emitter and collector. The voltage at the collector must be smaller than the voltage at the emitter (Vc < Ve).
Transistor Operation Regions
A transistor can be in one of three states:
- Cut-offIn the cut-off region the transistor is ‘closed’. The switch is off.
- Forward activeIn the forward active region the transistor act as an amplifier. A small current at the base makes a larger proportonial current between collector and emitter possible.
- SaturatedIn the saturated region the transistor is fully ‘open’. The switch is on.
Maybe that doesn’t explain much 🙃 so let’s look at a more practical example.
Bipolar transistor based switch
The circuit below shows an NPN bipolar transistor switching an LED on or off. It does this by responding to a 0 to 5 Volt external CV square wave signal applied to the base. Only a small amount of current at the base is needed to switch the LED circuit on.
The LED circuit is simple. We need about 20mA to turn the LED on. The LED accounts for a voltage drop of 2.1V. Since we have a 12V power supply, we can use Ohm’s law to calculate the current limiting resistance needed.
Now when the transistor is turned on, there’s a small amount of current add to the LED circuit from the base. To be safe we place a 470 and 47 Ohm resistor for a total of 517 Ohm.
Beta and saturation
But how much current do we need at the base to switch the transistor on (saturation)? We need to dive into the datasheet for that. The NPN transistor in the circuit simulates a 2N2222 general purpose NPN transistor.
To calculate the current needed at the base in our particular case we need to know the beta (or hFE) of the transistor. This figure tells us how much the transistor amplifies a current at the base. A beta of 100 means 1mA at the base can cause 100mA to flow from collector to emitter.
The beta in BJT’s can vary wildly based on temperature, input voltage, current, or simply between transistors of the same type. For instance, the hFE of the 2N2222 varies between 35 and 300.
Let’s assume a beta of 100 for our test circuit. We need about 20mA of current for the LED circuit, so an input current at the base of 200uA should suffice. We know that from base to emitter the voltage drop is 0.6 (it’s a PN junction, same as a diode). We also know there’s max 5V in the input from CV. To calculate the current limiting resistor at the base we apply Ohm’s law again:
This resistor value could be just enough to drive the transistor into saturation. However, since the beta of this transistor is so unpredictable, a lower resistor value is more sensible for a switching application. Hence the 10k Ohm.
This leaves around 340uA at the base, which is enough to turn the transistor on even if the beta is lower than the 100 we assumed. If the beta is higher the circuit will work altough a little less efficient.