In my search for a better LED matrix, I’ve finally arrived at what actually feels like a finished product: the SmartMatrix from PixelMatix. This comes in a complete kit for $130 with everything that you need to build a nicely finished project. The only thing you have to add is an 8x8 shadowbox frame that sells for less than $10 on Amazon. Since I have sold off my soldering equipment during my move, I opted to order the pre-assembled kit for an additional $20.
With all the hardware taken care of for me, I could focus on the software to make interesting displays, which is what I’ve really wanted to do all along. The SmartMatrix is driven by a Teensy 3.1 from PRJC, which is a tiny ARM microcontroller board that can be programmed with Arduino. It comes with some really nice software called Aurora that has lots of interesting visual displays. I have made my own fork of it to which I’ve added several features.
TPM2 Streaming Mode
One of the first things I wanted to do was add TPM2 streaming over the Teensy’s serial USB connection. This allows the matrix to be controlled from PC software such as Jinx!, PixelController, and Glediator. I made a YouTube video showing off the results:
Instructions for using Streaming Mode are on the Aurora wiki.
The Game of Life
Finally I come full circle to the goal I had stated for myself in my very first LED Matrix post: to run Conway’s Game of Life. Aurora came with a basic game of life implementation that only had one color that cycled through as the generations progressed. I decided I could make it more colorful so I tweaked the algorithm a bit. Each cells is colored according to the number of times it has come to life. Also, as a cell dies, it slowly fades into darkness instead of immediately disappearing. It’s definitely more colorful and feels more, well, organic. I find the effect quite mesmerizing.
After I was satisfied with my changes to the game of life, I went on to implement what is perhaps the original display hack, Munching Squares. This interesting pattern is simply the result of applying the XOR operator to the X and Y coordinates on the grid. It was discovered by the O.G. Hackers at MIT who were programming the PDP-1 in the 60's.
Coincidentally, these same hackers went on to become obsessed with Conway’s Game of Life and discovered and cataloged many of the interesting emergent patterns that the Game of Life produces.
There is an alternative LED Matrix Kit called PIXEL, which has a lot of really cool animated gifs that were designed by artists especially for a 32x32 LED Matrix. I loaded up my SD card with these so now I have a lot more animations to look at.
At one point, I had a scare while uploading a new Aurora sketch and thought my Teensy had bricked itself during reprogramming, but I was eventually able to revive it. Being a tech support engineer by day, my natural instinct is to share my experience in case it helps anyone else out with a similar problem.
When I hit program on the Arduino UI, it encountered a program error, and went completely unresponsive. The matrix wouldn’t light up, Windows said I had connected a USB device that had malfunctioned, and the COM port no longer shows up. I tried disconnecting the power and USB, reconnecting it, reconnecting only the power without USB, hitting the program button multiple times, switching to a different USB port and nothing worked.
I went to the PJRC Teensy forum and found this thread. It seems to be a fairly common problem. Some of the people on the board suggested to either “double-click” the programming button or hold down the button while plugging in the USB cable. I’m not quite sure which, but one of these worked.
When I did it, Windows no longer showed the “one of your USB devices has malfunctioned and is not recognized” error, but I still didn’t see it show up as a COM port. However, I noticed that device manager was refreshing when it loaded so I dug around elsewhere and found it was showing up as an extra “HID-compliant device” under the “Human Interface Devices” tree, but Windows showed no apparent way to distinguish the 3 identically named devices.
I rebooted my computer into Linux and ran lsusb and was relieved to see that Teensyduino was listed as one of the devices. I installed Arduino and Teensyduino and successfully programmed the blink sketch and confirmed the light on the back of the Teensy was blinking. I’m not sure if booting into Linux was really necessary — maybe it would have worked if I had tried to program in Windows immediately after the Teensy showed up as a HID device.
At this point, I didn’t really want to go through the trouble of installing all the Aurora library dependencies, so I booted back into Windows. The Teensy showed up again as a COM port, so I went into Arduino and re-flashed Aurora.
I’m working on a heuristic to determine when the game of life has reached convergence. Currently, Aurora resets the world after a fixed number of generations, and sometimes it cuts off the game while interesting things are still happening. My idea is to detect when the universe has devolved to a steady state containing only still life, or simple oscillators. I have come up with a pretty good algorithm, but it still gets tripped up occasionally, usually when the only thing left is a glider that circles the screen and never runs into anything.
Additionally, I’d like to implement the ability to send the Aurora software commands over the serial interface to do things like switch the display mode or offer more customization for the patterns with settings would be too difficult to adjust using the IR remote. I would eventually like to extend this with a mobile web interface that will allow you to connect to your computer and control the settings from your smart phone.