⚡ Spark Academy53 lessons

Binary & Logic Gates

Throw away the in-between voltages and keep only ON and OFF — suddenly circuits can reason.

lesson 1 of 3 in this unit

Builds on: 3.2 Transistors6.1 The Operational Amplifier

Why only two levels?

Analog signals carry infinite shades — and every shade of noise, too. Digital electronics makes a radical trade: only two voltage levels count. Near 0 V is 0 (false), near the supply is 1 (true), and anything drifting in between gets snapped back to the nearest rail at every stage. Noise that would permanently smear an analog signal gets erased at each step — that’s why a photo can be copied a billion times without degrading. You already know the hardware trick: a transistor in cutoff or saturation (Lesson 3.2), skipping the analog middle entirely.

Gates: decisions in silicon

A logic gate is a few transistors wired to compute a yes/no answer from yes/no inputs. The vocabulary is tiny:

  • NOT — output is the opposite. (One transistor: your Lesson 3.2 switch — base high pulls the collector low.)
  • AND — 1 only if both inputs are 1 (two switches in series — Lesson 1.5!).
  • OR — 1 if either input is 1 (two switches in parallel).
  • NAND / NOR — AND/OR with a built-in NOT.
  • XOR — 1 if the inputs differ. Remember this one: it’s about to do arithmetic.

A gate is fully described by its truth table — every input combo and its output. Nothing about a gate is mysterious: it is a lookup table made of switches.

NAND is enough

Here’s the astonishing part: every logic function — and therefore every computer — can be built from NAND gates alone. Tie a NAND’s inputs together: NOT. Follow it with that NOT: AND. Feed it NOTed inputs: OR. The Apollo Guidance Computer that landed on the Moon was built almost entirely from one type of 3-input NOR chip — the same idea. Master one gate, own them all.

From gates to your CPU

A modern processor is tens of billions of transistors arranged as gates. The rest of this unit climbs that ladder’s first two rungs: gates that add, and gates that remember.

⚡ Lab — The Gate Playground

Every basic gate, two clickable switches, one glowing verdict.

  • Walk each gate through all four input combos and watch the truth table track you.
  • Find the two gates that disagree on the 1,1 row (AND vs XOR).
  • Convince yourself NAND is NOT-of-AND on every row.
ABAND output
000
010
100
111

Check your understanding

Q1. A NAND gate with both inputs at 1 outputs…

Q2. XOR outputs 1 when…

Q3. Digital circuits resist noise because…

Q4. Why is NAND called a universal gate?