A NAND gate is a logic gate where the output goes LOW (or “0”) only if all its inputs are HIGH (or “1”). The schematic symbol for a NAND gate is like the AND gate, just with a circle at the output to indicate that it’s an inverted version of AND.
“NAND” stands for NOT-AND because it’s the same as an AND gate with a NOT gate on the output.
The logic or Boolean expression for a NAND gate is which means that:
If A or B is false, then Q is true
NAND gates can have more than two inputs. But no matter how many inputs it has, it will only give out a LOW or logic “0” if all its inputs are HIGH. As soon as one of the inputs goes LOW, the output goes HIGH.
2-input NAND Gate Truth Table
|Input A||Input B||Output Q|
3-input NAND Gate Truth Table
|Input A||Input B||Input C||Output Q|
Build a Transistor NAND Gate with RTL
You can build a NAND gate from transistors and resistors. This technique is called resistor-transistor logic (RTL).
To get a LOW output, both transistors must be turned on. Otherwise, the output will be pulled HIGH through the top resistor. That means both A and B must be HIGH for the output to become LOW.
Although you could build it with transistors and resistors, it’s not really practical. You’ll need a lot of components just to make a simple logic gate. Luckily, there are many ICs that you can use out-of-the-box.
IC Alternatives with NAND Gates
- 4011: Four 2-input NAND gates
- 4023: Three 3-input NAND gates
- 4093: Four 2-input NAND gates (Schmitt trigger inputs)
- 4572: One NAND gate (plus a few other gates)
- 40107: Two 2-input NAND gates
- 74HC00: Four 2-input NAND gates (HC is the family, can also be LS/HCT/…)
- 74HC01: Four 2-input NAND gates (HC is the family, can also be LS/HCT/…)
- 74HC03: Four 2-input NAND gates (HC is the family, can also be LS/HCT/…)
- 74HC10: Three 3-input NAND (HC is the family, can also be LS/HCT/…)
- 74HC11: Three 3-input NAND (HC is the family, can also be LS/HCT/…)
These should all be available as hobbyist-friendly through-hole chips. Just make sure you buy the DIP package version.
NAND Example Circuit: SR Latch
A typical circuit you can build with two NAND gates is an SR latch. It will remember the last output value it had, so it’s a simple form of memory.
In the following circuit, you can turn the Light-Emitting Diode (LED) on by touching the On pad. The LED will stay on even after you release the button. To turn the LED off, you can press the Off pad.
The touch pads are just two pieces of metal that are not touching each other. They should be placed close enough so that your finger touches them both when pressing.
Next Step in the Logic Gates Tutorial
Check out the other articles in this logic gates tutorial: