Arduino based Bi-color LED Matrix Game of Life


Introduction

Picture of Arduino based Bi-color LED Matrix Game of Life



Conway’s Game of Life is not a conventional game. It is the best-known two-dimensional cellular automaton created by the British mathematician John Horton Conway in 1970.
It is played on a two-dimensional grid of cells. A cell can be dead or alive depending on the state of cells that surround it for each generation. 

Rules:
  • Any live cell with fewer than two live neighbors dies, as if by as if by loneliness (death).
  • Any live cell with more than three live neighbors dies, as if by overcrowding (death).
  • Any live cell with two or three live neighbors stays live (survival).
  • Any dead cell with exactly three live neighbors becomes a live cell (birth).
The Game of Life is played by creating an initial configuration of cells and observing how it evolves. The rules continue to be applied repeatedly to create further generations. Depending on the initial conditions, the cells form various patterns throughout the course of the game.

You may check out this YouTube video link to know more about the Game of Life.

We were inspired by this YouTube video to build one ourselves using the jolliFactory Bi-color LED Matrix module we have created. A Bi-color LED Matrix is able to display in three colors which we think should be good enough for this project.

As usual, we checked through the instructables here to see if someone had built something similar but found none. So here is our Conway’s Game of Life built using 4 jolliFactory Bi-color LED Matrix modules driven by an Arduino Nano.

To build this project, basic electronics knowledge with electronics component soldering skill and some knowledge on using the Arduino are required.

You may view the following YouTube video to see what we are building.




Building the Game of Life

Picture of Building the Game of Life
20130831_131419lowres.jpg20130831_131453lowres.jpg
We will be building a 16X16 Bi-color LED Matrix Game of Life here driven by an Arduino Nano. As we will be using the 8X8 Bi-color (Red and Green) LED Matrix Driver Module kits from jolliFactory, we will need 4 of these modules to build a larger 16X16 LED Matrix display for this project.

You can find this Bi-color LED Matrix Driver Module kit here.

This kit comes with all through-hole components and someone with basic soldering skill should be able to assemble it without much difficulty. See the following YouTube video on how to assemble the LED Matrix Driver Module Kit:



 Follow the video to assemble 4 of these modules for this project.


Wiring

After the 4 LED Matrix kits are completed, they are connected together with the micro-controller as shown in the wiring diagram (LED Matrix not installed for better view). 

Picture of Wiring
One Arduino Nano or compatible microcontroller is used here to drive the electronic circuit setup. Note the use of the 10Kohms pull-down resistor on the LOAD input pins. When power is first applied to the micro-controller or when they are reset, their I/O lines float. The MAX72xx ICs on the LED Matrix modules can see this as valid data and display garbage until the micro-controller gains control. The pull-down resistor prevents this problem.

GameofLifeArduino.jpg

Except for the four Bi-color LED Matrix Driver modules, we hook up the entire circuit on a small piece of perf-board around 100mm x 30mm. See above for our completed circuit on perf-board.


Programming the Arduino Board

Picture of Programming the Arduino Board

There is an excellent library that has been specifically written for the MAX72xx ICs which are used in our jolliFactory Bi-color LED matrix modules which greatly simplifies the sketch – the LedControl library. You will need to download and install the library for this project. 

See the following link for more information about this library and to download the library. 

http://playground.arduino.cc/Main/LedControl 

*** Do note that all the examples that come with the library cater to single color LED Matrix driven by a single MAX7219 IC each and needs to be adapted for use with our Bi-color LED Matrix Driver Modules which is using 2 MAX7219 ICs for each module. Otherwise, there may be some form of 'ghosting' on the displays and may be mistaken to be a hardware issue. 

You may also want to check out the original LedControl documentation for more detail here.

The Arduino board needs to be loaded with the Arduino sketch to run the display.

We used Arduino IDE V1.03 for our project. Download the Arduino sketch for this project below and upload it to your Arduino board. 


Download jolliFactory_GameOfLife_V1_0.ino

We developed the sketch from Game of Life code snippets found online to work with our jolliFactory Bi-color LED Matrix modules. You may amend and enhance the sketch and to produce a more engaging Conway's Game of Life.

** Note that your computer which is used to download the Arduino sketch may not be able to detect your Arduino while connected to the 4 Bi-color LED Matrix modules. The work around is to temporarily remove the LED Matrix modules from the electronic circuit board until your Arduino board is successfully recognized by your computer.


Enclosure and Assembly

Picture of Enclosure and Assembly

GameofLifeAssy2LowRes.jpg

GameofLifeAssy3LowRes.jpg

 
GameofLifeAssy4.jpg






GameofLifeAssy5.jpg





 
CoverLowRes.jpg








We did not put too much effort to build a proper enclosure for this project. In fact, we just re-used the simple box we made for our Audio Spectrum Visualizer project. You may like to check out our Audio Spectrum Visualizer project here.

We may one day build a better and proper enclosure for this project. What we have for the enclosure here is a cardboard box with a rectangular window opening in front. We spray painted it black and cut a grey tinted acrylic sheet to size to fit into our cardboard box to reduce the glare from the LED Matrix displays. We did not even secure the LED Matrix display modules and the perf-board to the enclosure as they fit quite nicely in the enclosure. The pictures show the various stages of assembling the sub-modules together and into the enclosure.


Be mesmerized by LIFE!

Picture of Be mesmerized by LIFE!

Patterns2.jpg

If everything goes well, we are ready to have a go at LIFE.
Power it up and be mesmerized by the changing patterns on the display. The GREEN colored cells are newly populated cells which will turn RED if they managed to survive for a generation and then turn ORANGE if they managed to survive further.
There are Still Life objects, Oscillators, Gliders and many more patterns to be discovered.
Enjoy!


1 comment:

  1. Dear jollifactory, your work is very impressive, do you have an email that I could contact you on?

    ReplyDelete