Professional Documents
Culture Documents
You can build any logic gate you want by cobbling together a few transistors and
resistors in just the right way. In this section, I look at simple transistor circuits for five
gate types — NOT, AND, OR, NAND, and NOR — and I present projects to show you
how to build three of them: NOT, NAND, and NOR.
Project 1: A transistor NOT gate circuit
A NOT gate simply inverts its input. If the input is HIGH, the output is LOW, and if the input is
LOW, the output is HIGH. Such a circuit is easy to build, using a single transistor and a pair of
resistors. Figure 3-1 shows the schematic.
The operation of this circuit is simple. The input is connected through resistor R2 to the
transistor’s base. When no voltage is present on the input, the transistor turns off. When the
transistor is off, no current flows through the collector-emitter path. Thus, current from the supply
voltage (Vcc in the schematic, typically between and ) flows through resistor R1 to the
output. In this way, the circuit’s output is HIGH when its input is LOW.
When voltage is present at the input, the transistor turns on, allowing current to flow through the
collector-emitter circuit directly to ground. This ground path creates a shortcut that bypasses the
output, which causes the output to go LOW.
In this way, the output is HIGH when the input is LOW and LOW when the input is HIGH.
Project 1 shows how to assemble a simple transistor NOT gate on a solderless breadboard. For
this project, a normally open push button is used as the input. When the button isn’t pressed, the
input is LOW and the output is HIGH, which causes the LED to light. When you press the button,
the input goes HIGH, the output goes LOW, and the LED goes out. The assembled project is shown
in Figure 3-2 .
FIGURE 3-2: A transistor NOT gate assembled on a breadboard (Project 31).
0 1
1 0
The input to this gate is controlled by a push-button switch (SW1). When the switch is open, the
input is LOW. When the switch is closed, the input is HIGH.
The output from this gate is sent through an LED, so the LED is on when the output is HIGH and
off when the output is LOW.
Parts
Four AA batteries
One four AA battery holder (RadioShack 2700391)
One small solderless breadboard (RadioShack 2760003)
One normally open DIP breadboard push button
One NPN switching transistor, 2N2222A or similar (RadioShack 2761617)
One 5mm red LED (RadioShack 2760209)
Two resistors (brown-black-red)
Three short jumper wires
Steps
1. Insert the transistor Q1.
Collector: G7
Base: G6
Emitter: G5
2. Insert resistors R1 and R2.
: E7 to F7
: E6 to F6
3. Insert LED1.
Cathode (short lead): Ground bus
Anode (long lead): J7
4. Insert SW1.
The pins should be inserted in B4, D4, B6, and D6 such that the switch opens and
closes across rows 4 and 6.
5. Insert the jumper wires.
1: Positive bus to A4
2: Positive bus to A7
3: Ground bus to J5
6. Connect the batteries.
Red lead: Positive bus.
Black lead: Ground bus.
The bases of both transistors are fed through R2 and R3 from the two inputs. Thus, if both inputs
are HIGH, current will flow through the base-emitter path of both transistors, turning both
transistors on and allowing current to flow through to the output. If either input is LOW, the
corresponding transistor turns off, and the output goes LOW.
This NAND gate circuit is almost identical to the AND gate circuit shown in Figure 3-3 , earlier
in this chapter. The only difference is that instead of connecting the output to the emitter of the
second transistor, the output is obtained before the collector of the first transistor. If both of the
inputs are HIGH, both of the transistors will conduct through their collector-emitter paths, which
creates a short circuit to ground. This causes the current to bypass the output altogether, which in
turn causes the output to go LOW.
If either transistor turns off, however, the supply current can’t flow through the transistors to
ground, so it flows through the output circuit instead. Thus, the output is HIGH if either one of the
inputs is LOW. If both inputs are HIGH, the output is LOW.
Project 4 shows how to assemble a simple transistor NAND gate on a solderless breadboard.
Normally open push buttons are used for the two inputs. The LED will be on until you press both
of the push buttons. This action causes both inputs to go HIGH, which causes the output to go LOW
and the LED to go dark. The completed project is shown in Figure 3-5 .
0 0 1
0 1 1
1 0 1
1 1 0
The inputs in this project are provided by two breadboard-mounted push buttons, and the output is
indicated by an LED. The LED is lit unless both of the push buttons are pressed.
Parts
Four AA batteries
One four AA battery holder (RadioShack 2700391)
One small solderless breadboard (RadioShack 2760003)
Two normally open DIP breadboard push buttons
Two NPN switching transistors, 2N2222A or similar (RadioShack 2761617)
One 5mm red LED (RadioShack 2760209)
Three resistors (brown-black-red)
Five short jumper wires
Steps
1. Insert the transistors Q1 and Q2.
Lead Q1 Q2
Collector G7 G11
Base G6 G10
Emitter G5 G9
In the OR gate circuit; the supply voltage is connected separately to the collector of each
transistor. Then the emitters of both transistors are connected to the output. That way, if voltage is
applied to the base of either one of the transistors, that transistor will turn on and pass current
through to the output.
Thus, the output is HIGH if one input is HIGH or both inputs are HIGH. The output is LOW only if
both inputs are LOW.
You can build a two-transistor NOR gate by following the steps outlined in Project 33. As with the
other projects in this chapter, Project 33 uses normally open push buttons to control the input
circuits. When power is applied to this circuit, both inputs initially will be LOW, and the output
will be HIGH. Pressing either one of the switches causes that switch’s input to go HIGH, which in
turn causes the output to go LOW. The assembled project is shown in Figure 3-8 .
FIGURE 3-8: A two-transistor NOR gate on a breadboard (Project 33).
0 0 1
0 1 0
1 0 0
1 1 0
The inputs in this project are provided by two breadboard-mounted push buttons, and the output is
indicated by an LED. The LED is lit unless at least one of the push buttons is pressed.
Parts
Four AA batteries
One four AA battery holder (RadioShack 2700391)
One small solderless breadboard (RadioShack 2760003)
Two normally open DIP breadboard push buttons
Two NPN switching transistors, 2N2222A or similar (RadioShack 2761617)
One 5mm red LED (RadioShack 2760209)
Three resistors (brown-black-red)
Six short jumper wires
Steps
1. Insert the transistors Q1 and Q2.
Lead Q1 Q2
Collector G7 G11
Base G6 G10
Emitter G5 G9