max7219 LED Array on Raspberry Pi!

I’m always on the lookout for new widgets that I could make work with Snarl and the max7219 took my fancy.  I ordered this one from Amazon as it came pre-assembled (some seem to be sold in kit form) and is compatible with the Raspberry Pi.

Connecting it up is pretty straightforward.  There are no instructions included but I found this great guide and cross-referenced it with this GPIO reference.  There are only 5 connectors that need attaching to certain GPIO pins.  Once I’d reassembled my Pi, it was time to get the device working.

On powering up my Pi, the matrix board light up and then went off, so at least it seemed to have power and be connected up correctly.

I logged on as root, and then installed the software:

git clone https://github.com/rm-hull/max7219.git

And tried to build it:

sudo python max7219/setup.py install

This was where I ran into my first issue – likely because I’m actually running Kali Linux on this Pi, rather than Raspbian.  I needed to install setuptools:

wget https://bootstrap.pypa.io/ez_setup.py -O - | python

And I also needed some extra python bits and pieces:

apt-get install python-dev python-pip
pip install spidev
python setup.py install

Even then it wouldn’t work as it couldn’t see the device.  It turns out SPI isn’t enabled by default so I had to create /boot/config.txt and add the following to it:

dtparam=spi=on

Creating /boot/config.txt was a bit of a faff too, again this is likely because I’m running Kali – this post explains why and how to resolve it.  If you need the detail, it’s as follows:

mkdir /fat32
mount /dev/mmcblk0p1 /fat32/
nano /fat32/config.txt
umount /fat32

After that, I rebooted my Pi and all was sorted!

There are some examples included with the software.  I amended one to make it a bit shorter – here’s a pic of it running:

max7219

And here’s a short video.

Next step is to clone Blinkserver to work with the Python API for the max7219.  I’ll post my progress on this.

You can now download RedPowder, which is a small Python web server that communicates with the max7219!