LEDs, Take Two

J.B. Langston
Feb 7, 2015 · 3 min read

This blog post has been languishing half-written in my blogger account for a long time. I have since found an even better solution for driving a 32x32 LED matrix called SmartMatrix (more on that later), but I wanted to share what I had already written about my second attempt along the way.

With the red/green matrix I shared in my last post, I never got past the single 8x8 prototype that I demonstrated in my video. I eventually tired of the tedium of endless soldering and the frustration of trying to find a way to route all the wires required to connect the 216 pins of the 9 8x8 panels together.

I had taken a break from electronics for a while, but was looking for an excuse to dive back in. Then I found this video made by Henner Zeller, who has written some software to drive an RGB matrix from the Raspberry Pi.

This matrix is already fully assembled so the only wiring required is a power cable and 16-pin data cable. The pins were not labelled on the matrix I got, so I looked at Adafruit’s instructions to get the pinout for the matrix. I found the GPIO pinout of the Raspberry Pi on the eLinux wiki, which is a great resource for all kinds of information about the Pi.

With this information in hand, I wired up a prototype using breadboard jumper wire to connect the appropriate pins on the Raspberry Pi’s 26-pin ribbon cable to those on the 16-pin ribbon cable provided with the matrix. I connected each pin from the matrix’s cable to the corresponding pin on the Raspberry Pi’s cable as documented in the software’s README. The important thing to remember when making these connections is that the pinout is flipped when looking at the connectors of the ribbon cables.

Once I had the prototype working, I wanted something a little more permanent, so I got some female to female pre-crimped wires plus some 2x8 and 2x12 connector housings from Pololu. To make a custom cable, you just snap the end of the wire into the appropriate place in the housing. Before doing this, I decided to move OE- from pin 2 to 27 on the Pi and CLK from pin 3 to 11 so that pins 2 and 3 remain free for the I2C expansion bus.

Adafruit now offers a Raspberry Pi LED Matrix Hat that is a much tidier solution, but if you don’t like to solder, you may find the technique I used above more to your liking.

I started with Henner Zeller’s original code is on Github. I have forked his code on Github and made a few changes:

  • Swap blue and green pins so they match wiring shown in Adafruit’s documentation
  • Changed OE- from pin 2 to 27 on the Pi and CLK from pin 3 to 11 so that pins 2 and 3 remain free for the I2C expansion bus.
  • Added support for the TPM2.net protocol for streaming video from your PC to the matrix over UDP.
  • Compiled against the Xenomai real-time kernel. Instructions for building a Raspberry Pi linux kernel with Xenomai support are here. There is also a Github repository with some helpful scripts here.

It works pretty well, but because Linux is a multitasking operating system, getting precise timings is not always possible, and when the loop gets preempted, it causes noticeable flicker on the display. Compiling with Xenomai helps this somewhat but it’s still noticeable at times. Also, a bare Raspberry Pi with a wire connected to a bare matrix doesn’t really feel like a finished project; however, it’s a lost farther than I ever got with my last attempt.

Eventually, I found a better solution the SmartMatrix kit that I mentioned at the beginning of the post. I’ll talk more about that in my next post.

Adventures in Electronics

Chronicles of my hobbyist electronics projects

J.B. Langston

Written by

Computer and Electronics Nerd

Adventures in Electronics

Chronicles of my hobbyist electronics projects