### Transistors – Part 2: How to designing a BJT controlled switch

In part 1 we have seen how to know which kind of transistor we need. In this post we explore how to design a circuit to control a BJT with our embedded device.

## Working Principle and Mnemonics

BJT have 3 connections: Collector, Emitter, and Base. The base pin controls the amount of current that flows through Collector and Emitter. The base pin is easy to remember, as it is always the one in the middle. There are two kinds of BJT, the PNP and the NPN, depending on the kind of doping used in the silicon layers.

In the PNP the control current is drained from the base and in the NPN the control current is sunk into the base. This is easy to remember, as the arrow points to the current flow.

It can be confusing to remember which is the emitter and collector in each case. An easy to remember mnemonic is that the emitter is always the pin that has the the arrow symbol, which points to the direction the current is emitted.

To understand how this device works first we need to have a clear understanding of have a diode works. Once we understand that, the symbol pretty much describes the functioning. As we can see the arrow is just like a diode. This also helps to distinguish the transistor type, we just need to look at the arrow which has the same meaning as in the diode:

Just like in a silicon diode, we need a forward bias voltage of about 0.7 V for the diode to start conducting. The amount of current we get at the collector is proportional (usually x100) to the current we get at the base:

$I_{Base} = \beta I_{Collector}$

We can visualize this behavior has somehow an avalanche effect. First we need a small amount of current to flow through the base. For that we need to turn the diode on. As son as a small amount of current flows through the diode, it gets amplified an a lot of additional current flows to the collector.

## Controlling it with our embedded device

Usually in our embedded devices we will have output pins that we can control. We can turn them on and of, typically to 3.3V or 5V. These output pins usually can provide or sink a maximum of about 10 to 30 mA. So we cannot control the amount of current that flows, and the amount of current is very little. These little amount of current will be amplified by the BJT transistor and will allow us to switch our load.

Therefore the strategy is to add a resistor, so that the 3.3V or 5V are converted to the appropriate amount of current.

Let’s say that our load requires 500 mA and 12V. The we can design the following circuit:

We can have our load connected to a 12V supply. Our embedded device will provide a 3.3V pulse, this will be sufficient to turn the ‘diode’ within the transistor on, and it will start conducting. We need to regulate the amount of current that it conducts so that it gets amplified to our desired value. Assuming that the transistor has a x100 amplification factor, we need 5 mA to flow into the base, so that the current through the collector is 500 mA. For that we need to add the following resistor to our circuit:

$R_{base} = 2.6 \; \text{V} / 5 \; \text{mA} = 520 \; \text{Ohm}$