Introduction: LED Matrix Game of Life 32 X 32

About: I'm a programmer who tries to do hardware occasionally.

I was inspired by Jptrsn's16 x16 Game of Life but ended up being four times bigger.

I found some MAX7219 Dot Matrix Module 4-in-1 Display For Arduino boards at for £3.50 when they arrived it turned out to be quite hard to break them apart and use them in a 16x16 grid as I had planned, so I decided to make a 32x32 grid. That's when things turned tricky, as you can't just scale the code up.

Step 1: Parts

I got my parts from BangGood but you can source these anywhere.

1. An Arduino Nano (~£2)

2. 4 1x4 Led Matrixes (~£3.50 x 4) or look for multipacks which are sometimes cheaper

3. Some wire

4. A USB micro socket (< £1)

5. A USB power supply (<£5)

6. A 6"x6" /15cmx15cm Box picture frame (~£4) from local craft store

Step 2: Tools

1. Hot glue gun

2. Soldering iron

3. Wire strippers

4. Sharp knife

Step 3: Breadboard Build

One thing I learned at this point is that a nano (and probably other Arduinos) cannot provide enough power to run all 4 of the matrixes without burning out the power supply! be warned.

When my boards arrived they had only got pins on the input end and the output pins were loose in the bag, or in one case jammed under a display shorting the pins out. It turns out that is not good for these displays (good job I bought 6). You'll need to solder the output pins onto two of the LED matrixes if they are not fitted on yours.

The layout is fairly straightforward, you can daisy chain two of the matrixes together to form two chains by simply connecting the output pins to the matching input pins. You can not chain all of them in one run as the LedControl library is limited to 8 displays at a time.

Then plug DataIn to pin 12, load (or CS) to pin 11 and Clock (or CLK) to pin 10 and for the other chain to 5,4 & 3. Alternatively, you can pick any digital pins you like just remember to change the code to reflect your choice. Then add the USB socket to the breadboard. Then link the v+ and ground pins to the rails of the breadboard. Then you need to plug the power leads from the 2 chains to +ve and ground and tie the Arduino ground to ground. Once we finish programming the board you can link the Arduino vin to v+ and never plug in the Aurdino USB again.

Step 4: Code

At first, I thought all I needed to do was take the existing code and scale it up for 32x32 but it is a little tricker than that. 

1. You need two LedControls as each one can only drive 8 MAX7219s

LedControl lc[2] = { LedControl(12, 10, 11, 8), LedControl(5, 3, 4, 8) };

2. There is not enough memory on a Nano to store 2 full 32x32 byte arrays to keep the board state in. (Finally, all the times I've written Game of Life code on a whiteboard in interviews pays off.) So, we define the board arrays as 32x4 and store the state of each cell as a bit in the bytes across the array.

Step 5: Putting It All Together

First test the code and the layout of the boards is as expected by using the "testPattern" method to draw a diagonal cross across the boards. If this doesn't look right then there is something wrong with the order of the boards and/or the pins you have initialised.

Then check things out with the glider method which creates a glider that moves across the screen. Again if it doesn't work out then check the order of the pins etc.

Finally, set the main method to be "randomize", set NUMITR to the number of times it should repeat before resetting.

Step 6: Frame It Up

Now to put everything in a frame.

First, hot glue the matrixes together into a 32x32 frame. Remember to make sure that the input end is on the same side for all of them (or modify the lookup code in "gridToCell" to allow for the 2nd boards being upside down).

Add the power socket and a switch on the 5v line and solder everything together.

Step 7: Frame Issues

It turns out that you need a larger frame than the 6x6 one I have. So I will need to come back to finish this up when I get a chance to get to the store.

Step 8:

Arduino Contest 2017

Participated in the
Arduino Contest 2017

LED Contest 2017

Participated in the
LED Contest 2017

First Time Author Contest 2018

Participated in the
First Time Author Contest 2018