Logic Gates and its implementation using transistors

Logic gates are semiconductor devices. It is the building block of any digital device. It has basically two input terminals and one output terminal. On the input terminals, we provide a digital signal and on the output terminal, it provides a digital output. To know the operations of various types of logic gates we first need to know what digital signal is?

Buy the components to experiment by yourself.

ComponentsAmazon link for IndiaAmazon link for other countries
BC547 transistorhttps://amzn.to/3qNVJDxhttps://amzn.to/353uz2Y
Push-buttonhttps://amzn.to/3GS4p17https://amzn.to/3KyuJQf
Resistorhttps://amzn.to/3fNl0r3https://amzn.to/3fOKQuY
LEDhttps://amzn.to/3FWf7Cphttps://amzn.to/3KyodJj

You can generate logic high or low states by a push button and a 10kΩ resistor.

Logic Low
Logic High

There are mainly two types of electronic signals.

  1. Analog signal: It is a continuous signal which changes their value according to time. It contains information in the form of frequency, amplitude, phase and time period. Amplitude is highest value or highest height of its waveform which is denoted by ‘a’. Frequency (denoted by ‘f’) of an analog signal is the rate at which signal changes or repeats their period. Phase of a signal is its position with respect to time. The range of analog signal value is not fixed. An example of an analog signal is sine wave.
Analog signal
  1. Digital signal: – It is a discrete signal which changes their values in only in two states, either low or high, which is denoted by 0 and 1. It carries the information or data in the form of these 0s or 1s which is called bit. 1 represents the high voltage and 0 represent ground or 0 volt electrically. Frequency of a digital signal is inversely proportional to time taken to complete one cycle of that signal.
Digital signal

Now, let’s get to the main topic which is logic gates. There are three basic logic gates which are AND, OR, and NOT. Many logic gates can be formed through these three universal logic gates. Important extracted gates are NAND, NOR, Exclusive-OR (XOR), Exclusive-NOR (XNOR), etc. XOR and XNOR are called universal logic gates because using these gates we can implement any boolean expression and build that circuit.

AND gate

It has two or more input terminal and one output terminal. It performs AND operation which means input 1 and input 2 both should be true or high for high output. Let it understand through figures and truth table.

Symbol of AND gate

Symbol of AND gate
Figure 3. AND Gate symbol

Truth table of AND gate

AND gate truth table
Figure 4. AND Gate truth table

Boolean expression for this gate is “Y = A.B”.

You can clearly observe above that output is high only when both inputs are high. Now, let’s see how we can implement AND gate using transistors.

AND gate using transistor
Figure 5. Implementing AND Gate using transistors

In the above circuit diagram, you can see when input A and input B is zero LED is not glowing. But when the both input is high LED is turned on. See the figure below.

Implementing AND Gate using transistors

Let’s now understand how this circuit works. As you can see two BC547 transistors are connected in series whose base terminals are initially input. When both input terminals are low, not even one transistor is in ON state. In this condition both transistors are blocking the current flow through the LED, so, LED is not glowing, that means output is low. When input A or B is high and other is low, any one transistor is ON and other is OFF. In this condition, one transistor allows the current flow but other blocks. Even in this condition, current is not flowing through LED, so LED is off. But when both the inputs are high then both transistors allows the current flow and current is passing through LED, i.e. on condition.     

OR Gate

This logic gate performs OR operation. It means for high output, any one or both input terminals should be high. 

Symbol of OR gate

Symbol of OR gate
Figure 7. OR Gate symbol

Truth table of OR gate

OR gate truth table
Figure 8. OR Gate truth table

Boolean expression for this gate is “Y = A + B”.

You can observe that output is high only if any one or both input is high. In the circuit below, OR gate is implemented through transistors.

OR gate using transistors

Let’s check whether the circuit follows the truth table.

Implementing OR gate using transistors

When the input A is high output goes high.

OR gate implementation using transistors

Yes, this circuit follows the truth table of OR gate. Let’s see how this circuit works. There are two transistors are connected in parallel in the circuit and previously, base of both transistors are connected to input terminals. If any one or both transistors allow the current flow then current will flow through the LED and LED will glow. When both input terminals are low both transistors are blocking current flow through the LED. But when any one of the input is high then any one transistor will pass the current and LED will glow.

NOT Gate

 This logic gate inverts the input signal. When input is high, output will be low and when output is low then output will be high. Therefore, it is also known as inverter.

Symbol of NOT gate

NOT gate symbol
Figure 12. NOT Gate symbol

Truth table of NOT gate

NOT gate truth table
Figure 13. NOT Gate truth table

Boolean expression for this gate is “Y = Ā”.

Circuit of NOT gate using transistor is as shown below:

