Introduction: LED Matrix Game of Life 16x16

Picture of LED Matrix Game of Life 16x16

This project is inspired by the JolliFactory bi-color LED matrix display that runs Conway's Game of Life. I wanted one of my own to put on my wall, as an ornament on my desk, or wherever I feel like adding a bit of binary art. The build is actually pretty straightforward, and the main difficulty was in parsing the 16 by 16 matrix into 4 smaller 8x8 matrices, and aligning them with each of the four displays.

Contrary to JolliFactory's project, I am running all four matrix displays cascaded together (JolliFactory runs two-matrix units in parallel). Also, I am using single colour matrix displays, since they're cheap and plentiful on eBay.

Step 1: Tools & Materials

Picture of Tools & Materials

This project uses a minimum of parts, and is a pretty easy build, hardware-wise. I've built some very complicated hand-wired boards, so this was a refreshing change.

Tools:

  • Soldering iron. You'll need to assemble the kits, which consist of soldering pin headers into a pcb. Really easy.
  • Electrical tape. To tape things up.

Materials:

  1. Arduino, choose whatever flavour you like. I started with an Uno for testing, then moved the code to a Nano with a dead FTDI chip, for a more permanent install. I tried a Pro Mini, which worked, but I wanted to do something with the Nano I've got that doesn't work quite right. $5 or so.
  2. 4 x MAX7219 Dot Matrix Displays. I bought a pack of 5 on eBay for about 10 bucks CAD. $10 (with one spare)
  3. Female jumper wires. Or hook-up wires. Or some kind of wire. $1 for 40, so... about 1.5 cents?
  4. Some sort of external power supply to run it independently. I used a charger for a bluetooth headset, which delivers 150 mA (more than enough to run this display). Anything that will deliver at least 5 volts and at least 50 mA will be fine.

Total Cost:

That brings us to a total cost of around fifteen bucks. Oh, wait, I still have one module left over for something else, so maybe I should factor that in. Make it 14 bucks. Not too much for a pretty cool little project.

Step 2: Hardware

Picture of Hardware

This part is actually pretty easy. Solder the female headers into the PCBs. We're going to string four of these modules together, in two pairs. Solder the right-angle pin headers onto the input of one board, but don't solder the output yet.

You want to bend the output pin headers into a horseshoe shape. Take your time, and try to get them so they hold the two circuit boards together, then solder the output of one board to the input of the next.

Now do it all again. You've got two assemblies of two boards each, and each has an input pin header. Solder an output pin header to only one of the two assemblies. The output will be necessary to daisy-chain the two assemblies together.

Finally, use some jumper wires to connect the output you just soldered to the input of the second assembly. I took some time and shortened the wires to make them look more tidy, since I'll be displaying this with the wiring exposed, but you don't have to. Just make sure to wire the output to the input.

Step 3: Connect the Arduino

Picture of Connect the Arduino

So now we have our matrix display all set, we need to connect the arduino to it. I used an Uno for testing, but since I went to all that trouble, you don't have to. A Pro Mini would be a good choice here, since you can hard-wire it up and leave it alone.

I opted to not include any additional hardware, such as a button or variable resistor to select brightness or delay. In my opinion, those will change so rarely that I can just reflash the firmware and be happy with it. If you want to add in anything else, consider using an interrupt to watch for input, since updating the display can take upwards of a tenth of a second (measured directly in my brain, so no guarantees on accuracy there).

Before connecting all the matrices, try connecting to one and using the code provided in the examples in the LedControl library. This will tell you if it's working properly, then you can move on to connecting the big grid. There's another example in the library for cascaded matrices - now would be a good time to try that one.

Step 4: Exploring the Software

Picture of Exploring the Software

tl;dr - use this sketch to test your setup.

Since I decided to use a lot of the source code published in JolliFactory's instructable, I needed to spend some time figuring out how to parse the big matrix into four smaller ones. The difference in both hardware and configuration meant I had to do some puzzling.

And please, learn from my mistakes: if you're going to use a switch-case in your code, you're gunna need to put in breaks. Seriously, you don't want to know how long it took me to figure out why three of my four displays were showing the fourth display's values.

I wrote an entirely separate sketch, using the LedControl library's example code. All it does is display numbers on each display. The idea is to show the numbers one through four on each display, to ensure that the translation is working properly. I would embed the code here, but for some reason I can't figure out how to embed the github repo (even though it says I can) - if you know how, leave instructions in the comments!

I hooked everything up, and it didn't work. Not only were there missing breaks in my switch-case, but two of the four displays were inverted, and none were in the right order.

Don't worry if this happens to you. I've commented the code with useful lines for hardware configurations that might be different than the one I put together.

If the test code works properly, you'll see digits one through four display as seen above. If you uncomment the shiftUp line in the loop, you should see them slowly scroll upwards, and wrap from the bottom. If all of that works as expected, you're ready to move on to the next step.

Step 5: Bringing It to Life!

Picture of Bringing It to Life!

Now that we've got everything figured out, we can bring it to "Life," so to speak. Here's the sketch to do just that. The reason for all the testing earlier is just to make sure our setup is working as expected. 99% of people would never know if you didn't bother to get things configured properly, but I'm one of those whom it would bother. Also, I use "whom" in a sentence...

If you're not familiar with Conway's Game of Life, I recommend checking it out. It's a simple set of rules that can result in some wonderfully complex behaviour and patterns. I didn't change anything regarding the computations of the game, just rewrote the display functions to suit my hardware.

I think what's most interesting about it is how it mimics what you might find in nature. That is, complex patterns and behaviours resulting from a simple set of rules. Sort of like the Phi Ratio (or Golden Ratio, as it's known among non-nerds).

Step 6: It's All About the Packaging!

Picture of It's All About the Packaging!

Now to make a nice package for our setup. I made mine by wrapping the assembly in white electrical tape. Seriously. It holds the boards together, and you can cut slots for the pin headers.

I'm sure you can make it look prettier than mine. I'll be keeping my eye open for deep picture frames at the thrift store, and eventually I plan on throwing this into a more suitable enclosure. For the time being, electrical tape works just fine.

That's it! You're done! Just plug in the power supply, and watch it happily chug away in all its mathematical braininess. And revel in just how smart you think you look, even though the rules are really quite simple.

Comments

PrzemekM1 (author)2015-10-13

nice! I've made game of life on matrix too :) see:

https://www.youtube.com/watch?v=-HLWKOnfQCk

About This Instructable

6,949views

107favorites

License:

Bio: Teacher in Canada. Complete techno-junkie. Open-sorcerer. Scriptographer. I am devoted to learning - teaching just sort of follows...
More by jptrsn:Haunted Portrait for less than $20Insulated Sleeping Pad (thermarest)Enterprise-Grade Network on a Budget
Add instructable to: