Basic Logic Gates (NOT, OR, AND) – B1P23
It’s time to learn about logic gates which make up most of the electronics that we see around us.
A logic gate is the building block of digital electronics and it generally has one output, with one or more inputs. We will be looking at 3 basic logic gates in this video.
The first is a NOT gate. This is the symbol for a NOT gate and it has a single input and single output. When working with logic gates, it is common to create something called a truth table that lists out all the possible input combinations along with the corresponding output value. Since we only have one input, it can either be 0 or 1. When the input is 0, the output will be a 1. When the input is 1, the output will be 0. In other words, the NOT gate is said to be an inverter as it inverts the input signal.
Here’s how you can build a NOT gate using a transistor. It is simply a transistor switch that we have used before. This is the input and we have connected an LED to the output. When the input is connected to the positive terminal, it is said to be logic 1. The transistor switches ON, which causes the LED to switch OFF. When the input is connected to the negative terminal or logic 0, the transistor is switched OFF, and the pull-up resistor causes the LED to switch ON.
Let’s use the breadboard layout for the NOT gate to build the circuit and verify its operation.
The output is 0 when the input is 1 and the output is a 1 when the input is 0.
Let’s now talk about the OR gate. The OR gate has one output with a minimum of two inputs (A & B). Each of the inputs could be 1 or 0, which gives us 4 possible combinations as shown here. The output will be 1 when either or both the inputs are 1. The output will be 0 when both the inputs are 0.
Here’s what the transistor equivalent looks like. These are the two inputs and we have connected an LED to the output. It’s easy to see that applying logic 1 to either of the inputs will cause the corresponding transistor to switch ON. This will cause current to flow through R6 which will create a voltage drop that will switch on the LED.
Let’s build the circuit and verify its operation.
The last logic gate for this video is called the AND gate.
It has one output and at least two inputs. The output of the AND gate would be 1 only when both the inputs are 1. In all other cases, the output will be 0.
Here’s what the transistor equivalent looks like. It’s easy to see that we need both the transistors to switch ON, in order for current to flow through R9 giving us an output of 1. In all other cases, there isn’t a path for current to flow and the LED will be switched OFF.
Let’s build and verify the truth table.
These are the basic logic gates that are used to create all sorts of digital circuits. In the next video, we will use these to build universal logic gates that are the building blocks for digital electronics.