NOT gate using transistor

In the above figure, input terminal is low but output is high, because the transistor is in OFF state and current is not flowing through it rather it is flowing through the LED. So, LED is glowing.

Implementation of NOT gate using transistor

In the above figure, input is high but output is low, because the transistor is in ON condition and current will flow through the transistor but not through the LED due to its high resistance.

NAND Gate

This gate is combination of AND gate and NOT gate. The output of AND gate is connected to the input of NOT gate. Its output is reverse of AND gate.

NAND gate symbol

NAND Gate symbol
Figure 16. NAND Gate symbol

Truth table of NAND gate

NAND Gate truth table
Figure 17. NAND Gate truth table

Boolean expression for this gate is “”.

Now, let’s see how we can implement this gate using transistors.

NAND gate using transistors

Here, circuit is same as AND gate but output is same as NOT gate. That means, when both input is high current will flow through both transistors otherwise it will flow through the LED. Now, see these pictures.

Implementation of NAND gate using transistors

In this condition, input A is high, input B is low and output is high, because, even now current is flowing through the LED.

NAND gate implementation using transistors

This is the condition where current is flowing through the transistors.

NOR gate

This gate is made by combining OR gate and NOT gate. The output terminal of OR gate is connected to input terminal of NOT gate and same here, the output is become opposite to the OR gate.

 Symbol of NOR gate

NOR gate symbol
Figure 21. NOR gate symbol

Truth table of NOR gate

NOR Gate truth table
Figure 23. NOR Gate truth table

Boolean expression for OR gate is “”.

Circuit for NOR gate using transistor is given below.

NOR gate using transistors

In the above circuit, transistors are connected same as the OR gate but output is same as NOT gate. When any input terminal is high then current will flow through any transistor. In the above figure, both input terminals are at low state. So, current will flow through the LED. Now, let’s see different conditions.

Implementation of NOR gate using transistors

In this condition, input A is high so current will flow through transistor Q1.

NOR gate Implementation using transistors

In this condition, current is flowing through both transistors.

XOR gate

It is also pronounced as EX-OR or Exclusive OR. It gives high output when one of its input is high and other is low. Let’s see how we can implement this gate using the gates we know.

Symbol of XOR gate

NOR gate symbol
Figure 27. NOR gate symbol

Method 1 for implement XOR gate

First methods for implement XOR gate using other logic gates
Figure 28. Method 1 for implement XOR gate using other logic gates

Method 2 for implementing XOR gate

Second methods for implement XOR gate using other logic gates
Figure 29. Method 2 for implement XOR gate using other logic gates

Truth table of XOR gate

XOR Gate truth table
Figure 30. XOR Gate truth table

Boolean expression for XOR gate is “”.

 Now, let’s draw a circuit diagram which follows the truth table of XOR gate.

In this circuit, Q1 and Q2 transistors are connected same as AND gate and base of these transistors are connected to input terminals. Transistors Q3 and Q4 are connected same as OR gate and base of these transistors are connected to the same input terminals and these transistor is powered by NAND output of Q1 and Q2. An LED is connected to OR output of Q3 and Q4 I.e. output of XOR gate. When both inputs are low Q1 and Q2 are not allowing the current flow so Q3 and Q4 are getting the powered, but since inputs are low so current is not even flowing through these transistors. So, LED is not glowing.

In this condition current is not flowing through Q1 and Q2, so, Q3 and Q4 are getting powered as input B is high so Q4 is flowing the current through LED and it is glowing. Same thing happens when inputs are opposite.

In such condition when both inputs are high current is flowing through Q1 and Q2. So, Q3 and Q4 are not getting powered.

XNOR gate

This gate is made by connecting XOR gate and NOT gate. Output of XOR gate is connected to the output of the NOT gate. Output of XNOR gate is reverse of XOR gate because of NOT gate.

Symbol

Figure 35. XNOR gate symbol

Implementation of XNOR gate using other logic gates

Implementation of  XOR gate using other logic gates
Figure 36. Implement XOR gate using other logic gates

Truth table XNOR gate

XNOR Gate truth table
Figure 37. XNOR Gate truth table

Boolean expression for this gate is “”.

As always, let’s see the circuit for XNOR gate.

XNOR gate using transistor

In the above circuit, you can see almost everything is same as XOR gate, only difference is that: output of XOR is inverted using another transistor. There is a reason for using another transistor instead of using directly NOT output of XOR gate. When we use direct NOT output, the 1, 1 condition is getting violated because when both inputs are high then current will flow through the Q1 and Q2 transistors and output is low but we want that high.

In this circuit all the outputs are reversed and we got XNOR gate operations.   

Leave a Comment

Your email address will not be published. Required fields are marked *