## Thursday, March 28, 2013

### Digital Logic Design - AND Gate

This post is about one of the three Basic Logic Gates, AND Gate. In this post I will try to be elaborate that as much possible.

What is an AND Gate?

AND Gate is such a Gate that implements Logical Conjunction that is it will only be true if and only if all of its operands are true. To put it simply an AND Gate will only put out a High output only when all the inputs are High. So the truth table for a two input and gate will look something like this.

Detailed Explanation:

Lets assume three things,
1. A is MOM, B is DAD.
2. You want to go outside to play.
3. You need permission from both of them to outside and play.

What is going to happen then?

You have four possible scenarios.

That's what an AND Gate is.

You can also consider AND Gate with a series of bridges. Again let's assume something.

1. Mr. RED wants to Meet Mr. BLACK.
2. They have two bridges in between them, A and B.
3. There is no other available path except for those bridges.

So what's gonna happen in this case?

They can only meet each other if both the bridges are in working condition. So we can say a High Output only when both Inputs are High.

So lets sum up what happened here.

Constructing AND Gate:

1. With Diode:

To make an AND gate with diode we need
Diodes (Equal to the number of Inputs, 3 for 3 Inputs)
Pair of Resistors.
LED.
SPDT switches (Equal to the number of Inputs, again 3 for 3 Inputs in this case)

The way it works is simple. If any of the switches are in the Ground position the current will pass through the 4.7K resistor via Diode to the Ground. So the LED won't light up. But if all the Switches are in +5V position no Diode is going to conduct any current so the current will find its way through the 470ohm resistor and through the LED which will light it up. So the LED will only light up if all the Inputs are high.

2. With Transistor:

You can compare an AND gate with two series bridges. If you want to get to the other side you will be needing both of them. If any of them is out of order or not available you are not going to get to that desired place.

Assume that Mr. Black wants to meet Mr. Red! The only way is crossing bridges A & B. If one of them is not available then they wouldn't be able to meet!

Its the simplest form of AND gate!

How to make a three input AND gate?
Its also Easy!
Just Add another transistor. About truth table - only if all the Inputs are yes then its output will be yes rest will be no.

This is how a D400 transistor looks like. (sorry about the image quality, I don't have a macro lens)

Where to find transistor & other stuffs?

You can use any common NPN Transistor for this for example D400/2N2222 will be fine & you can find them in any hardware store!