Facebook Twitter Instagram Pinterest YouTube
    Trending
    • Add Kodi to RetroPie Menu
    • Disable Auto-login in Raspberry Pi OS
    • Raspberry Pi Cloud Storage with MEGA
    • RetroPie Temperature Monitor from Menu
    • Pi Pico Pinout and Power Pins
    • Install Arduino IDE on Raspberry Pi
    • Raspberry Pi 400 SSD Upgrade
    • Raspberry Pi Temperature Monitoring
    Facebook Twitter Instagram Pinterest YouTube RSS
    Raspberry Pi SpyRaspberry Pi Spy
    • Home
    • Categories
      • General
      • Hardware
      • Programming
      • Python
      • Software
      • Tutorials & Help
    • BerryClip
      • BerryClip Instructions
      • BerryClip Plus Instructions
      • Videos & Reviews
    • Buy
      • Buy Pi
      • Buy Pi Accessories
      • Buy Books
    • Tools
      • Ultimate Raspberry Pi Alexa Skill
      • Pi Power Estimator App
      • Pi-Lite 14×9 LED Matrix Sprite Editor
      • RPiREF Pin-out Reference App
      • Simple Ohm’s Law Calculator
      • Web Sites & Links
    • Tutorials & Help
        Featured
        November 9, 20200

        Raspberry Pi Temperature Monitoring

        Recent
        May 6, 2022

        Add Kodi to RetroPie Menu

        February 26, 2022

        Disable Auto-login in Raspberry Pi OS

        February 2, 2022

        Raspberry Pi Cloud Storage with MEGA

      1. Contact Us
      2. Site Map
      Raspberry Pi SpyRaspberry Pi Spy
      You are at:Home»Hardware»Add-ons»32×32 RGB LED Matrix On The Raspberry Pi
      32x32 LED Matrix Panel

      32×32 RGB LED Matrix On The Raspberry Pi

      23
      By Matt on September 9, 2014 Add-ons

      At the last Cambridge Jam I picked up a 32×32 LED matrix panel from SK Pang. This consists of 1024 RGB leds and is used as a building block for those large displays you see in stadiums. I could only afford one so my screen is slightly smaller.

      It consists of the panel, a ribbon cable, a GPIO adapter and a power cable. I used a RAVPower 10400mAh USB power bank to power it. You need a power source that can provide 5V with at least 2A.

      Driving the screen requires a lot of data to be sent to the screen on a constant basis. This makes it unsuitable for Python but better suited to C. I tend to use Python so this makes it slightly outside my comfort zone. Lucky for me Henner Zeller has created a library of C code to drive this board via the Raspberry Pi’s GPIO pins and made it available on his rpi-rgb-led-matrix Github page.

      Install C Library

      You can download the code to your Pi using :

      wget https://github.com/hzeller/rpi-rgb-led-matrix/archive/master.zip

      and then unzip the archive using :

      unzip master.zip

      Once extracted you can change to the subdirectory :

      cd rpi-rgb-led-matrix-master/

      and then compile the code using :

      make

      Usage

      Once compiled you can run the resulting executable using :

      ./led-matrix

      which will display the available command line options :

      usage: ./led-matrix <options> -D <demo-nr> [optional parameter]Options:
       -r <rows> : Display rows. 16 for 16x32, 32 for 32x32. Default: 32
       -c <chained> : Daisy-chained boards. Default: 1.
       -L : 'Large' display, composed out of 4 times 32x32
       -p <pwm-bits> : Bits used for PWM. Something between 1..7
       -g : Do gamma correction (experimental)
       -D <demo-nr> : Always needs to be set
       -d : run as daemon. Use this when starting in
            /etc/init.d, but also when running without
            terminal (e.g. cron).
       -t <seconds> : Run for these number of seconds, then exit.
               (if neither -d nor -t are supplied, waits for <RETURN>)
      Demos, choosen with -D
       0 - some rotating square
       1 - forward scrolling an image (-m <scroll-ms>)
       2 - backward scrolling an image (-m <scroll-ms>)
       3 - test image: a square
       4 - Pulsing color
      Example:
       ./led-matrix -t 10 -D 1 runtext.ppm
      Scrolls the runtext for 10 seconds
      

      To get something on the panel you can try the including example image “runtext.ppm” :

      sudo ./led-matrix -d -t 20 -D 1 runtext.ppm

      If your panel is connected correctly and has enough power the “runtext.ppm” image will be scrolled across the screen for 20 seconds.

      Custom Graphics

      Creating your own graphics to scroll is really easy as long as you have an image editing application that can create Portable Pixmap Format (PPM). I use the GIMP (it’s free!) and this file tpye is available via the “Export as” feature.

      You start by loading or creating your source image and then re-sizing it so that it is only 32 pixels high. The width doesn’t matter as it is going to be scrolling horizontally. In GIMP you can simply use “Export as”, use a filename with a .ppm extension and select “Raw” when prompted. This file can then be copied to your Pi. My first custom graphic was a logo and some text :

      Raspberry Pi Spy Strip

      The command below scrolled this nicely across the panel :

      sudo ./led-matrix -d -t 60 -D 1 rpi_logo.ppm

      My next test was a small set of flags that looked something like this :

      Flag Strip

      Here is custom_ppm_images zip file with my custom PPM images if you want to try them.

      The panel is great fun and the videos don’t really do it justice. As long as you can generate the PPM files you can scroll whatever you like.

      I am going to start looking at the C code and see if I can modify it play back a sequence of images from a directory. That way I can create animations. It would also be good to use Python to generate a file and then trigger the C programme to display it.

      GPIO Reference

      For reference here are the connections between the panel and the Raspberry Pi’s GPIO header :

      Panel Connections        Pi Header Connections
      =================        =====================
      GND (Ground, '-')        Ground
      R1 (Red 1st bank)        GPIO17
      G1 (Green 1st bank)      GPIO18
      B1 (Blue 1st bank)       GPIO22
      R2 (Red 2nd bank)        GPIO23
      G2 (Green 2nd bank)      GPIO24
      B2 (Blue 2nd bank)       GPIO25
      A (Row address)          GPIO7
      B (Row address)          GPIO8
      C (Row address)          GPIO9
      D (Row address)          GPIO10
      OE- (neg. Output enable) GPIO 2 (Pi Rev 2)
                               GPIO 0 (Pi Rev 1)
      CLK (Serial clock)       GPIO 3 (Pi Rev 2)
                               GPIO 1 (Pi Rev 1)
      STR (Strobe row data)    GPIO 4
      Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
      Previous ArticleCambridge Raspberry Jam – September 2014
      Next Article Infographic – Raspberry Pi How To Get Started

      Related Posts

      Gameboy Zero 6 Button Board from Aliexpress

      Raspberry Pi 7-Segment LED Display Module using Python

      Kano Motion Sensor Kit for the Raspberry Pi

      23 Comments

      1. tvomberg on September 11, 2014 9:55 am

        Hi,

        nice work!
        I also got this Panel and i tried to run it with the Raspberry Pi, but with no success:o(.
        Only the first rows of the Panel are activated. My power supply to the panel has 5 V with 2 A. May you state your connections from the panel to the Raspberrry Pi, please:

        RO (Panel PIN) = ? (RPI PIN)
        G0 (Panel PIN) = ? (RPI PIN)
        B0 (Panel PIN) = ? (RPI PIN)
        GND (Panel PIN) = ? (RPI PIN)
        R1 (Panel PIN) = ? (RPI PIN)
        G1 (Panel PIN) = ? (RPI PIN)
        B1 (Panel PIN) = ? (RPI PIN)
        GND (Panel PIN) = ? (RPI PIN)
        A (Panel PIN) = ? (RPI PIN)
        B (Panel PIN) = ? (RPI PIN)
        C (Panel PIN) = ? (RPI PIN)
        D (Panel PIN) = ? (RPI PIN)
        CLK (Panel PIN) = ? (RPI PIN)
        STB (Panel PIN) = ? (RPI PIN)
        OE (Panel PIN) = ? (RPI PIN)
        GND (Panel PIN) = ? (RPI PIN)

        Thank you in advanced
        Regards

        Reply
        • Matt on September 12, 2014 11:50 pm

          It’s the same as the pin out on this page : https://github.com/hzeller/rpi-rgb-led-matrix

          Reply
      2. The J on September 18, 2014 1:38 pm

        Nice looking led. I’ve seen a few that take animated gifs…. You tried that file type or is it limited to ppm files?

        Reply
        • Matt on September 18, 2014 7:48 pm

          The screen will display whatever the code can throw at it … but the library I’m using is designed around PPM files. It’s the code that converts the PPM to the required signals. Technically you could modify the C code to convert any input images.

          Reply
          • The J on March 7, 2015 1:48 pm

            I contacted the guy who created the code a while back, Hans Zeller, he got back to me the other day and said that the code now supports gifs and other file formats.

            Reply
            • Matt on March 7, 2015 5:11 pm

              Excellent! I’ll take a look when I get the chance.

              Reply
      3. Tyler on November 9, 2014 9:36 pm

        How is the animation code coming along? That code would really be helpful to me as I am not a C programmer.

        Reply
        • Matt on November 9, 2014 10:38 pm

          Unfortunately I’ve had no time to look at it.

          Reply
      4. John on November 15, 2014 8:07 pm

        I hooked up a panel and ran your awesome demo program, but my display is extremely “jiggly”… The pixels jump around left to right, causing the letters and images to look somewhat fuzzy/jaggy and irregular. Any ideas on what the problem could be? Bad panel? Noisy power supply? EMF? Any help would be extremely appreciated. PS – thanks for doing the library for these panels!

        Reply
        • Sean on November 22, 2014 10:40 pm

          Hi John,

          Any luck with your issue. I seem to be having a similar issue. Seems quite irregular. I agree, seems very noisy. About to go over the wiring again to see if anything is amiss… weird

          Reply
        • Matt on November 23, 2014 10:24 am

          It may be the power supply. I had some flickering with my panel when I used a power supply that couldn’t quite supply the correct current and voltage under load.

          Reply
      5. Val Lopez on November 23, 2014 3:07 am

        Hello,
        I wonder if it is possible that, instead of images, the matrices displayed text.
        I know that a text to image conversion is possible, but I was thinking displaying text from a keyboard input (a real time interaction).
        Does anybody have an idea on how to go about it?
        I’m a beginner and any guidance is greatly accepted 🙂

        Reply
        • Matt on November 23, 2014 11:31 am

          The only way to do it would be to collect keypresses to build a string of text, convert to an image and overwrite the image being sent to the panel. I seem to think you can replace the image and the panel will use the modified image.

          Reply
          • Val Lopez on November 24, 2014 8:22 am

            And would that be achieved through C code? If you could point me to some sort of example on how to go about this I would appreciate it!

            Reply
            • Matt on November 24, 2014 9:23 pm

              You could create it in any language but it should be possible to do it in C or Python. It could run independently of the screen driver. It just needs to collect keypresses, build a string and then update the image file that the screen driver was using to send to the panel. I’ve got no examples so it would be a case of building up the functionality a step at a time.

              Reply
      6. Mike Charles on December 20, 2014 6:53 am

        Any updates on the animation code?

        Reply
      7. Regardt on February 4, 2015 9:03 pm

        Good day,

        I am very interested in Arduino and led rgb`s. My first thought was however how one would display full color dvd like video?

        Reply
      8. Paul on March 28, 2016 8:37 pm

        Hi,
        great tutorial, just wondering is there an easy way to scroll text across the LED panel rather than using image files?

        Thanks,

        Paul

        Reply
        • Matt on July 20, 2016 12:34 pm

          The only way to scroll text is to dynamically create the appropriate image files to represent letters.

          Reply
      9. jagadesh on September 13, 2016 2:35 pm

        Hi
        I am trying to move single led pixel with keyboard arrow keys with different libraries but it did not get sucess in adafruit rgb-led-panel 32×32 matrix, please give me some suggestion for this application.

        Reply
      10. Julius Bangert on October 11, 2016 10:44 am

        Hi Matt.
        Would this setup work the same with the Raspberry Pi Zero?

        Reply
        • Matt on October 12, 2016 8:27 pm

          I don’t see why not. It’s got the same GPIO pins.

          Reply
      11. popeyesfx on October 13, 2016 2:21 pm

        Hi
        I ran the make but nothing happens. It doesn’t
        give any error message just does not create the led-matrix file

        Any ideas

        Reply

      Leave A Reply Cancel Reply

      This site uses Akismet to reduce spam. Learn how your comment data is processed.

      Recent Posts
      May 6, 2022

      Add Kodi to RetroPie Menu

      February 26, 2022

      Disable Auto-login in Raspberry Pi OS

      February 2, 2022

      Raspberry Pi Cloud Storage with MEGA

      January 7, 2022

      RetroPie Temperature Monitor from Menu

      January 24, 2021

      Pi Pico Pinout and Power Pins

      Categories
      • 1-wire
      • 3D Printing
      • Add-ons
      • BBC Micro:bit
      • BerryClip
      • Books
      • Camera Module
      • Cases
      • Events
      • General
      • Hardware
      • I2C
      • Infographics
      • Interfaces
      • Minecraft
      • Model A+
      • Model B+
      • News
      • Pi Models
      • Pi Zero
      • Power
      • Programming
      • Python
      • Raspberry Pi OS
      • Raspbian
      • RetroGaming
      • Robotics
      • Sensors
      • Software
      • SPI
      • Tutorials & Help
      Tags
      3D Printing Arduino audio battery berryclip Birthday bluetooth cambridge camera CamJam DigiMakers display games GPIO I2C interface Kickstarter LCD LED Linux media Minecraft Model A Model B motionEyeOS PCB photography photos Pi-Lite portable power python Raspberry Jam Raspberry Pi Bootcamp raspbian Retrogaming retroPie screen SD card security sensor SPI temperature ultrasonic video
      Raspberry PI Related
      • Adafruit Blog
      • Average Maker
      • Official RaspBerry Pi Site
      • Raspberry Pi Pod
      • RasPi.tv
      • RaspTut
      • Stuff About Code
      Tech Resources
      • MattsBits – Pi Resources
      • Microbit Spy
      • Technology Spy
      Archives
      About

      Unofficial site devoted to the Raspberry Pi credit card sized computer offering tutorials, guides, resources,scripts and downloads. We hope to help everyone get the most out of their Pi by providing clear, simple articles on configuring, programming and operating it.

      Popular Posts
      September 19, 2014

      Top 5 Reasons The Raspberry Pi Sucks

      July 27, 2012

      16×2 LCD Module Control Using Python

      October 20, 2013

      Analogue Sensors On The Raspberry Pi Using An MCP3008

      Recent Posts
      May 6, 2022

      Add Kodi to RetroPie Menu

      February 26, 2022

      Disable Auto-login in Raspberry Pi OS

      February 2, 2022

      Raspberry Pi Cloud Storage with MEGA

      Facebook Twitter Instagram Pinterest YouTube RSS

      Entries RSS | Comments RSS

      This site is not associated with the official Raspberrypi.org site or the Raspberry Pi Foundation. Raspberry Pi is a trademark of the Raspberry Pi Foundation.

      Copyright © 2022 - All Rights Reserved - Matt Hawkins

      Type above and press Enter to search. Press Esc to cancel.