As many of us know, an integrated circuit or IC is a combination of many small circuits in a small package that work together to perform a common task. Just like an op amp or a 555 timer IC is made up of many transistors, flip-flops, logic gates and other combinatorial digital circuits. Similarly, flip-flops can be constructed by using a combination of logic gates, which themselves can be constructed by using several transistors.

Logic gates are the basis of many digital electronic circuits. From basic flip-flops to microcontrollers, logic gates form the fundamentals of how bits are stored and processed. They use arithmetic logic to state the relationship between each input and output of the system. There are many different types of logic gates, and each of them has a different logic for a different purpose. But the focus of this article will be on the AND gate because later we will build the AND gate using the BJT transistor circuit. Exciting, right? let’s start.

AND gate

An AND logic gate is a D-shaped logic gate with two inputs and one output, where the D-shape between the input and the output is a logic circuit. The relationship between the input value and the output value can be explained using the AND gate truth table shown below.

Using the AND Gate Boolean Equation it is easy to interpret the equation output i.e. Q = A x B or Q = AB. So for AND Gate, the output is HIGH only if both inputs are HIGH.

transistor

A transistor is a semiconductor device with three terminals that can be connected to an external circuit. The device can be used as a switch or as an amplifier to change values ​​or control the passage of electrical signals.

To build an AND logic gate using transistors, we will use BJT transistors, which can be further divided into two types: PNP and NPN – Bipolar Junction Transistors. The circuit symbols for each of them are shown below.

This article will explain to you how to build an AND gate circuit using transistors. The logic of an AND gate has been explained above, to build an AND gate using transistors, we will follow the same truth table shown above.

Required circuit diagrams and components

The list of components required to build an AND gate using NPN transistors is as follows:

Two NPN transistors. (You can also use PNP transistors if available)

Two 10KΩ resistors and one 4-5KΩ resistor.

An LED (Light Emitting Diode) is used to check the output.

+5V power supply.

Two PUSH buttons.

Connect the wires.

This circuit represents the inputs A and B of the AND gate and the output, Q also provides +5V to the collector of the first transistor, the first transistor is in series with the second transistor, an LED is connected to the emitter terminal of the second transistor . Inputs A and B are connected to the base terminals of transistors 1 and 2, respectively, and output Q is connected to the positive terminal LED. The figure below represents the above circuit using NPN transistors to construct an AND gate.

The transistor used in this tutorial is a BC547 NPN transistor and all the above components have been added to the circuit as shown below.

If you don’t have buttons, you can also use the wires as switches, adding or removing them as needed (instead of pressing the switch). The same can be seen in the video, where I will use wires as switches connected to the base terminals of both transistors.

When building the same circuit using the above hardware components, the circuit looks like the diagram below.

Operation of AND gates using transistors

Here we are using a transistor as a switch, so when a voltage is applied through the collector terminal of the NPN transistor, the voltage will reach the emitter junction only if the voltage supply at the base junction is between 0V and the collector voltage.

Similarly, the circuit above will make the LED light up, i.e. only when both inputs are 1 (high), i.e. the output is 1 (high), i.e. when both transistors have voltage supplied to their base terminals. This means that there is a straight current path from VCC (+5V supply) to the LED to ground. Rest in all cases, the output will be 0 (low) and the LED will be off. These can all be explained in more detail by going through each case one by one.

Case 1: When both inputs are zero – A = 0 & B = 0.

When inputs A and B are both 0, you do not need to press any buttons in this case. If you are not using the button, remove the connected wires, the button and the base terminals of the two transistors. So, we set both inputs A and B to 0, now we need to check the output, which should also be 0 according to the AND gate truth table.

Now, when voltage is supplied through the collector terminal of transistor 1, the emitter does not receive any input because the base terminal has a value of 0. Similarly, the emitter of transistor 1 connected to the collector of transistor 2 does not supply any input current or voltage, and the base of transistor 2 has a value of 0. Therefore, the emitter of the second transistor outputs a value of 0, and therefore, the LED will be turned off.

Case 2: When the input is – A = 0 & B = 1.

In the second case, when the inputs are A = 0 and B = 1, the first input of the circuit is 0 (low) and the second input is 1 (high), connected to the bases of transistors 1 and 2 respectively pole. Now, when the 5V supply is delivered to the collector of the first transistor, there is no change in the phase shift of the transistor because the base terminal has a 0 input. It passes the 0 value to the emitter, the emitter of the first transistor is connected in series to the collector of the second transistor, so the 0 value goes to the collector of the second transistor.

Now, the base value of the second transistor is high, so it allows the same value received by the collector to pass to the emitter. But since the value in the collector terminal of the second transistor is 0, that’s why the emitter will also be 0 and the LED connected to the emitter will not emit light.

Case 3: When the input is – A = 1 & B = 0.

Here, the inputs are 1 (high) for the base of the first transistor and low for the base of the second transistor. Therefore, the current path will start from the 5V supply to the collector of the second transistor, through the collector and emitter of the first transistor, because the base terminal of the first transistor has a high value.

But in the second transistor, the base terminal has a value of 0, so no current flows from the collector to the emitter of the second transistor, so the LED will still only be off.

Case 4: When both inputs are 1 – A = 1 & B = 1.

In the last case, both inputs here should be high and they are connected to the base terminals of both transistors. This means that as long as current or voltage passes through the collectors of both transistors, the bases saturate and the transistors turn on.

In fact, when +5V is supplied to the collector terminal of transistor 1 and the base terminal is also saturated, the emitter terminal will receive a high output because the transistor is forward biased. The high output of the emitter goes directly to the collector of the second transistor through the series connection. Now, similarly at the second transistor, the input to the collector is high, in this case the base terminal is also high, which means the second transistor is also saturated, high Input will be passed from collector to emitter. This high output from the transmitter goes to the LED, which turns on.

Therefore, all four cases have the same input and output as the actual AND logic gate. So we built an AND logic gate using transistors.