Controlling RGB LED display with Raspberry Pi GPIO

by Ritesh

Posted on October 15, 2017 at 11.30 PM

Since I had no experience of projects based on GPIO pins of a development board, it took a long time to understand the concepts.

Hardware used for the Project:
1. Raspberry Pi (I used one of my Raspberry Pi 3 MOdel B for the project).
2. RGB LED matrix 32 x 32 pixels, 162 x 162 mm, P6
3. 5 Volt, 2 Ampere Adaptor for powering the Raspberry Pi
4. 5 Volt power supply for the LED Matrix, from my old computer SMPS box
5. Female to female connectors

Preparing your Pi

Install raspbian in your Pi. I used Raspbian Lite for the project.

Enable SSH to connect with your Pi without having to arrange for a monitor, keyboard and mouse everytime.
Using raspi-config enable the ssh (you should look for "Enable or disable ssh server" in the configuration options)
pi@raspberrypi:~ $ sudo raspi-config
Now connect to your Pi via ssh (the default username and password is pi/raspberry). Update the packages/repository
pi@raspberrypi:~ $ sudo apt-get update

A note on SPI and I2C Interfaces of Raspberry Pi

There is no need to enable Serial Peripheral Interface (SPI) and Inter-Integrated-Circuit bus (I2C) for the project


Install the gpio package
pi@raspberrypi:~ $ sudo apt-get install rpi.gpio
pi@raspberrypi:~ $ sudo apt-get install python-dev python-imaging

Download the software library maintained by Henner Zeller. The software library for the project is found here.



Hub75 connection of LED Matrix

Connections

40 Pin GPIO Connection to HUB75 socket of matrix

Connection Pin Pin Connection
Blank   1   2 Blank
Blank   3   4 Blank
Blank   5   6 GND
STB (strobe)   7   8 Blank
Blank   9 10 Blank
CLK (clock) 11 12 OE
G0 13 14 Blank
A 15 16 B
Blank 17 18 C
B1 19 20 Blank
G1 21 22 D
R0 23 24 R1
Blank 25 26 B0
Blank 27 28 Blank
Blank 29 30 Blank
Blank 31 32 Blank
Blank 33 34 Blank
Blank 35 36 Blank
Blank 37 38 Blank
Blank 39 40 Blank

Hub75 to Raspberry Pi connection

The onboard sound module of the Raspberry Pi is not compatible with the library. If you run the default demo, the set up fails to work but it provides resolution step as well in ther error message. (shown below). I have detailed how to disable onboard sound of Raspberry Pi in a section below.

root@raspberrypi:/home/pi/display32x32/rpi-ritesh/examples-api-use# ./demo   -t 90 -D 1 ritesh.ppm

=== snd_bcm2835: found that the Pi sound module is loaded. ===
Don't use the built-in sound of the Pi together with this lib; it is known to be
incompatible and cause trouble and hangs (you can still use external USB sound adapters).

See Troubleshooting section in README how to disable the sound module.
You can also run with --led-no-hardware-pulse to avoid the incompatibility,
but you will have more flicker.
Exiting; fix the above first or use --led-no-hardware-pulse

root@raspberrypi:/home/pi/display32x32/rpi-ritesh/examples-api-use#

The same code above with a flag "--led-no-hardware-pulse" works fine.

root@raspberrypi:/home/pi/display32x32/rpi-ritesh/examples-api-use# ./demo  --led-no-hardware-pulse -t 90 -D 1 ritesh.ppm
Size: 32x32. Hardware gpio mapping: regular
Read image 'ritesh.ppm' with 500x32

The other way to permanently fix this issue is to disable the onboard Raspberry audio.

Disabling onboard audio of Raspberry Pi

Navigate to /etc/modprobe.d , Add the line "blacklist snd_bcm2835" to raspi-blacklist.conf

root@raspberrypi:cd /etc/modprobe.d#
root@raspberrypi:/etc/modprobe.d# ls
blacklist-rtl8192cu.conf  fbdev-blacklist.conf  libpisock9.conf
blacklist-rtl8xxxu.conf   ipv6.conf             raspi-blacklist.conf
root@raspberrypi:/etc/modprobe.d# nano raspi-blacklist.conf


Working Demo with Raspberry Pi

Press Ctrl+O to save the file (Nano)
and then reboot.

Working Demo with Raspberry Pi

Test the disabled audio.
root@raspberrypi:/home/pi/display32x32/rpi-ritesh/examples-api-use# aplay -l
aplay: device_list:268: no soundcards found...
root@raspberrypi:/home/pi/display32x32/rpi-ritesh/examples-api-use#


Working Demo with Raspberry Pi


Download connectors from Apache website