
Welcome back, logic builders! If you’ve ever looked at a complex microchip and wondered what’s actually going on inside, you’re in the right place. Today, we’re going to pull back the curtain on digital logic by building the foundational building blocks of computers—logic gates—from scratch, using nothing but discrete transistors and a few resistors.
No black boxes, no integrated circuits. Just pure, raw electronics.
Why Transistors?
Before we had billions of microscopic transistors packed onto a silicon die, early computers used discrete components. A transistor, at its core, can act as a simple electronic switch. By cleverly wiring these switches together, we can perform mathematical and logical operations.
Let’s explore the big three: NOT, AND, and OR gates.
1. The NOT Gate (Inverter)
The NOT gate is the simplest logic circuit. It takes an input and gives you the exact opposite. If the input is HIGH (1), the output is LOW (0), and vice versa.
- How to build it: We use a single NPN transistor. The input goes to the base (through a resistor). The emitter connects to ground. The collector is tied to our positive supply voltage (VCC) through a pull-up resistor. We take our output from the collector.
- How it works: When the input is LOW, the transistor is OFF. The pull-up resistor pulls the output HIGH. When the input is HIGH, the transistor turns ON, connecting the output directly to ground, making it LOW.
2. The AND Gate
An AND gate only outputs a HIGH signal if all of its inputs are HIGH. Think of it like a strict bouncer—you need a ticket AND an ID to get in.
- How to build it: We wire two NPN transistors in series (one after the other). The collector of Transistor A connects to VCC. The emitter of Transistor A connects to the collector of Transistor B. The emitter of Transistor B connects to ground via a pull-down resistor, and we take the output from above this resistor.
- How it works: Current can only flow from VCC to the output if both Transistor A and Transistor B are turned ON by HIGH inputs.
3. The OR Gate
An OR gate outputs a HIGH signal if any of its inputs are HIGH. Either one, or both, will do the trick.
- How to build it: We wire two NPN transistors in parallel. Both collectors connect to VCC. Both emitters connect together and then to ground via a pull-down resistor. We take the output from the combined emitters.
- How it works: If either Transistor A OR Transistor B (or both) are turned ON, current flows from VCC to the output, bringing it HIGH.
The Building Blocks of Computing
By combining these three simple circuits, you can build literally anything in the digital world.
- Combine an AND gate and a NOT gate? You get a NAND gate.
- Combine an OR gate and a NOT gate? You get a NOR gate.
- String enough of these together? You can build adders, memory registers, and eventually, a full CPU!
Grab your breadboards and let’s get wiring!
Hardware You’ll Need
To follow along with this lesson, you’ll need the following components: