How to Use an LED Matrix Panel with Your Raspberry Pi

An LED matrix will make any project better.
Tyler Tyler (288)

LED matrix panels are just awesome. They look retro and have the added benefit of being useful. You can build just about anything using an LED matrix—a ticketing system display, an NHL scoreboard, a stock ticker, a clock, etc.

You might be surprised, however, as to how difficult it is to integrate an LED matrix into your project, especially for beginners. Since I needed this display for a cryptocurrency ticker I'm working on, I decided to write a generic guide that makes using the display a bit more accessible for beginners.

In this guide, you'll learn how to set up and start using an LED matrix with your Raspberry Pi.

Raspberry Pi Zero WHRaspberry Pi Zero WH ×1
Adafruit 64x32 RGB LED Matrix (5mm pitch)Adafruit 64x32 RGB LED Matrix (5mm pitch) ×1
Adafruit RGB Matrix BonnetAdafruit RGB Matrix Bonnet ×1
5V 4A switching power supply5V 4A switching power supply ×1
SD card, 32GB ×1

Howchoo is reader-supported. When you buy through links on our site, we may earn a small affiliate commission at no cost to you.

We've listed the Raspberry Pi Zero WH as the preferred Pi for this project because it's small enough to fit behind the display, includes WiFi, and comes with GPIO headers pre-soldered.

If you happen to be using a Pi Zero W (without headers), you'll need to go ahead and solder on your headers.

Need a soldering iron? Check out our guide to the best soldering irons.

Next, you'll need to install Raspberry Pi OS. To do so, please check out our detailed guide on how to install Raspberry Pi OS on your Raspberry Pi. After installing the OS, I recommend that you enable SSH and configure Wi-Fi as well, but this is only required if you're using a fully headless setup.

Connect the RGB matrix bonnet to the raspberry pi

Connect the bonnet to the Raspberry Pi. To do this, you'll need to line up the GPIO pins on the Pi with the female adapter on the bonnet.

Don't rush this step. If you push too hard or try to do it too quickly, you could damage the GPIO pins.

With the pins lined up, press firmly and evenly across the GPIO pins. Squeeze the boards together between your thumb and index fingers. If you do it correctly, you should see the GPIO pins entering the female adapter evenly all the way across.


You could add standoffs between the Pi and the bonnet on the non-GPIO side if you want to add support. This isn't necessary as long as you're careful when you're connecting the rest of the hardware.

Strip the power cables on the LED matrix panel

The RGB matrix bonnet will provide power to both the panel and the Raspberry Pi. The Raspberry Pi will receive power through the GPIO pins, but we'll need to connect the panel to the bonnet to provide power to the panel.

Depending on the exact panel you purchase, you will likely need to cut and strip the red and black wires.

Then on the bonnet:

  • Unscrew the small screws at the top of the terminals.
  • Slide the exposed copper from the cables into the terminals
  • Then tighten the screws to secure them.
led matrix panel connect ribbon cable

At this point, you're ready to connect all of the hardware.

  • Connect the ribbon cable from the panel to the RGB matrix bonnet.
  • Install your SD card in the Raspberry Pi.
  • Connect your power supply to the bonnet.

Now, you're ready to write some code!

From here, you'll need to either connect your Pi to a keyboard and monitor or if you're comfortable with the command line, you can work via ssh. If you're using the Raspberry Pi OS Desktop, you'll need to log in and open Terminal.

There are a few ways to configure this library. I'm going to configure the library for use with Python 3. You can also install the bindings for Python 2, C++, or C#, or just use it as a command-line tool.

To get going, you'll need to install some dependencies:

sudo apt-get update  && sudo apt-get install -y git python3-dev python3-pillow

Then you're going to install the rpi-rgb-led-matrix library. Let's start by cloning the repository:

git clone

Now, cd into the repo folder and install:

cd rpi-rgb-led-matrix
make build-python PYTHON=$(which python3)
sudo make install-python PYTHON=$(which python3)

Each of these commands should run without a hitch.

led matrix panel hello world

With our hardware set up and the software installed, let's run a simple test.

The library ships with some sample code to get us started. You're going to use a Python script called that scrolls text across the screen on repeat.

Navigate to the samples directory:

cd bindings/python/samples

Now run the following command:

sudo python3 --led-cols=64 --led-gpio-mapping=adafruit-hat --text="Hello, world!"

Note: Some of the sample scripts are a little bit feeble. You must be in the samples directory for the fonts to load properly.

Let's break down this command.

  1. This is important. We're calling this script with python3 because that's how we built the library. It will not work using python or ./.
  2. Then, because the default display size is 32x32 and my panel is 64x32, I'm passing in --led-cols=64 to override the number of columns.
  3. And, because we're using the adafruit bonnet, we need to specify the hardware with --led-gpio-mapping=adafruit-hat. Finally, for this particular sample script, we can pass in the text we want to scroll with --text.

Give this a shot to make sure everything is set up correctly.

howchoo logo on led panel

For this example, you'll work from another directory. Feel free to create a working directory of your choice, but I'm going work right out of the home directory:


First, you need to download a sample image:


Then you'll use the following script. Create a new file called and add the following:

#!/usr/bin/env python3

import time
import sys

from rgbmatrix import RGBMatrix, RGBMatrixOptions
from PIL import Image

if len(sys.argv) < 2:
    sys.exit("Require an image argument")
    image_file = sys.argv[1]

image =

# Configuration for the matrix
options = RGBMatrixOptions()
options.rows = 32
options.cols = 64
options.chain_length = 1
options.parallel = 1
options.hardware_mapping = 'adafruit-hat' 

matrix = RGBMatrix(options=options)

# Create a thumbnail that first our screen
image.thumbnail((matrix.width, matrix.height), Image.ANTIALIAS)


    print("Press CTRL-C to stop.")
    while True:
except KeyboardInterrupt:

Now make the script executable:

chmod +x

And run the script passing in your image as an argument:

sudo ./ howchoo-low-res-h.png

For best results, you'll want to use an image that's the same aspect ratio as your panel or else build some cropping functionality into the script.

If you browse the repository there are plenty of examples to choose from. You can also check out some projects that use this panel, like our Raspberry Pi Scoreboard (see video below) and our cryptocurrency ticker.

If you have trouble with this guide or would like to see more examples, let me know in the comments below. I might be able to help :)