digiwleeaLearn
Open the lab →

The transistor

A switch you control with a voltage

4 min read

A transistor is a switch you control with a voltage: a small voltage on its gate decides whether current can flow through it. Every logic gate, and ultimately a whole CPU, is built from these voltage-controlled switches.

Build it in the lab →
This is page one, so there is nothing to recall yet. By the end of the course every part on this page will have stacked up into a small 8-bit computer you build and run yourself. It all starts with one component: the transistor.
A transistor is a switch. Instead of flipping it with a finger, a voltage on its gate decides whether it conducts. That one idea, repeated a few billion times, is what a computer is. Two flavors of switch do all the work in this course:
  • NMOS conducts (closes) when its gate sees a 1, and is open when the gate sees a 0.
  • PMOS is the mirror image: it conducts when its gate sees a 0. It is drawn with a small bubble on the gate to remind you it is the inverted one.
Each transistor has three pins: the gate (G, the control) and two channel pins. When it conducts, the two channel pins are connected and a signal can pass between them; when it does not, they are isolated and nothing passes. The gate itself never lets current through to the channel: it only steers, like the handle of a valve.
A concrete picture: think of a transistor as a garden-hose tap. Water (the signal) wants to flow between the two channel pins, and the gate is the tap handle. For an NMOS, turning the handle to 1 opens the tap and water flows; 0 shuts it. A PMOS is a tap plumbed in reverse, open at 0. Crucially, your hand on the handle does not get wet: the gate controls the flow without joining it.
One NMOS passing A through to F only while EN (its gate) is 1. Press Open in lab to flip EN yourself and watch the channel open and close.
Predict, then check
In the switch circuit above, A is held at 1 and EN is the gate of a single NMOS feeding F. What does the probe at F read when EN = 0? When EN = 1?
That is the whole foundation. A 1 or 0 on a gate opens or closes a path, and by arranging these switches between power (VCC) and ground (GND) you can compute anything at all. Curious what is actually inside the switch? Watch one turn on, step by step, in the interactive MOSFET simulator.

Why two kinds?

Having a switch that closes on 1 (NMOS) and one that closes on 0 (PMOS) is what lets a gate always drive its output firmly. Whatever the inputs do, you can arrange for one kind to be pulling while the other is letting go. The next lesson on signals shows why that matters, and Complementary CMOS turns the pair into your first gate.
One subtlety to internalize early: a wire that no closed transistor is driving is not 0, it is floating (Z). Telling those two apart is the very next lesson, and it will save you hours of debugging later.

Frequently asked

What is a transistor?

A transistor is a switch you control with a voltage: a small voltage on its gate decides whether current can flow between its two channel pins. Every logic gate, and ultimately a whole CPU, is built from these voltage-controlled switches.

When does an NMOS transistor conduct?

An NMOS conducts (closes) when its gate sees a 1, and is open when the gate sees a 0. While it conducts, its two channel pins are connected and a signal can pass between them.

What is the difference between an NMOS and a PMOS transistor?

They close on opposite gate values. An NMOS conducts when its gate is 1; a PMOS is the mirror image and conducts when its gate is 0 (it is drawn with a small bubble on the gate to mark the inversion). Having both is what lets a CMOS gate always drive its output firmly.

Does current flow through the gate of a transistor?

No. The gate only steers, like the handle of a valve: it decides whether the two channel pins connect, but current never passes through the gate itself into the channel.

You've got the theory. Now build it from scratch and watch it work.

Build it in the lab →
Found this useful? Share itShare on X