Raspberry Pi and SPI 8×8 LED matrix example with Java and Pi4j

Share on facebook
Share on twitter
Share on linkedin

While looking for a cheap and nice component to demonstrate the use of SPI (Serial Peripheral Interface) I found out this 8×8 matrix LED display on a board with a MAX7219 chip is the perfect piece of hardware!

What you see in the video is the end result with:

  • All on/off
  • Demo of all the lines
  • Demo of all the columns
  • 5 random generated matrixes
  • A set of images including an attempt of the Raspberry Pi logo
  • A, B, E, S, T fixed
  • The same characters scrolling one-by-one


As we are using SPI, the number of connections to be made is very minimal:


The sources can be found as an example project within all the sources from the book on GitHub.

The characters and images are created by converting the bit series to byte values inside enums. The number of available definitions is limited as this example is only a demonstration of what you can do, not a fully finished project. So some fun work left for you!

By using the “Find” function in the IDE for value “1” it becomes pretty clear how the defined columns and rows will end up on the matrix display.


You can find these components for a few dollars on eBay and they are great fun to experiment!

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 2 other subscribers

Frank Delporte

Frank Delporte

Author of Getting Started with Java on Raspberry Pi" which is for sale on Leanpub (ebook) and Elektor (paper book). Software developer/technical lead/writer with more than 20 years of experience in video, multimedia, technical project management, digital signage, and (web) programming. Since 2010 I work for Televic Rail in Izegem, Belgium. My current work tools are Java/Git/Atlassian/IntelliJ IDEA/Visual Studio Code, but also use/used ASP.NET, C#, JavaScript, Angular, SQL Server, Flex, CSS, HTML5, Eclipse, QT,… I love to KISS (Keep It Simple, Stupid) and try to do this in everything I do.

Leave a Replay

Follow Me

My Latest Posts

Hacker Stars


Sign up for our Newsletter

Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit