Build a AND Gate From Transistors




About: “Let the future tell the truth, and evaluate each one according to his work and accomplishments. The present is theirs; the future, for which I have really worked, is mine.” Nikola Tesla

In this guide I will show you how to build a AND gate with two NPN transistors.

Using the image above as a reference, we see that our transistor has three (3) pins. A collector (C), base (B), and emitter (E). Functionally, the transistor acts as an electronic switch, with the base input controlling whether or not there will be a flow of electricity from collector to emitter. There are different types of transistors with different purposes; from high speed switching to amplification, but in this guide we are just using the NPN transistor as a switch.

Step 1: Parts List

To build a logic AND gate you are going to need the following parts:

  • 1x Breadboard
  • 1x LED (Any color, red was used in this project)
  • 1x 1K Ohm resistor
  • 2x 10K Ohm resistors
  • 2x NPN Transistors (I used the 2N2222)
  • 2x N.O. Push buttons (Normally Open)
  • 5x Wires/Jumper Wires

The only prerequisite to this project is the ability to read and construct a circuit from a schematic.

Step 2: Schematic / Truth Table

Construct the gate of out the schematic above. ^

Every gate has its own truth table stating what the output will be based on the state of its inputs. For the AND gate, the table is as follows:

0  0  0
0  1  0
1  0  0
1  1  1

You see, the only time the output is ON (1), is when both A AND B are ON (1). Any other state results in the output being OFF (0).

That is it for the AND gate. A seemingly simple device, but when arranged in certain combinations with other gates (NAND, OR, NOR, XOR, XNOR, NOT) we get devices from computers to cell phones and rocket guidance systems.



    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest
    • 1 Hour Challenge

      1 Hour Challenge
    • Classroom Science Contest

      Classroom Science Contest

    13 Discussions


    Question 1 year ago on Step 2

    Hello, Could you make a schematic using (im new to all these electronics and dont understand the schematic you drawn out)

    1 answer

    Answer 1 year ago

    I don't know about Fritzing, but if you use Logisim it's really easy to build. If you look at the picture provided you'll see that I used two "pins" (labeled A and B) this basically represents a binary input of 1 or 0, and these pins are connected to the base of each transistor. (see here) Next, the Power symbol (At the top of the image) is placed onto the collector of the first tranistor (Power is found under the Wiring Section) and the Emitter of the first transistor is connected to the Collector of the second. Thirdly, the Emmiter of the second transistor goes straight to a "Pull Resistor" and also branches off to go to the output. (In this case I used both an LED and a "Probe")

    P.S: If you didn't understand what I said or couldn't get the circuit to work, it might be better if you downloaded the circuit and have a look yourself.

    jvan zuijlenGaneshR3

    Reply 3 years ago on Introduction

    Came here to find the answer to that question too... I know that the 1K resistor is there to serve as a pull-down for the output. Also, if it weren't there and A and B where high the current through the transistors would become too high, so it act as a current limiter as well. What the function of the 10k resistors are I don't know? Normally base resistors are there to limit base-emitter current, but to the best of my knowledge that's already done by 1k resistor. Can anyone enlighten?

    zaq.carsonjvan zuijlen

    Reply 1 year ago

    The 10k resistors aren't strictly necessary, but they improve efficiency. It takes much less voltage to operate a transistor's base than it takes to operate an LED, so you can add the 10k resistors to limit the base-emitter current to a lower level compared to relying solely on the same resistor used for the LED circuit (the 1k). This lets you use less energy. At the same time though, you still need SOME voltage at the base for the transistor to work. If you cut it too low then the main current through the transistor will be too low, and your LED won't light. The choice of 10k is a compromise between keeping the LED lit while minimizing the energy draw.

    Phil B

    4 years ago on Introduction

    I know various types of gates, including AND gates are very important for logic circuits. One of my daughters gave me an experimenter's electronics kit from Radio Shack with the idea I would show things to my grandchildren (her nephew and niece), but most of the circuit are various types of logic gates. I might get a warm feeling from building a logic gate, but what can I do with a logic gate without connecting it to lots of other circuitry? Other than a demonstration piece what can I do with a logic gate?

    4 replies
    MudbudPhil B

    Reply 4 years ago on Introduction

    Think of a logic gate like a single Lego brick, there isn't much you can do with just one.

    Phil BMudbud

    Reply 4 years ago on Introduction

    Thank you for the response. I am wondering what I can do in behalf of my young grandchildren by demonstrating various logic gates one at a time. I did already buy a binary clock kit. I did most of the assembly and left a few things to be done so my granddaughter's attention span would not flag too early. It worked out well and she though it was pretty interesting for a few minutes. I was thinking more in terms of projects like a radio or some type of alarm set off when a light beam is cut, etc. So, I am looking around at various experimenter projects, even if I need to buy extra components.

    MudbudPhil B

    Reply 4 years ago on Introduction

    It really depends on how much they are interested in electronics. For example, my 12 year old brother has virtually no interest in building circuits or anything related. And explaining some of the things I build with him he doesn't understand.

    As for a project involving logic gates I really think a binary calculator that can add/subtract would be a great example. But again its pretty complex to build and then explain it to someone (In my opinion)

    KHollesteinPhil B

    Reply 4 years ago

    just think of any two that you want signals of, before the third signal is turned on:
    for example:
    turn the DVD-player on, turn the TV on, and automatically the stereo is turned on.
    a pressure sensor in the doormat and a signals in a infrared sensor results in a alarm
    or the other way around:
    when you turn off or the lights outside or the lights in the shed, the lights in the garage turn of too
    or, as the negative can also be true
    when your carlights are on and the door opens, a signal sounds

    and so on...
    anything that requeres "decissions" with two, or more inputs.


    4 years ago on Introduction

    There's something that makes me happy about making complex logic gates. So many great memories from school.