Connecting a 16×32 RGB LED Matrix Panel to a Raspberry Pi


Everyone loves a colorful LED screen! Our 16×32 RGB LED display is a low cost, and easy-to-use arrangement of bright LEDs – just like the ones used in Times Square! This display makes a fantastic addition to your Raspberry Pi. It is pretty easy to wire up, but the display is quite demanding when it comes to getting it to display something…luckily this tutorial has all the code you need to get blinky
This tutorial is based on this one by Henner Zeller but as well as using Henner’s C code to drive the display, we will also experiment (with limited success) in driving the display using Python.
If you don’t mind cutting the connector off one end of the power cable for the display, and then stripping two of the wires, then you can do without the male to male headers.
Connecting a 16x32 RGB LED Matrix Panel to a Raspberry Pi

Wiring the Display

I noticed that the display is able to pull some power from the GPIO pins when it is not powered up. So I would suggest that, to be on the safe side, you wire up the display to the Pi, with both the Pi and the display powered off.

Note that the 3.3V and 5V pins of the Raspberry Pi are on the edge of the Raspberry Pi where the SD card fits!

If you prefer to make the connections using a list, they are as follow:

  • GND on display to GND on the Pi (blue or black)
  • R1 on display to GPIO 17 on the Pi (red)
  • G1 on display to GPIO 18 on the Pi (green)
  • B1 on display to GPIO 22 on the Pi (blue)
  • R2 on display to GPIO 23 on the Pi (red)
  • G2 on display to GPIO 24 on the Pi (green)
  • B2 on display to GPIO 25 on the Pi (blue)
  • A on display to GPIO 7 on the Pi (yellow or white)
  • B on display to GPIO 8 on the Pi (yellow or white)
  • C on display to GPIO 9 on the Pi (yellow or white)
  • OE on display to GPIO 2 on the Pi (brown)
  • CLK on display to GPIO 3 on the Pi (orange)
  • LAT on display to GPIO 4 on the Pi (yellow)
 These panels are designed to take 5V logic, and the Pi uses 3.3V logic. For some panels, the 3V logic is not high enough to trigger. If you’re having difficulty you may need to use level shifting chips such as to shift the 3.3V up to 5V!
Using some kind of template like the Raspberry Leaf, soon also to be available ready made from Adafruit, will simplify the process of finding the right pins on the Raspberry Pi.
When all the data pins are connected, we can wire up the power supply.
Attach the header pins to the 2.1mm to Screw Jack Adapter. Make sure that the red lead goes to the + mark on the screw terminal. Place the other ends of the jumper wires into the power cable. The power cable has double positive and negative leads. It does not matter which of the pairs of wires you connect to as long as you make sure that positive goes to one of the red leads and negative to one of the black leads.
It is very important that the power supply that you use is 5V. Many power supplies that look like the one used are 12V and if you use a 12V power adapter it may destroy your display.


Before powering up the Display and Raspberry Pi, check the wiring over carefully and make sure everything is connected as it should be.

Power the display up first and then the Raspberry Pi.
Lets start by creating a directory in which to keep the code. So open an LX terminal session (you can use SSH with the Pi ) if you prefer and enter the following command.
  1. $ mkdir display16x32
  2. $ cd display16x32
We now need to fetch the code from Henner Zeller’s original project using the command:
  1. $ git clone
This code is C source code, so we need to compile it before we can run it. Enter the following commands:
  1. $ cd rpirgbledmatrix
  2. $ make
To run the test program, enter the command:
The test program can also display a scrolling message. Infortunately, this message was designed for a 32×32 display and so you will only see the top half of the message. In the next section I will show you how to create your own message image using GIMP.
Connecting a 16x32 RGB LED Matrix Panel to a Raspberry Pi Schematic

A Scrolling Message

The images must be in a format called ppm (portable pixel format). Many image editors support this format, including the free open source application Gimp.

The image needs to be 16 pixels high, but can be wider than the 32 pixels of the display, as the text will scroll horizontally.
This image was created in GIMP. Notice that the background needs to be black.
Use the File->Export command on GIMP to export the image as ppm and then transfer the file into the directory /home/pi/display16x32/rpi-rgb-led-matrix on your Raspberry Pi. You can just use a flash drive to copy the file over.
Run the command again, this time using the name that you gave the file:
  1. $ sudo ./ledmatrix 1 my_image.ppm


© 2015 Powered By Engineering Projects Team, Raspberry Pi Projects

Scroll to top