Why is NPN PNP used


Which transistor do you need?

In general, a transistor is a component that can be used to amplify currents. You can switch a large load current with a small control current.

There are many different types of transistors. We are initially only concerned with the so-called bipolar transistors. These can be used for a wide variety of tasks.

There are two different types of bipolar transistors: NPN and PNP types. Your schematics will look like this:

The NPN transistor can be seen on the left, the PNP transistor on the right

The abbreviations mean:

  • B = base
  • C = collector
  • E = emitter
However, these are usually not added. You can see this from the circuit diagram:
The base is alone on one side of the thick beam in the middle.
The emitter is the connection with the little arrow.
The collector is the rest of the connection across from the emitter.

The arrow on the emitter shows which type of transistor it is.
If the arrow points outwards (away from the base connection), it is an NPN transistor.
If the arrow points inwards (towards the base connection), it is a PNP transistor.

Switching with NPN transistor

Let's assume we have a control voltage of 5V with which we want to switch an LED that is connected to 12V. The circuit diagram could look like this:

So we have a switch (S1) with which we switch our control voltage of 5V (+ 5V). The resistor (R2) ensures that when the switch is open, a voltage of 0V is always applied to the base of the transistor so that it blocks completely (pull-down resistor). Resistor (R1) limits the current that flows into the base of the transistor. Please read and understand the article transistor, which is about the calculation of the base resistance.

When the switch (S1) is open, no current flows into the base of the transistor (Q1). As a result, the transistor blocks, no collector current flows and the LED (LED1) does not light up.

When we close the switch, a small current, limited by the resistor (R1), flows into the base of the transistor (Q1). This is amplified by the transistor (Q1) and generates a large collector current. The collector current flows through the LED (LED1) and makes it light up. How to calculate the series resistor for the LED, you can read in the article The LED.

After the work is done, the base current flows through the emitter to ground (0V).

Switching with PNP transistors

In principle, PNP transistors work just like NPN transistors, only the other way around ;-). However, this often leads to confusion, which I would like to counteract here.

With an NPN transistor we just switched ground (0V) and used a positive control voltage (+ 5V) for this.

With a PNP transistor we can switch positive voltages, e.g. + 12V. This is sometimes necessary, but often leads to incorrect assumptions about the function, especially for beginners. Often there is the problem of switching a high voltage (e.g. 12V) with a small voltage (e.g. 5V). I have often seen circuit diagrams with this circuit:

This circuit does not look wrong at first: When we turn on the switch (S1), a small current flows from the base of the transistor (Q1) via the resistor (R1) through the switch (S1). This current controls the transistor (Q1). A large collector current now flows and the LED lights up.

However, when we turn the switch off, the LED will still be on. This can be explained as follows: A current of + 12V now flows through the transistor (Q1), from its base, through the base resistor (R1), via the pull-up resistor (R2) to + 5V. This is possible because + 5V is a lower potential than + 12V. Current always flows from the higher to the lower potential. For the current it looks in this situation as if the + 5V in the circuit are 0V, and the + 12V in the circuit + 7V. This means that the transistor (Q1) still turns on.

One way to solve this problem is to use it as a control voltage of 12V:

The effect of the current amplification is retained here, but the control voltage and the load voltage must be the same.

But there is a solution for this too!

We add a second transistor to the circuit to adjust the voltage:

When the switch (S1) is open, the resistor (R2) ensures that 0V (GND) is applied to the base of the transistor (Q1) via the resistor (R1), so that it blocks.
Furthermore, the resistor (R4) ensures that a voltage of 12V is applied to the base of the transistor (Q2) via the base resistor (R3). Since the emitter of (Q2) is also connected to 12V, this transistor also blocks. There is no collector current flowing, the LED (LED1) does not light up.

If we now close the switch (S1), a small current of our control voltage (+ 5V) flows through the base resistor (R1) into the base of the transistor (Q1) and controls it. Now a small current flows through the pull-up resistor (R4), where a voltage drop occurs. See also resistance.
A residual voltage of approx. 0.4V (collector-emitter voltage) remains at the collector of (Q1). Now a small current of (+ 12V) flows into the emitter of (Q2), out to the base, through the base resistor (R3), through the transistor (Q1) to 0V (GND). This current ensures that transistor (Q2) becomes conductive. A large current flows from the emitter to the collector of (Q2), which makes the LED shine.