DFRobot reached out to me to do a sponsored project for their 64x64 RGB LED matrix. At first I had tried to use it with the ESP32 Firebeetle, but I couldn't get the library to work. So that meant using a Raspberry Pi 3 B+.
Adafruit also has a guide that you can follow here: https://learn.adafruit.com/adafruit-rgb-matrix-plus-real-time-clock-hat-for-raspberry-pi
Thankfully Adafruit has a matrix HAT for the Raspberry Pi that handles all of the 3.3v -> 5v logic level conversions.
Both the HAT and matrix have the same connector, but pin 8 (the white wire) doesn't get plugged into the HAT. Because the HAT only supports up to 4 control wires, pin 8, which is the 5th control wire, gets connected to GPIO pin 24.
Make sure to use a 5V power supply that can supply up to 7A.
LibraryFor the attached code to work I used the rpi-rgb-led-matrix library to control the LEDs. It's pretty simple to install. Just run
curl https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/rgb-matrix.sh >rgb-matrix.sh
sudo bash rgb-matrix.sh
Then press y to continue and choose option 2 to select the Adafruit Matrix HAT.
Then choose number 2 to free up pin 18 so that sound can still be outputted over the audio jack.
To test it go into the examples-api-use directory and run
sudo ./demo -D0 --led-rows=64 --led-cols=64 --hardware-mapping=adafruit-hat
You should see the demo running. Just hit ctrl-c to exit it.
Running the CodeBefore the code can run you must add the root user to the audio group with
sudo -su
then
modgroup audio
exit
Put the python file and test.wav file into /home/pi/rgb-led-matrix/bindings/python/samples/
If the demo ran fine then run the code with
sudo cd /home/pi/rgb-led-matrix/bindings/python/samples/
sudo python spectrum_matrix.py
You should hear the music playing from the audio jack and the lights lighting up.
Comments