This is the Arduino implementation of the Conway's Game of Life. Made up from only 2 main components: Matrix display and Arduino Nano.
Cellular Automata Introduction
Conway's Game of Life is a famous zero-player game that simulates the evolution of a population of cells on a grid. Based on a set of simple mathematical rules, complex patterns emerge from a simple initial state. This Arduino implementation brings this classical simulation into the physical world, creating a mesmerizing display of digital life on a compact LED matrix.
Hardware Display System
- Arduino Nano: The compact processing brain that calculates the rules for every life cycle.
- MAX7219 8x8 LED Matrix: Acting as the "grid" for our cellular environment. Each of the 64 LEDs represents a single cell that can be either "Alive" (ON) or "Dead" (OFF).
- SPI Communication: The MAX7219 chip allows the Arduino to control all 64 LEDs using only three digital pins, making the wiring extremely efficient.
- Breadboard Powering: The system is compact and draws very little current, allowing it to be powered directly from the Nano's USB port.
Algorithmic Logic and Rules
The simulation progresses in discrete "generations." For every cycle, the Arduino applies the following rules to every cell simultaneously:
- Survival: Any live cell with 2 or 3 live neighbors survives to the next generation.
- Death (Underpopulation): Any live cell with fewer than 2 live neighbors dies.
- Death (Overpopulation): Any live cell with more than 3 live neighbors dies.
- Birth: Any dead cell with exactly 3 live neighbors becomes a live cell.
The code maintains two "buffers" (arrays) in memory. It calculates the next state based on the current buffer and then swaps them to update the display. This ensures that the calculation for one cell does not interfere with its neighbors during the same generation.
Watching Patterns Evolve
While the grid is only 8x8, you can witness the emergence of several classic life patterns:
- Oscillators: Patterns that flip back and forth between two states (like a blinking line).
- Still Life: Stable patterns that never change unless hit by an outside force.
- Gliders: Patterns that seem to "move" across the screen (though at 8x8, they reach the edge quickly). By introducing a "random seed" at startup, every time you reset the Arduino, you generate a completely new evolutionary history. This project is a fascinating intersection of Mathematics, Computer Science, and Hardware Design.