Tuesday, May 13, 2014

32x32 RGB LED matrix, Painting with Light

Here at last is my 32x32 RGB LED attempt. I bought a while ago a matrix from Sparkfun with the idea to use the Teensy 3 to control it (the code posted below does not work with Arduino).

I have seen quite a few projects with LED matrices, specially the Pixel V2 or the GameFrame and the QR clock. All these projects are quite impressive, each offering something a bit different. My idea is to make a bit of each while keeping things simple and cost down, the total was around 100$.

- Like for the LED cube I made last year, I wanted an interactive drawing system where my son can paint in Processing and pass the pixel data through the Serial interface.
- In addition I tried to separate each LED to have a "cleaner" lighting; I removed the matrix front panel and replaced it by a laser cut grid. This gives the "square" look of Pixels we are familiar with. Then I covered the grid with two sheets of tracing paper to "blur" the lights (if someone has a better idea, please...)

- Since the Arduino library made by Adafruit does not work with the Teensy at the momen; I first wrote a code which helped me understand the working of the matrix but was two slow and flickered a lot. Then I found the code Markus Lipp published, thanks again. After a few tweaks, here is a simple sketch which will display an image and allow to change the color of each LED with a Serial message. With some additions, the code can also display animations from Serial or an SD card at 24bit colors and with a good frameRate.

Can you read this QR code? I am using the QRduino library to generate QR codes. With the Teensy RTC capability it is possible to make a fun clock!


Here is a Sketch for the Teensy 3 or 3.1. I use some pins which are underneath for the matrix, so that I still have the SPI pins for an SD card and Serial 2 to play with Bluetooth.  If you want to use this code with the top pins only, you can change PORTB to PORTC.