Introduction: Logic Gates: the AND

Logic gates are the building blocks of computers, and transistors have made logic gates cheap, light weight, and reliable.The transistors' three metal legs -- the collector, base, and emitter -- control the flow of electrons and determine whether the charge is high or low, and these zeros and ones make our digital words, pictures  and sounds.

I'll show you the first logic gate I built. I made it at TechShop.

Microprocessors have millions of gates, but some spare change yields a handful of electronics parts, enough to make a logic gate and to see the beauty of computing one bit at a time.

With two transistors you can create your first logic gate, an AND gate. An AND gate responds when both inputs are high or true. If you’re looking for your black cat, Damian, the thing you want must be both a) black and b) a cat.

Is it black?       Is it a cat?      Could it be Damian?
No                     No                    No
No                     Yes                   No
Yes                    No                    No
Yes                    Yes                   Yes

Now let’s go electric!

Step 1: Parts

Two NPN 2222 transistors

Two push button switches (I got mine from a spare parts box at Tech Shop).

Three resistors (two 1 kilo ohm and one 100 ohm)

A battery and connector

4 bits of wire

Step 2: Planning

Using a circuit simulator, I checked out how the parts would work together. I had planned using a coin cell battery for its low profile, which worked in a simulation. But reality was a bit trickier, so I tripled the power source. The triple current will probably lessen the LED and transistor life, but they've lasted through dozens of trials.


Step 3: Connecting the Parts

There are six tranisistor connections you need to make. Each transistor has three prongs -- from the front, or flat, side of the transistor -- the connector, base, and emitter. For current to flow from collector to emitter, current must be applied to the base. Connect the first collector and both bases to your power source by way of resistor and switch.

The first transistor’s emitter is connected to the second transistor’s collector.

The last emitter is connected to the LED and last resistor, both of which connect to ground.

Step 4: Testing on a Breadboard

Check components on a breadboard one at a time, or take your chances and put them together all at once.

Step 5: Test

Make sure the connections are in place, and see if you're getting the proper response to your inputs.

Step 6: Make It Permanent

After testing the circuit, cut a one-and-a-half inch square perforated (perf) board and begin heating your soldering iron. Umm, wear eye protection. Respect the iron. Minimize distractions. Dejunk your workspace. Don’t grab other things while you’re soldering. 

I took a SBU soldering course at Tech Shop (thanks, Bill). Big hint: make sure your metal contacts are solid. Finally, get both metal contacts hot before applying solder to the iron.

Step 7: Enjoy!

Don't let the blinky LED, or my dirty thumbnail, distract you from the true workhorse -- the transistor, three-pronged conveyor of information.


AchalB1 (author)2016-01-14

I am not very good at electronics. Could you please tell me the use of the resistors in this AND gate? Any response will be greatly appreciated.

Cogtoys (author)AchalB12016-01-14

It's been a while. The 330 resistor is to reduce the current for a regular LED. Otherwise it would pop. I'm guessing I used the other resistors to protect the transistors.

AchalB1 (author)Cogtoys2016-01-14

Thank you!

Cogtoys (author)AchalB12016-01-14

Now I remember. If only one of the gates is closed, the resistance is sufficient to dim the light nearly entirely. Thanks for checking.

• The Inventor • (author)2014-06-24

Very great and neat project, will any NPN transistor work ?


A 2n3094 should work too.