# How does BJT work as a Switch?

BJT(Bipolar Junction Transistor) are used in almost all electronics circuits. They are used as basis for digital and analog circuit functions. When BJTs are used as digital function block they are operated as switches and in analog circuit they are used as BJT amplifier. When BJT is operated as switches the transistor is operated between the cutoff and saturation region and operated as amplifiers they are operated in the linear region. Here BJT working principle as switches is explained.

To illustrate how BJT can be used as a switch, consider the following simple scenario in which a Lamp is turned on and off with BJT and mechanical switch.

The circuit is operated using a battery of 12V. Let say that the lamp L1 needs 12V to operate and has a resistance of 24Ohm. This lamp is like the collector resistor which we often see in circuit schematics. Now when the mechanical switch is off the lamp is also turned off. This is because the transistor is off and therefore the current through the lamp cannot flow from positive to negative terminal of the battery(conventional current flow actually electrons flows from ground to positive). When the mechanical switch is closed then the lamp will turn on because now the BJT switch is turned on allowing current to from the lamp through the collector to the emitter and back to the battery negative terminal(ground).

Thus in order to operate the BJT as a switch, collector current must flow from collector to emitter. For  collector current to flow base current must flow into the transistor to forward bias the base-emitter junction. The base to emitter junction has a build in potential of 0.7V approximately for silicon BJT. This voltage must be overcome when we apply current(and therefore voltage) at the transistor base. We can control the collector current required by the lamp(or other devices) by calculating first the collector current required and then calculating the base current required. Once base current is calculated we can calculate the base resistor RB value.

If the voltage required by the lamp is 12V and if it has resistance of 24Ohm then the current required by the lamp which is collector current required can be calculated as follows,

$$I_{C} = \frac{V_{lamp}}{R_{lamp}}$$

that is, $$I_{C} = \frac{12V}{R_{24 \Omega}} = 0.5A$$

Now we can use the $$\beta$$ equation for the transistor to find the base current as follows,

$$\beta = \frac{I_{C}}{I_{B}}$$

let $$\beta = 100$$ then,

$$I_{B} = \frac{I_{C}}{\beta}$$

or, $$I_{B} = \frac{0.5A}{100}$$

that is, $$I_{B} = 5mA$$

Now with the mechanical switch ON, applying KVL we have,

$$V_{CC} = I_{B} R_{B} +V_{BE}$$

or,

$$R_{B} = \frac{ V_{CC} - V_{BE}}{I_{B}}$$

or, $$R_{B} = \frac{12V- 0.7V}{5mA}$$

So, $$R_{B} = 2.26K \Omega$$

Lets select practical value, $$R_{B} = 2.2K \Omega$$

So a base resistor value of $$R_{B} = 2.2K \Omega$$ would be needed to turn the lamp on when the mechanical switch is turned on.

The updated circuit diagram is then as follows,

In the above simple example of illustrating how BJT works as a switch we have used mechanical switch but we can control the BJT switch also using digital signals from microcontrollers or processors. This finds applications such as controlling the DC motor using microcontroller as illustrated in the tutorial DC motor Speed control with Potentiometer and PWM using Arduino. The following circuit diagram illustrates how BJT switch is used to control a DC motor.