Thursday, March 28, 2013

Logic Gates Using Transistor 1 AND Gate- EEE & CSE Lesson

Hello everyone!
Hope you all are in good shape.

Today I'm going to write something about logic gates & how they could be implemented using transistor. To see how it actually works we will be needing a few more stuffs like resistor, light emitting diodes etc!

So, first thing's first. What is a logic gate?

A logic gate is a physical device implementing a Boolean function! That means it performs logical operations! It may take one or more logical inputs & produces single logical output.
For example say you want to buy a new desktop but you are going to need the permission of both your mom & dad! If one of them says "NO" then you wont be getting a new desktop. If both of them says "YES" then u will be getting a desktop! You can put this whole thing in something like a logic gate & you can easily understand that.

Lets look at a picture

Lets assume A is for mom & B is for Dad. Now we all know how transistors work as a switch. If we apply positive voltage to a base of an NPN transistor it will start passing charges through it(usually)!

 And lets assume if the LED lights up you are going to get a desktop! You know a LED will light up if you apply proper voltage with proper polarity!

So, Now lets assume both your mom & dad answered the same. & that's a BIG "NO" so the input for A & B both is 0! As base of each of the transistors are not going to get anything they will remain off! So no current through them! & no positive charge/connection for the LED! It wont light up!

Now lets assume your mom says "YES" & your dad says "NO" now lets see what happens. As the transistor on the top side's BASE has got a "YES" it will say "YES" I'm going to pass current!
But the transistor on the lower side has a "NO" on its base so it wont pass any current! So what happens? Nothing! As one of the series elements are not conducting the LED wont light up! So you are not going to get a desktop! Same explanation for if your Dad says "YES" & Mom says "NO".

Now what will happen if they both say "YES"! as both the transistors gets "YES"(or positive charge) at their bases they will start conducting ! Both the series elements will start conducting so the led will light up! ( Here 4.7Kohm is much more bigger than the 680ohm)

So lets sum up what happened here.

See what we have here?? This is called a truth table! Sounds kinda HOLY!
Simply a truth table is a table used in logic! It is used for computing functional values of logical expressions.

What we actually did then? We have a logic gate using transistors!
This gate is called "AND" gate!

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!


  1. Well, the simplest form of AND gate is obviously AND gate, and the internal Transistor circuitry of an AND gate is a bit more complex than this.
    However, nice post, can you figure out the similar thing for an XOR gate?

    1. thanks.
      couldn't find anything similar for XOR. I have used four NAND gates for a XOR gate (That means about 8 transistors)