Teach Your Kid Electronics

Advanced · Project 1

Logic Gate Puzzles

Meet the tiny decision-makers inside every computer. Two buttons go into a logic chip, and an LED shows its answer. Swap the chip and the rules change!

Build this only with an adult present. Before you start, read our safety notice and disclaimer.

Advanced⏱ About 40 min

🧰 What you need

  • 1×Half-size breadboardA board full of little holes with metal clips inside, so you can build circuits without soldering.
  • 1×3×AA battery holder with wire leadsHolds three AA batteries in a row and gives you a red (+) and black (−) wire.
  • 3×AA batteryA regular household battery. Each one gives 1.5 volts.
  • 1×74HC08 AND gate chipFour AND gates: each output is on only when both of its inputs are on.
  • 1×74HC32 OR gate chipFour OR gates: each output is on when either input (or both) is on.
  • 1×74HC86 XOR gate chipFour XOR ("exclusive or") gates: each output is on when exactly one input is on.
  • 2×Push button (tactile switch)A little button with 4 legs. It connects its two sides only while you press it.
  • 2×10 kΩ resistor — brown, black, orange, goldColors: brown, black, orange, gold.
  • 1×220 Ω resistor — red, red, brown, goldOur go-to LED resistor. Colors: red, red, brown, gold.
  • 1×5 mm LED (any color) — any color worksA tiny light that only lets current flow one way. The long leg is +.
  • 15×Jumper wireA short wire with stiff ends that push into the breadboard.

✨ The finished project

Logic gate puzzle: two buttons into a 74HC08 AND gate chip, which lights an LED ++−−++−−aabbccddeeffgghhiijj115510101515202025253030 74HC08 10 kΩ 10 kΩ 220 Ω +− AAAAAA3 × AA = 4.5 V+−
Logic gate puzzle: two buttons into a 74HC08 AND gate chip, which lights an LED ++−−++−−aabbccddeeffgghhiijj115510101515202025253030 74HC08 10 kΩ 10 kΩ 220 Ω +− AAAAAA3 × AA = 4.5 V+−
Schematic: Logic gate puzzle: two buttons into a 74HC08 AND gate chip, which lights an LED 1A11B22A42B53A93B104A124B131Y32Y63Y84Y11VCC14GND774HC08U1 +4.5V +4.5V 4.5 V button 10 kΩ button 10 kΩ 220 Ω red LED
The finished build. This picture is generated from the circuit itself and checked by computer, so every leg is in the right hole.

Every computer, phone and game console is built from billions of tiny logic gates. A logic gate looks at its inputs (each one is either ON = 1 or OFF = 0) and decides whether its output is ON or OFF, following a simple rule. Today you’ll test three of them with your own fingers.

The three chips we use look the same and have exactly the same pins, so you build the circuit once and just swap chips:

  • 74HC08: AND. The output is ON only if input A and input B are both ON.
  • 74HC32: OR. The output is ON if A or B (or both) is ON.
  • 74HC86: XOR (“exclusive or”). The output is ON if exactly one of A or B is ON, but not both.

Each chip has four gates inside. We use gate 1 (pins 1, 2 and 3).

74HC0811A21B31Y42A52B62Y7GND83Y93A103B114Y124A134B14VCC
  • Pin 1 · 1A — input A of gate 1 (button A)
  • Pin 2 · 1B — input B of gate 1 (button B)
  • Pin 3 · 1Y — output of gate 1 (the LED)
  • Pin 7 · GND — connect to battery −
  • Pin 14 · VCC — connect to battery +

Build it

  1. Rail bridges: red T+25 → B+25 (bottom red + rail, column 25), black T-26 → B-26 (bottom blue − rail, column 26).

  2. The chip: start with the 74HC08. Across the middle gap with the notch on the left, so pin 1 is in f12.

  3. Power the chip: red a12 (VCC, pin 14) → T+11 (top red + rail, column 11); black j18 (GND, pin 7) → B-17 (bottom blue − rail, column 17).

  4. Tie the unused inputs to − with black wires: j15, j16 → bottom − rail (B-15, B-16), and a13, a14, a16, a17 → top − rail (T-13, T-14, T-16, T-17).

  5. Button A: across the gap with legs in e3, f3, e5 and f5. Red j3 → B+3 (bottom red + rail, column 3). 10 kΩ pull-down a5 → T-5 (top blue − rail, column 5). Yellow h5 → h12 (input 1A).

  6. Button B: legs in e7, f7, e9, f9. Red j7 → B+7 (bottom red + rail, column 7). 10 kΩ pull-down a9 → T-9 (top blue − rail, column 9). Green g9 → g13 (input 1B).

  7. Output LED: 220 Ω resistor i14 (output 1Y) → i21; LED long leg g21, short leg g22; black j22 → B-22 (bottom blue − rail, column 22).

  8. Power: 3×AA holder red into T+1, black into T-2.

The puzzles

For each chip, try all four button combinations and fill in a truth table on paper (1 = pressed or lit, 0 = not):

ABLED?
00?
01?
10?
11?

Then answer these:

  1. Mystery chip: have a friend swap in one of the chips while you look away. Can you work out which one it is in three presses or fewer?
  2. Safe lock: which chip makes a lock that needs both keys turned at once?
  3. Hallway light: with the XOR chip, each button flips the light: on, off, on, no matter which one you press. That’s how a light with two switches (one at each end of a hallway) works!

The build check tested all three chips with every button combination, so the answers you find are exactly what the chip guarantees.

Not working?

  • LED flickers or acts randomly? An input is floating. Check the pull-down resistors and the six black “unused input” wires.
  • Nothing at all? Check the notch is on the left, and both rail bridges.
  • LED always on? You may have the button rotated so its two sides are already joined. Give it a quarter turn.

Try it!