Close

LEDs, Take Two

jb-langstonJ.B. Langston wrote 03/13/2021 at 05:15 • 3 min read • Like

Originally published in 2013.

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.

Wiring

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.

Software

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

Results

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.

Like

Discussions