8x8 LED Matrix for RaspberryPi and 3 Programs




About: Jack passed away May 20, 2018 after a long battle with cancer. His Instructables site will be kept active and questions will be answered by our son-in-law, Terry Pilling. Most of Jack's instructables are tu...

This is an 8x8 LED matrix for a RaspberryPi, and three programs to run on it:

1 - A "Hello World" program with a complete English font.

2 - A Dice game.

3 - A small 8x8 version of Conway's Game of Life.


You will need:

RaspberryPi (any model)

Adafruit Perma-Proto Raspberry Pi Breadboard PCB Kit http://www.adafruit.com/products/1135

One of these cables to connect the board to the RPi:

GPIO Ribbon Cable for Raspberry Pi Model A and B - 26 pin

Downgrade GPIO Ribbon Cable for Pi A+/B+/Pi 2 - 40p to 26p

Miniature 8x8 Red LED Matrix http://www.adafruit.com/product/454

8 resistors 330-560 Ohm 1/4 Watt.

1 resistor 10K Ohm 1/4 Watt.

Switch Button (12mm) http://www.adafruit.com/products/1119

22 ga hookup wire, red and black/


The RaspberryPi programs in this instructable use the wiringPi libraries, written by Gordon Henderson, for programming the GPIO in C.

wiringPi must be installed. Instructions for download, installation and use are located at http://wiringpi.com

wiringPi uses it's own pin numbering scheme.

All RaspberryPi pin numbers are wiringPi numbers unless otherwise specified.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Mounting the Components

I am using a regular Adafruit Perma Proto full sized board and a cobbler in the illustrations because there is not a Fritzing part for the RaspberryPi board.The notch in the cable connector goes down, in the direction of the pink arrow.

There is not a Fritzing part for the LED matrix either. The pink lines are the solder points for the LED matrix. The writing on the side of the matrix goes down, in the direction of the pink arrow.

Solder the rest of the components as shown in the illustration.

Step 2: Start Wiring It

Solder the eight wires from the resistors to LED matrix, and the grounds for the switch and the ribbon connector.

Step 3: The First Layer of Wiring

Run eight black wires from the resistors to the ribbon connector. You will have to bend the wires around the LED matrix.

Step 4: The Top Layer of Wiring

Run eight wires from the LED matrix to the ribbon connector.

You will have to bend the wires around the LED matrix like in the photo in step 3.

Solder the red wire for the switch.

Step 5: The Program Files

Download the three program source files and the font data file for the "Hello World" program.

Rename the files back to the correct names. The filenames are on the first comment line in each file.

Use this command to compile the programs:

cc -o [FILENAME] -Wall -I/usr/local/include -L/usr/local/lib [FILENAME].c -lwiringPi -lpthread

The programs demonstrate the wiringPi ability to easily create a multi threaded program. All the work except for the actual display is done in the main thread which puts it in a global array. A second thread reads the array and turns the LEDs on or off in a continuous loop. Only one LED is actually lit at a time.

Step 6: Conway's Game of Life

Conway's game of life is a zero player game that simulates life. It is better on a bigger grid, but this shows how it works.

Put a pattern into the array in the program and compile it to see the result.

The program counts the adjacent LEDs that are on for all LEDs.

Then it turns on/off LEDs according to the following rules:

  • If an LED is lit and less than two adjacent LEDs are lit it is turned off.
  • If an LED is lit and more than three adjacent LEDs are lit it is turned off.
  • If an LED is lit and two or three adjacent LEDs are lit it stays on.
  • If an LED is not lit and exactly three adjacent LEDs are lit it is turned on.

Step 7: Dice Game

Start the program with the command:

sudo ./8x8dice 

Push the button and the LEDs will flash random. When the button is released you will see the numbers on two dice.

Step 8: Hello World

Start the program with the command:

sudo ./8x8hello

The program displays the "Hello World" message and then the alphabet.

You can change the message to whatever you want it to say.

Pi/e Day Contest

Participated in the
Pi/e Day Contest

Explore Science Contest

Participated in the
Explore Science Contest

2 People Made This Project!


  • CNC Contest

    CNC Contest
  • Make it Move

    Make it Move
  • Teacher Contest

    Teacher Contest

4 Discussions


1 year ago

I had some problem executing 8x8hello.c

When display starts first digitalWrite() before wiringPiSetup() and pinMode(.., OUTPUT)

program exits with Segmentation fault.

So, I just swapped in main() call setup() and piThreadCreate(display)

And now it works like a charm.


4 years ago on Introduction

If you like this please vote for me in the RaspberryPi Contest.


Reply 4 years ago on Introduction

Fritzing, it's in the Ubuntu and Debian repositories or available at

http://fritzing.org for Windows or Mac.