Building a Physical "Game of Life" πΉοΈ
Yo, my guy, look. Most people play Conwayβs Game of Life on a boring browser tab. Some absolute madman (lcamtuf) decided to spend a "college savings" amount of money to build a 17x17 physical grid of clicky, glowing buttons to do the same thing. π
Itβs tactile, it's expensive, and itβs a masterclass in "because I can." Letβs break down how this beast actually works.
1οΈβ£ WHY? (The Pain vs. The Gain)
Look, computers are great, but they lack soul. π
- The Problem: On a screen, the Game of Life is just moving pixels. Thereβs no "thunk," no "click," and no physical interaction. You're just a bystander.
- The Solution: This project turns a math concept into Interactive Art.
- Tactility: You press a physical switch, it lights up.
- The "Ohhh" Moment: Instead of clicking a mouse, you're "painting" with light and mechanical switches. Itβs the difference between driving a Tesla and a classic stick-shift Mustang.
2οΈβ£ THE BIG PICTURE πΊοΈ
Before we talk chips and wires, understand the layout. We have a 17x17 grid (289 total switches). Each switch has a built-in LED.
THE BRAIN π§
- MCU (Microcontroller): An AVR128DA64. Itβs the boss. It calculates the rules and decides who lives or dies.
THE GRID β‘
- Input: The 289 switches.
- Output: The 289 LEDs inside those switches.
3οΈβ£ THE MECHANICS βοΈ
How do you control 289 things when your chip doesn't have 289 pins? You use Matrix Scanning. π§ β‘
How the Display/Input Works:
- Row Scanning: The system doesn't turn everything on at once. It turns on Row 1, checks the buttons/lights the LEDs, then turns it off. Then Row 2, and so on.
- LED Pumping:
- Because a row is only "on" for 1/17th of the time, it would look dim.
- The Hack: They blast the LEDs with way more current (150mA) than theyβre rated for. Since it's only for a split second, they don't melt. π₯β
- Circuit Protection:
- MOSFETs: Small transistors acting like high-speed gates to handle the heavy current the MCU can't touch.
- Watchdog Timer: If the code freezes while an LED is "blasting," the LED would burn out. The Watchdog kills the power and reboots the system if it hangs for more than 15ms. Safety first, fam. π
The Hardware Stack:
| Component | Purpose | | :--- | :--- | | NKK JB Switches | The $3/piece "clicky" luxury buttons. πΈ | | AVR128DA64 | The "Brain" handling logic and I/O. | | Potentiometer | A fancy knob to control the speed (0 to 10Hz). | | Wooden Case | To make it look like a piece of high-end furniture. πͺ΅ |
4οΈβ£ THE RULES OF THE GAME (Logic) π§¬
If you've forgotten how Conway's Game works, it's basically a "SimCity" for cells:
- Underpopulation: Any live cell with < 2 neighbors dies. (Lonely π’)
- Overpopulation: Any live cell with > 3 neighbors dies. (Crowded π΅βπ«)
- Survival: Any live cell with 2 or 3 neighbors lives on. (Just right β )
- Reproduction: Any dead cell with exactly 3 neighbors becomes alive. (Digital magic β¨)
5οΈβ£ ASCII FLOW: How one "Step" happens
USER TURNS KNOB βββΊ ADC SENSES VOLTAGE βββΊ SETS TICK RATE
β β
βΌ βΌ
SCAN SWITCHES ββββββββββββββββββββββββββ MCU CALCULATES
(Press to Toggle) NEXT GENERATION
β β
ββββββββββββββββββββ¬βββββββββββββββββββββ
βΌ
BLACKOUT WINDOW (ms)
(Update state while LEDs are OFF)
β
βΌ
REFRESH LED MATRIX
(Row by Row, Super Fast)
β‘ LOCK IT IN (TL;DR)
- It's Expensive: The switches alone cost nearly $900. It's a flex. π
- It's Fast: The MCU scans the grid so fast your eyes think itβs a constant image.
- It's Safe: Hardware failsafes (Watchdogs) prevent the high-current LEDs from turning into tiny lightbulbs that explode.
- Itβs Analog-ish: Using a physical knob for speed and physical buttons for "drawing" makes a 50-year-old math game feel brand new.
Yo, final thought: If you want to build this, start saving your lunch money. Those NKK switches don't play. ππ₯