Welcome to Professor MAD.
Electronics for Everyone.
Today we are going to talk about Logic Gates.
What is a Logic Gate?
There are several different definitions for logic gates which are quite confusing.
Think of a logic gate as any kind of system that takes inputs.
Processes according to a certain logic,
and gives the results as the outputs.
Why are logic gates so important ?
Because we can use logic gates to logically control things.
For an example here is a light bulb.
How we control that turn OFF and turn ON it whenever we need.
Obviously a switch is the first thing that comes to our mind.
When we turn ON the switch the light bulb turns ON,
and when we turn OFF the switch the light bulb turns OFF.
Pretty simple.
Here we have some kind of a system.
It must be powered from an external power source,
such as a battery.
There are two sides that can be used to connect a switch and a light bulb
to the system.
To work the same as the previous example,
We can connect the wires like this.
Since the switch is at OFF State, the bulb is also at OFF State.
When we turn ON the switch, the light bulb turns ON.
When we turn OFF the switch, the light bulb turns OFF.
In this system we are controlling the switch,
so that is the input of this system.
And according to our input the bulb changes its state.
So the bulb is the output of our system.
The input has two states, ON and OFF .
And the output also has same States ON and OFF.
Let's draw a state of the switch in the state of the light in a table.
When we turn ON the switch the light bulb turns ON.
When we turn OFF the switch the light bulb turns OFF.
We call this the truth table of this system.
Here we are getting the same output as the input.
No changes but it's kind of boring.
Let's try to change the output according to a logic.
First let's say we need the opposite of the input as the output.
Our logic must invert the input.
That means when we turn ON the switch the light must turn OFF,
and when we turn OFF the switch the light must turns ON.
This is the truth table for our system.
To achieve this we have to apply some mechanism.
Let's call it system 2.
As earlier this must be connected to a power supply,
an input switch and an output light bulb.
In this system when we turn ON the switch the light bulb must be turned OFF,
and when we turn OFF the switch the light bulb must turn ON.
The internal structure might look like this.
But it's not necessary to know the internal structure.
The important thing about this system is that,
it can be used to change the output according to a certain logic.
When the input is ON the output is turned OFF.
And when the input is turned OFF, the output is turned ON.
This system does not ever give us the same input as output.
So this is called not logic.
A system that always gives us the exact opposite of the input as the output is called a NOT gate.
Let's try for another logic.
Here we have 2 switches as an input,
and a light bulb as an output connected to another system.
This system must work as follows.
If either of the switches is ON, the light must be turned ON.
That is our logic.
Let's name the switches As A and B.
What are the possible input and output States?
According to our logic if neither A nor B is ON, the bulb must be turned OFF.
If the A is ON and the B is OFF, then the light must be turned ON.
If the B is ON and the A is OFF the light must be turned ON.
If both A and B are ON, the light must be turned ON.
We can develop this logic using a system like this.
But it's not necessary to know the internal structure.
Here either A or B as ON, then the bulb as ON.
So this logic is called OR logic.
Let's try another one.
Think we need to turn ON the light if only both switches A and B are ON.
What are the possible States?
If both A and B are OFF, the light must be turned OFF.
If A is ON and B is OFF, the light must be turned OFF.
If the A is OFF and B is ON, the light must be turned OFF.
If A and B are both ON, then the light must be turned ON.
We can develop this logic using the wires like this.
But it's not necessary to know the internal structure.
Here both A and B must be turned ON to turn ON the ball.
So this logic is called AND logic.
NOT gate, OR gate, AND gate
In digital electronics, we use symbols to represent these systems like this.
For ease of understanding let's forget about the power supply.
Let's look closely.
Don't confuse yourselves.
Those are just symbols.
These symbols represent a system that follows its logic.
This is the NOT gate in its symbolic form.
It inverts the input.
This is the OR gate in its symbolic form.
If either of the inputs is ON, then the output turns ON.
This is the AND gate in its symbolic form.
The output turns ON only if all of the inputs are ON.
Those are the 3 fundamental logic gates.
We can build more complex logic circuits by joining these fundamental logic gates.
Joining means we can use the output of one gate as an input of another gate
Every electronic circuit around us is built by connecting
millions of logic gates like this.
For example think we have 2 switches and 4 light bulbs.
We need to switch ON each light bulb individually using these 2 switches.
Can you think of a way to do this?
Two switches have 4 combinations or states.
We can build a system to turn ON one light bulb to just one combination.
So the truth table of the required system will be like this.
How can we develop this system?
We can use logic gates to build this system we need.
Three AND Gates, 3 NOT Gates and an OR Gate.
Let's see how this work.
First what happens when we turn OFF both switches.
Only the bulb S is turning ON.
P, Q and R are at OFF State.
Secondly what happens when we turn ON switch B and keep switch at the off State?
Now only the bulb R is turning ON.
P, Q and S are at OFF State.
Thirdly what happens when we turn ON switch A and turn OFF switch B ?
Now only the bulb Q is turning ON.
P, R and S are at OFF State.
Fourthly, what happens when we turn ON both switches?
Now only the bulb P is turning ON.
Q, R and S are at OFF State.
Likewise we can control 4 bulbs using just 2 switches.
But remember, in reality there must be power supply lines to each logic gate.
Usually those are not shown in the logic circuit diagrams.
Our light bulb controller system may look like this after covering with an enclosure.
Thank you for watching us.
Hit the Like button and subscribe us for more interesting videos.
See you in next lesson.