NAND gate using Transistor
Updated: Dec 4, 2020
NAND gate is said to be the inverse of AND gate or we can also say that the #NAND gate is the combination of AND gate and NOT gate.
The below image shows the symbolic representation of the NAND #Gate.
This explains that the boolean expression of a NAND Gate is (A.B)’ or (A*B) inverse. So, the #boolean expression is output, O = (A.B) inverse.
According to this expression, the truth table of NAND Gate can be represented as:A(0010) + B(1110) = O(1110). The truth table can also be given by,Input A Input B Output
0 0 1
0 1 1
1 0 1
1 1 0
Building NAND Gate using transistor
To build a NAND gate using a transistor, you will be needing two BJT transistors and for this tutorial, I will be demonstrating the building of a NAND Gate using two NPN transistors. The two transistors used will be #BC547 NPN transistors with all other components mentioned in the list below.
The list of components required to build a NAND gate using transistors are:
Two NPN transistors.
Buy Transistors from here.
2. Two 10K Ohm resistor and one 2-4K Ohm resistor.
Resistors are passive devices that restrict the flow of current or divide the voltage through the circuit. The resistors used for this circuit are 10k Ohm and 2-4k Ohm resistors. 10k Ohm Resistor is connected before the transistor, i.e. the input power passes through these resistors and then to the transistors. The 2-4k Ohm resistor is connected before the LED so that a lesser amount of voltage is diverted to the LED.
Buy Resistors from here.
3. Two Push Buttons. (To provide input to the transistors)
PUSH Buttons are simple devices used for switching control. It is easy to use and starts or stops the function when connected in a circuit.
Buy Pushbuttons from here.
4. One Breadboard.
The breadboard is the basic component of any circuit building process. All components, be it input sensors or output display devices are connected to the power supply, microcontroller using wired connections through a breadboard. The holes in the breadboard are in series. There are various sizes like full-sized, half-sized, and mini breadboards.
Buy Breadboard from here.
5. Connecting wires.
These are the main components that are used to establish the connections between different devices of the circuit.
Buy Connecting Wires from here.
6. One LED. (To check the output)
Light Emitting Diode is a commonly used light source. It is a semiconductor that emits light when current flows through it.
Buy LED from here.
7. 5V Power Supply.
This module is specially used for providing voltage supply to circuits designed with components on a small scale. The module has a Barrel jack the can be connected to the DC supply directly. The Voltage is regulated to supply 6-12 V DC. This regulated voltage is then supplied to the circuit built.
The power channel can be configured to supply 3.3V, 0V, or 5V. It has a control button that can be operated as per our requirement to start and stop the power supply. It has an on-board LED which indicates when the power is supplied through the module. For this circuit, the power supply can be 5V or 6V.
Buy the Power supply module from here.
Using these all components you can make a circuit as similar as the schematic shown in the picture below.
To explain the same circuit, we can refer to the below image and I would explain to you the connection of hardware referring to these two images.
In the above image, two transistors Q1 and Q2 are connected in series to build a NAND Gate and the circuit is somewhat similar to the circuit of AND Gate. The collector terminal of the first transistor is connected with a VCC i.e. a 5V power supply through a 2K Ohm resistor and also with the output terminal, O.
Then the emitter terminal of the first transistor is connected with the collector terminal of the second transistor, making a series connection between the two transistors.
Finally, the #emitter of the second transistor is connected with the ground to complete the circuit and on the other side, the #base terminal of both the transistors is connected with input A and input B using a 10K Ohm resistor, respectively.
The working of the NAND Gate using a transistor can be explained using 4 cases according to the truth table of the NAND Gate. So, if we get the same output (with respective input) as in the truth table then we can say that we have successfully built a NAND gate using transistors.
Case 1: Input A = 0 and B = 0
According to the boolean expression, output O = inverse (A * B) and if the input A = 0 and B = 0 then output, O = 1. Hence, due to HIGH output, the LED will turn ON in the circuit.
In practice, when both the inputs are zero then the transistors which are acting as a switch don’t allow any connections between the #collector and emitter terminal. So, when a 5V supply is passed through the circuit, the current doesn’t reach the emitter terminal of the first transistor and just reaches the collector terminal of the first transistor.
But the collector terminal is also collected with the output LED and so, this 5V supply directly passes to the LED. Hence, the output is HIGH, and the LED glows.
Case 2: Input A = 0 and B = 1
When a 5V supply is passed to a NAND Gate circuit built using transistors, the output LED is ON according to the boolean expression. Since, the inputs are A = 0, B = 1 and so the output, O according to the NAND gate boolean expression will be 1. Hence, the LED will glow.
Being high input at the second transistor, the base of the second transistor allows a connection between the collector and the emitter terminal. But, the input at the collector terminal of the second transistor will be 0 because the input at the first transistor is 0 i.e. there is no connection between the collector and emitter terminal of the first transistor. So, the power supply reaching the collector terminal goes directly to the output terminal, and hence, the LED is ON.
Case 3: Input A = 1 and B = 0
This case is very much similar to Case 2, just the difference is that the first transistor has a HIGH input and the second transistor has LOW input. So, the switch of the first transistor is ON while for the second transistor, it is OFF. So, the output here would be the same as the previous case i.e. the LED will be turned ON.
Also, according to the boolean expression where output, O = (A*B) inverse, and A = 1 and B = 0, the output will be 1. So, the LED is ON.
Case 4: Input A = 1 and B = 1
Here, both the inputs A = 1 and B = 1, so the output will be LOW when calculated using the boolean expression. Since the output is LOW, the LED will also be OFF.
In the hardware, the 5V supply reaches the collector terminal passing through the resistor and since both the transistor has HIGH input, there will be a direct connection between the collector terminal of the first transistor and the emitter terminal of the second transistor. But the second transistor is connected directly with the ground and so, the potential difference between the collector terminal of the first transistor and the emitter terminal of the second transistor is zero. Also, the collector terminal is connected with the output terminal and so, the LED receives 0V and hence the output is LOW.
The above explanation can also be understood by practical demonstration using the video below.
NOTE: In the video, I have not used push buttons for changing values of input A and B instead I have used wires. But would recommend you to use the push-button for easy understanding and implementation.