The personal ramblings of Jon Carlos mobile & web developer and technology enthusiast.

Friday, 6 March 2015

Raspberry Pi b+ and max7219 LED matrix

21:45 Posted by Jon Carlos , , , 1 comment

I had a little bit of a shopping binge on Ali Express recently spending no more than £3 per item I purchased a bunch of random items I thought would be fun to hook up to a Raspberry Pi.

One of which was this little LED Matrix called a Max7219, it had 64 red LEDs in an 8x8 configuration and includes the controller chip required to control them from the 5v pin on a Raspberry Pi. It was all soldered together and came with a 5 pin cable so I didn't need to do anything but hook it up.

I found this guide on raspi.tv but I had a completely clean install on Raspbian and I had not configured it correctly so I needed some more help. I looked about a Googled the issues but I did not get a great deal of help so I hope this will help some others that have the same issues I did.

First up the pin configuration as detailed in the max7219 python library uses the SPI pins, I did not know theses needed to be configured to be used to while I was trying to run the tests I got this error.

can't open device: No such file or directory

It turns out to use the SPI pins you need to run 'sudo raspi-config' to enable access to the pins. below are the selections you need to use to enable them.



Once this is done that error should go away and you should be able to access the pins without issue.

Next you'll need to get the right software to be able to run the python libraries run these commands and you'll then be ready for the hardware setup.

sudo apt-get install python-dev python-pip
sudo pip install spidev


So now connect the pins to your Raspberry Pi following the instructions on github by rm-hull, now we're ready to pull the max7219 library.

git pull https://github.com/rm-hull/max7219.git
sudo python max7219/setup.py install 

Now you should be ready for your first test but before hand make sure that all your pins are nice and tight then run.

sudo python /max7219/examples/matrix_test.py
 
A video posted by Jon Carlos (@webmonger) on

1 comments:

frankie said...

when i typed in the git pull thing, it cameup with "fatal:Not a git reposatry (or any of the parent directories): .git"