Tutorials

How a transistor works

In this tutorial I am going to talk specifically about bipolar junction transistors, or BJTs. I will refer to these more simply as transistors.

There are two types of transistors called NPN and PNP. We won’t worry too much about the differences here and will concentrate on the NPN transistors. A NPN transistor has three legs, called the base, collector and emitter. The figure below shows the symbol used to depict a NPN transistor. Of the three legs, b represents the base, c the collector and e the emitter. The arrow represents the direction of (conventional) current flow.

Note that electrons travel in the opposite direction to the conventional current flow but we won’t worry about that here. We will only use conventional current flow, which we will simply shorten to current flow. The first rule to remember is this:

1. Conventional current flow assumes that current flows out of the positive terminal through the circuit and into the negative terminal (also called 0v or ground).

The second rule to remember is that:

2. A transistor is an amplifying device.

What does amplifying mean? It means that we can use a small current (actually a small voltage) to control a much larger current. The base leg of the transistor is the leg that we can use to control the larger current flowing from collector to emitter. You’ll often see pictures that depict a transistor as a value that controls the flow of water, here’s one I made.

For a NPN transistor the base can be turned on by applying a positive voltage to the base. Let’s consider the following simple two circuits:

On the left of the picture we see the base of the transistor connected to the negative terminal, this is often referred to as the ground or zero voltage. Since the base is connected to ground, no current can go from the ground to the base. Remember current flows from positive to ground and no current is going to flow from ground to ground. Since no current flows into the base the transistor is in the off state and no current flows from the collector to the emitter.

The circuit on the right shows the base of the transistor connected to the positive terminal, this will result in a current flowing from the base to the emitter and return to ground. Because current is flowing into the base, the transistor is turned on and the LED lights up. The 470 ohm resistor is to stop too much current flowing through the LED, otherwise the LED would destroy itself. Likewise the 1K ohm resistor is to limit the current going into the base.

The degree to which the transistor is turned on depends on how much current flows into the base. To assist in the description we will refer to the base current using Ib and the collector current as Ic.

Let’s us slowly increase the base current by some means, unspecified at this point. As Ib increases Ic rises. What is interesting is that the increase is quite linear. The graph below shows an idealized response of the collector current to changes in the base collector.

Note that the current on the y axis is much bigger than the current on the x axis. For example a 100 micro Amp change in the base current causes a 10 mA current change in the collector current. That is roughly a hundred fold change. The change in the collector current compared to the base current is a ratio that is always given in transistor specification sheets. This number is called the current gain and is often represented using the symbol hfe. For common signal transistors such as 2N3904 or 2N2222 the value for the gain is often between 100 and 400. Due to manufacturing differences the gain between two say 2N3904s, will never be the identical however.

The graph below shows real experimental data measured using a 2N3904 NPN transistor tha measures the base current as a function of the base/emitter voltage. An annmeter was put between the base and the 1K resistor and the applied voltage varied between 0 and about 1 volt. You can see the linear region starting at about 0.65 volts. What is very noticable is that nothing happens until about 0.6 volts, this is very characteristic. An NPN silicon based transistor needs at least 0.6 volts at the emitter base because the transistor will begin to switch on.

Voltage Amplification

In real applications we are often interested in amplifying voltages not currents. This is because most signals appear to us as changes in voltage, for example the output from a microphone. We are also often interested in reading the output as a voltage rather than a current. First let’s think about how to convert the collector current into a voltage. This is easy to do, we simply put a resistor between the positive voltage source and the collector. This is often called the load resistor. When current flows through the resistor there will be a proportional drop in the voltage across the resistor. This brings us to the third rule:

3. An important application of resistors is to convert currents into voltages.

We can apply an input voltage to the base/emitter legs which yields a base current of Ib. This causes a collector current to flow producing a voltage drop, Ic x RL, across the load resistor yielding a Vout. The higher the collector current the higher the voltage drop and the lower Vout. Because voltage is proportional to current (V = IR), the voltage drop will be proportional to the collector current which as we’ve seen is proportional to the base current which is proportional to the Vin. In other words the voltage drop will be proportional to the Vin.

When the transistor is off, the voltage at Vout will be at 6 volts since there is no voltage drop across RL. As the transistor switches on, Vout starts to decrease as RL starts to drop voltage.

You may have noticed that the output Vout mirrors Vin, That is when Vin has a high voltage, Vout has a low voltage and vice versa. In other words the circuit is acting as a logical NOT gate. The graph below is actual data that plots the collector voltage as a function of the voltage across the base. The data is a bit rough because readings were taken using two cheap multimeters whose precision wasn’t that great.

The load resistor, RL, was set to 470 ohms and a resistor of 1K ohm was connected to the base to limit the current and avoid damaging the transistor. The circuit uses the NPN 2N3904 transistor which is a commonly used transistor.

As we mentioned before very little happens until at around 0.6 volts with most of the action is around 0.7 volts where the voltage can be see dropping rapidly. This is very characteristic of silicon based transistors.

To show this effect in another experiment. Ib was measured as a function of the base-emitter voltage byt without any base resistor. The result of this experiment are shown below:

Notice that without the base resistor the base current raises to quite high values. This wasn’t an easy graph to obtain because I had to put a load resistor on the collector to prevent the transistor from overheating above a base voltage of 0.9 volts. Basic multimeters aren’t exactly the best way to precisely measure voltages and currents either. Having said that the experiment does show how current doesn’t start to flow until around 0.6/0.7 volts. The other thing to notice is how fast the current rises even for small changes in base-emitter voltage. This is the source of the amplification. It is also true that the base current rises exponentially due to the same underlying physics. In other words both the base and collector currents rise exponentially in response to a change in the base-emitter voltage. If two currents increase together in a similar way relative to each other, they are changing proportionately (or linearly) to each other. This help explains the linear relationship often given in text books between the collector and base currents: Ic = beta Ib.

Although it may appear that the base current is controlling the collector current, this is not the case. This is why sometimes a bipolar junction transistor is called a current controlled device. This is not entirely true. What is really controlling the collector current is the base-emitter voltage. The change in the base current is a side effect of this but because it responds similarly to the collector current the collector and base currents are linearly related.

A NOT Gate from a Transistor

The following circuit represents a no frills NOT gate. A positive voltage on the input will turn on the transistor resulting in current flowing from the collector to the emitter. This will efective result in the resistor being connected to ground (think of the transistor as a closed switch connecting the resistor to ground) so that the outpu will read close to 0 voltage (not quite zero because the transistor has some resistance too. In summary a positive voltage of around 4 to 5 volts will yield a voltage close to zero.

If we not connect the input to ground, the transistor will be in the off state so that output is effective connected to the 5 volt rail via the resistor. In summary, a zero voltage will result in a high voltage on the output.