At the silicon level, transistors in a NAND gate function as voltage-controlled switches that pull the output to ground (LOW) only when all inputs are HIGH. If any input drops LOW, the transistor network breaks the path to ground, allowing a pull-up resistor to drive the output HIGH. While modern designs hide this complexity inside 74HC00 or CD4011 integrated circuits, building a NAND gate from discrete transistors on a breadboard remains the ultimate benchmark for understanding digital logic, biasing networks, and semiconductor switching regions.
Discrete Topologies: BJT vs. MOSFET NAND Gates
When pulling transistors from your component bin to build logic gates, you generally choose between Bipolar Junction Transistors (BJTs) configured in Diode-Transistor Logic (DTL), or Metal-Oxide-Semiconductor FETs (MOSFETs) configured in a discrete CMOS arrangement. Both achieve the NAND truth table, but their electrical behaviors on the bench differ drastically.
| Parameter | BJT Discrete (DTL NAND) | MOSFET Discrete (CMOS NAND) |
|---|---|---|
| Core Components | 1x NPN BJT, 3x Signal Diodes, 3x Resistors | 2x N-Channel MOSFETs, 2x P-Channel MOSFETs |
| Input Impedance | Moderate (kΩ range, draws input current) | Extremely High (MΩ/GΩ, virtually zero DC current) |
| Static Power Draw | Higher (mA range due to biasing resistors) | Near Zero (only draws current during switching transitions) |
| Output Voltage Swing | ~0.2V (LOW) to ~4.8V (HIGH) under light load | 0.0V (LOW) to Vcc (HIGH) rail-to-rail |
| Bench Complexity | Low (Easy to bias, forgiving of floating inputs) | High (Requires exact complementary pairs, prone to ESD/gate punch-through) |
For educational bench builds and robust prototyping, the BJT-based DTL topology is the superior choice. It requires fewer specialized matched components and is far less susceptible to static discharge destroying your gate before you finish wiring it.
The Safe Defaults: Part Numbers and Ratings
When a project requires discrete logic, avoid reaching for high-power switching transistors like the TIP31C. Their massive base-emitter capacitance and low gain will ruin your logic timing and waste milliamps of current. Stick to small-signal defaults:
• NPN BJT: 2N3904 (Vce=40V, Ic=200mA, hFE=100-300) or BC547.
• Signal Diodes: 1N4148 (Fast switching, 100V, 200mA). Do not use 1N400x rectifiers; their reverse recovery time is too slow for logic.
• N-Channel MOSFET (if building CMOS): 2N7000 (Vds=60V, Id=200mA, Vgs(th)=2.0V).
• IC Equivalent: 74HC00 (CMOS, 2V-6V operation) or 74LS00 (TTL, 5V only).
Building a 5V DTL NAND Gate (Step-by-Step)
The Diode-Transistor Logic (DTL) NAND gate uses a diode network to perform the AND function, and a single BJT to perform the NOT (inversion) function. Below is the complete bill of materials and wiring sequence for a 5V system.
Component BOM and Circuit Values
| Ref Des | Component | Value / Part | Function in Circuit |
|---|---|---|---|
| R1 | Resistor | 4.7 kΩ | Pull-up for the input diode network (Node X) |
| D1, D2 | Signal Diode | 1N4148 | Input steering diodes (Anodes to Node X, Cathodes to Inputs A/B) |
| D3 | Signal Diode | 1N4148 | Level-shifting diode (Prevents false turn-on from input LOW leakage) |
| R2 | Resistor | 10 kΩ | Base current limiting resistor for Q1 |
| Q1 | NPN BJT | 2N3904 | Switching transistor (Inverter stage) |
| R3 | Resistor | 1 kΩ | Collector pull-up resistor (Output stage) |
Wiring Sequence and Pinout
2N3904 Pinout: Hold the transistor with the flat side facing you and the leads pointing down. From left to right, the pins are Emitter (E), Base (B), and Collector (C).
- Establish the Input Network: Connect R1 (4.7kΩ) from the 5V rail to an empty row on the breadboard (this is Node X). Connect the anodes of D1 and D2 to Node X. Route the cathode of D1 to Input A, and the cathode of D2 to Input B.
- Add the Level Shifter: Connect the anode of D3 to Node X. Connect the cathode of D3 to one end of R2 (10kΩ).
- Wire the Transistor Base: Connect the other end of R2 to the Base (center pin) of Q1. Connect the Emitter (left pin) directly to the ground rail.
- Complete the Output Stage: Connect R3 (1kΩ) from the 5V rail to the Collector (right pin) of Q1. The junction of R3 and the Collector is your Logic Output.
- Verify: Apply 5V and GND. Use a multimeter to probe the Output. If both Input A and Input B are tied to 5V, the output should read ~0.2V (LOW). If either input is tied to GND, the output should read ~4.8V (HIGH).
Biasing and Transistor Operation Regions
For a transistor to act as a reliable digital switch, it must be biased to operate strictly in two regions: Cutoff (fully OFF) and Saturation (fully ON). The active (linear) region is avoided in digital logic because it causes excessive heat dissipation and ambiguous logic levels.
| Operation Region | Base-Emitter Voltage (Vbe) | Collector-Emitter Voltage (Vce) | Collector Current (Ic) | Logic State |
|---|---|---|---|---|
| Cutoff | < 0.5V | ~ Vcc (5.0V) | 0 mA (Leakage only) | Output HIGH |
| Active (Avoid) | ~ 0.6V - 0.7V | 0.7V to 4.0V | Ib × hFE | Invalid / Heating |
| Saturation | ~ 0.7V - 0.8V | < 0.2V (Vce_sat) | Limited by R3 (Vcc/R3) | Output LOW |
The Biasing Math: Sizing R2
How do we select the 10kΩ base resistor (R2)? We must guarantee saturation when both inputs are HIGH. When Inputs A and B are at 5V, D1 and D2 are reverse-biased. Node X is pulled to 5V via R1. Current flows through D3 and R2 into the base of Q1. Assuming a target collector current (Ic) of 5mA (determined by R3: 5V / 1kΩ), and a conservative minimum DC current gain (hFE) of 100 for the 2N3904, the minimum base current (Ib) required is 5mA / 100 = 0.05mA (50µA).
To ensure hard saturation, we apply an overdrive factor of at least 2 to 5. Let's target an Ib of 0.3mA.
The voltage drop across R2 is Vcc minus the drop across D3 (0.7V) minus Vbe (0.7V):
V_R2 = 5V - 0.7V - 0.7V = 3.6V.
Using Ohm's Law: R2 = 3.6V / 0.3mA = 12kΩ.
We select the next standard lower resistor value, 10kΩ, which provides ~0.36mA of base drive, safely slamming the transistor into saturation without exceeding the 2N3904's maximum base current rating.
Failure Modes and Multimeter Diagnostics
Discrete logic gates fail differently than monolithic ICs. Because you have access to every node, troubleshooting with a digital multimeter (DMM) is straightforward if you know what to look for.
Common Failure Mechanisms
- Thermal Runaway: If R2 is sized too small, excessive base current heats the die, lowering Vbe and drawing even more current. The transistor will fail short (Collector to Emitter), locking the output permanently LOW.
- ESD Gate Punch-Through (MOSFETs only): If you attempt this build with 2N7000 MOSFETs and handle them without a grounded wrist strap, static discharge can blow the microscopic gate oxide, creating a permanent short between Gate and Source.
- Diode Leakage: Using slow, high-leakage rectifier diodes (like 1N4007) instead of 1N4148 signal diodes can cause the input network to fail to pull Node X low enough, leaving Q1 partially in the active region.
How to Test the Circuit with a DMM
- Verify Power Rails: Set DMM to DC Volts. Probe Vcc and GND at the breadboard rails. You must read 4.9V to 5.1V. If it's lower, your pull-up resistors are overloaded or your supply is sagging.
- Check the Input Steering Network: Set DMM to DC Volts. Ground Input A. Probe Node X. It should read ~0.7V (one diode drop). If it reads 5V, D1 is open or installed backward.
- Test the Level Shifter: With both inputs HIGH (5V), probe the cathode of D3. It should read ~1.4V (Vbe + one diode drop). If it reads 5V, R2 is open or the base of Q1 is disconnected.
- Measure Vce(sat): With both inputs HIGH, measure the voltage directly across the Collector and Emitter pins of Q1. A healthy, saturated 2N3904 will read between 0.05V and 0.2V. If it reads >0.5V, the transistor is in the active region (increase base drive by lowering R2) or the transistor is damaged.
- Out-of-Circuit Diode Test: If the gate is stuck, power down. Set the DMM to Diode Test mode. Probe across D1, D2, and D3. You should see ~0.600V forward bias and 'OL' (open loop) in reverse. A reading of 0.00V indicates a shorted diode.
Discrete Transistors vs. Logic ICs: When to Choose Which
While understanding how transistors in a NAND gate operate is foundational, you should rarely build discrete gates for production or complex projects. A single 74HC00 IC contains four NAND gates in a 14-pin package, costs under $0.50, and guarantees matched propagation delays and rail-to-rail CMOS output swings.
Choose Discrete Transistors When:
- You are teaching or learning semiconductor physics, biasing, and saturation regions.
- You need a single, high-current logic gate to drive a heavy relay directly without an extra driver stage (a saturated 2N3904 can sink 200mA, whereas a 74HC00 is limited to ~25mA).
- You are repairing legacy industrial equipment where discrete DTL or RTL logic was used on the board.
Choose Logic ICs (74HC/CD4000) When:
- You need more than two logic gates in your circuit.
- Propagation delay and signal timing are critical (discrete gates suffer from varying turn-on/turn-off times due to base charge storage).
- Board space and power consumption are constrained.
Mastering the discrete build gives you the intuition to debug the IC. When a 74HC00 output fails to pull low, you now know to look for an internal MOSFET stuck in the linear region or an overloaded output stage—exactly the same physics you just measured on your breadboard.






