pi2max7219

USING AN 8X8 LED DISPLAY ON THE RASPBERRY PI

8X8 LED modules with an included driver board have become quite inexpensive. These modules use the MAX7219 driver chip. There is Python and Arduino code to drive them, but alas there's no Linux kernel module.

So, it's time to write some code! There is a bit of a problem though - the old userspace GPIO access method (/sys/class/gpio and friends) is going away soon. You'll no longer be able to control GPIOs with file writes and reads. The replacement is called the gpio character device, and comes with userspace tools and a C library to make access possible. Time to learn some new stuff!

Using the the same ersatz device file method as the pi2ws2812 project, I created a userspace program that allows one to write values to /dev/pi2max7219 to manipulate the LED display. For instance, the command echo 1 8 0 0 0 0 0 255 lights the left (first) column upper LED, the lower LED in the second column, and all LEDs in the rightmost (8th) column. I also created a demo program (clock.c) that uses the display as a scrolling clock. I even created a small PCB to allow the display to simply plug into the Pi. You can order it here. You'll also need a 7-pin header socket.

Temporarily remove the LED array (remember it's orientation!) and solder it up like this:

Put the LED back in and plug it into the Pi like so:

To compile and use the programs, download the two .c files from this project's files section then run the following commands:

    apt-get install libgpiod-dev

    gcc -lgpiod -o pi2max7219 pi2max7219.c

    gcc -o clock clock.c

    sudo ./pi2max7219

    sudo ./clock

Press control-c to exit the clock program. The driver is still loaded, so you can use echo to test the display.