Raspberry Pi Audio Spectrum Display
by Arduino_having11_Guy in Circuits > Raspberry Pi
5890 Views, 14 Favorites, 0 Comments
Raspberry Pi Audio Spectrum Display
![thumbnail.PNG](/proxy/?url=https://content.instructables.com/FPV/1DZC/JNNF0TO9/FPV1DZCJNNF0TO9.png&filename=thumbnail.PNG)
![DSC_7719.JPG](/proxy/?url=https://content.instructables.com/FTN/7EMV/JNNF0V4W/FTN7EMVJNNF0V4W.jpg&filename=DSC_7719.JPG)
![DSC_7721.JPG](/proxy/?url=https://content.instructables.com/FGP/VQ94/JNNF0VA8/FGPVQ94JNNF0VA8.jpg&filename=DSC_7721.JPG)
Use the DFRobot 64x64 RGB matrix panel with a Raspberry Pi 3 B+ to bring a dance party with you wherever you go!
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+.
Link to products:
https://www.dfrobot.com/product-1703.html
https://www.dfrobot.com/product-1644.html
Video
![Raspberry Pi Audio Spectrum Visualizer](/proxy/?url=https://content.instructables.com/FEC/N903/JNNF0W3D/FECN903JNNF0W3D.jpg&filename=Raspberry Pi Audio Spectrum Visualizer)
Here is a video demonstrating the matrix
Circuit
![DSC_7728.JPG](/proxy/?url=https://content.instructables.com/FUH/OA7N/JNNF0U5M/FUHOA7NJNNF0U5M.jpg&filename=DSC_7728.JPG)
![DSC_7730.JPG](/proxy/?url=https://content.instructables.com/F1B/S116/JNNF0UFF/F1BS116JNNF0UFF.jpg&filename=DSC_7730.JPG)
![DSC_7726.JPG](/proxy/?url=https://content.instructables.com/FX2/C41Y/JNNF0TW4/FX2C41YJNNF0TW4.jpg&filename=DSC_7726.JPG)
![DSC_7731.JPG](/proxy/?url=https://content.instructables.com/FJX/SORM/JNNF0UMC/FJXSORMJNNF0UMC.jpg&filename=DSC_7731.JPG)
![DSC_7732.JPG](/proxy/?url=https://content.instructables.com/FHL/7OL2/JNNF0UVO/FHL7OL2JNNF0UVO.jpg&filename=DSC_7732.JPG)
![DSC_7723.JPG](/proxy/?url=https://content.instructables.com/FNN/O6TO/JNNF0VFI/FNNO6TOJNNF0VFI.jpg&filename=DSC_7723.JPG)
![DSC_7718.JPG](/proxy/?url=https://content.instructables.com/F5P/F9W1/JNNF0UYO/F5PF9W1JNNF0UYO.jpg&filename=DSC_7718.JPG)
Adafruit also has a guide that you can follow here: https://learn.adafruit.com/adafruit-rgb-matrix-pl...
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.
Library
For 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/Raspbe... >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 Code
Before 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.