Close
0%
0%

Conway s Game of Life on a LED Cube

Conway s Game of Life on a LED Cube with 16x16 LED on each side

Similar projects worth following
Conway's Game of Life was one of the first programs I programmed on my CPC (in Amstrad Basic). Now I built a Cube with LED, controlled by an Arduino, to play that Game of Life.

Conway's Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970.

The universe of the Game of Life is an infinite, two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, live or dead.

At each step in time, the following transitions occur:

  • Any live cell with fewer than two live neighbours dies, as if by underpopulation.
  • Any live cell with two or three live neighbours lives on to the next generation.
  • Any live cell with more than three live neighbours dies, as if by overpopulation.
  • Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
  • (all other cases: no change of cell state)
  • The surface of a cube: an infinite, two-dimensional orthogonal grid of square cells.

https://en.wikipedia.org/wiki/Conway's_Game_of_Life


For my implementation the universe is:

  • The surface of a cube: an infinite, two-dimensional orthogonal grid of square cells.
  • The cube has one restriction to a flat surface: The cells at each corner of the cube each have only 7 neighbours instead of 8 for cells on the surface or at the edges.


Actual Implementation

See all on my Github Repository

  • Arduino UNO
  • 16x16 LED on each side = 1536 LED in total
  • MAX7219, daisy chained to control all LED
  • Custom LED PCBs
  • 3D printed support structure
  • Some brass rods for stability
  • A big glass globe as dust cover

Hardware and wiring

Power supply:

  • The Arduino and MAX7219 run at 5V. 
  • At most there are 8*24 =192 LED on. With 20mA per LED, the power supply must be able to deliver 3,84A and the wires must be able to handle that load.

Wiring

The Arduino sits outside of the cube, 5V, GND, CS, CLK and Din are wired into to cube. Din is going through all modules as they are daisy chained. The others each have a 6pol connector in the middle of the cube (hot glued to the central cross of the support structure).

I added a few additional components:

  • A potentiometer for setting the brightness
  • A potentiometer for setting the initial density of the random start pattern
  • A button to manually start with a new random pattern

Coordinate system

The GoL universe is a two-dimensional orthogonal grid of square cells. But on a cube surface, a “simple” x-y coordinate system does not work. And additionally, there are two coordinate systems. One describing the position of an LED on the cube and one for this LED in the chain of MAX7219 modules.

To get this all sorted out: Each side (one panel) of the cube has four modules directly connected and the cube is build of 6 such sides.

I define two struct for the coordinates:

struct CubeCoordinates
{
  uint8_t panel; // side of the cube 0..5
  uint8_t x; // x coordinate on panel 0..15
  uint8_t y; // y coordinate on panel 0..15
};

struct ModuleCoordinates
{
  uint8_t addr; // address of module 0..23
  uint8_t row;  // row on module 0..7
  uint8_t column; // column on module 0..7
};

The origin (x=0|y=0) of each side (panel) is on the lower left. The modules are placed and rotated as shown below, (offset is panelNumber * 4):

This way I can convert from CubeCoordinates to ModuleCoordinates (the other way is not needed).

ModuleCoordinates Cube2Module(CubeCoordinates c)

Next problem is finding the neighbours at the edges and corners, where the adjacent cell is on another panel. That depends on how the panels are aligned to each other. To solve this, I waited until the whole cube was built. By displaying a test pattern, I could easily write down the panel number and orientation of each panel to build the big if/then/else countNeighbours function 

uint8_t countNeighbours(CubeCoordinates c)

With this Pattern the orientation of each panel can be seen and the coordinate transformation, if a neighbour is outside of the panel, can be determined.


Software

To test, if my idea would work, I used ready-made MAX7219 modules with LED...

Read more »

  • Finished

    Christian08/10/2025 at 16:37 0 comments

    Detailed documentation is in progress :-)

  • Housing

    Christian07/31/2025 at 11:19 0 comments

    The housing will be a glass dome with a wooden plate.

    The power connection and potis for start density and brightness as well a separate reset button will be underneth the wooden plate.

    I bought some enamelled copper wire (0,85mm) to get all electrical signals through a brass tube to the inside of the cube. The central cross has a hole for all there wires.

    GND is the brass tube, +5V are two wires, then one wire for CLK, Din and CS.

  • Support Structure

    Christian07/07/2025 at 13:26 0 comments

    The PCBs have to be hold in place by.... something in the cube, and the cube should stand on something.

    1st attempt: fail.

    3 to 4 sides were okay. after that it was simply not possible to wire everything "inside".

    Next attempt: worked! The sides have matching holes and pins on each side. and one cross in the middle holding everthing in place. It also hold the whole cube.

    Building the cross with a small support print to make it all right angled:

    test....

  • Custom PCBs

    Christian07/04/2025 at 08:21 0 comments

    The available LED matrices are quite high, so the edges of the cube would be... just no, so new PCBs have to be devloped with minimal gap at the edges.

    [placeholder: picture of LED Matrix at 90°]

    The circuit is quite simple (so I should have read the manual a litte bit better - see pic below).

    At first I thought of doing through hole LEDs, but solder 1536 LED? And wher to put the MAX7219? So decision: all SMD.

    I ordered the PCSs and stencils at PCBWay and build all boards, took some time ;-)

    What I learned while building the PBC:

    • A hotplate is needed, so I bought a hotplate soldering station (yes you could do without, but this way it easier)
    • A hot air soldering station is needed, so I bought a hot air soldering station (yes you could do without, but this way it easier)
    • I need magnifying glasses for placing the components :-D
    • Adjusting the air flow of your hot air station is essential (or your 0805 get blown away)
    • It is fun to see, how the components slide into place when the soldering paste gets liquid.

    Below a picture of finishing of one PCB: adding the connectors.

  • MAX7219 wiring and LED coordinates

    Christian07/04/2025 at 06:33 0 comments

    • a Cube has 6 sides (I call it panels in the code)
    • each side has 4 MAX7219 modules 
    • how do I get from CubeCoordinates (side, x, y) to the actual ModuleAddress (module address, column, row)

    The MAX7219 are wired as shown here:

    I printed a very simple support to connect the 4 modules for one side.

    The origin for each side is on the lower left. On each side the coordinates are x and y. 

    Offset is the number of the side number (0..5) * 4. So from the CubeCoordinates to ModuleCoordinates all is clear :-)

    But for Conway's Game of Life, the neighbours have to be counted. And the neighbour could be on another side. But that has to be done in another step, as this involves how the cube ia actually build and how the sides are connected to each other. For now each side is on its own.

View all 5 project logs

Enjoy this project?

Share

Discussions

Does this project spark your interest?

Become a member to follow this project and never miss any updates