Skip to content

Repository files navigation

spectrumLED

Visualization

Codacy Badge

spectrumLED is a simple spectrum analyzer meant to be used with a 32x8 LED matrix (MAX7219). Though it can be easily modified to fit the other sizes and matrices.

Build setup

Wiring

  1. LED matrix:

LED matrix wiring

LED pinOPi pin (phys)OPi pin name
VCCpin 4+5V
GNDpin 25GND
DINpin 19SPI0_MOSI
CSpin 24SPI0_CS0
CLKpin 23SPI0_CLK
  1. PCM5102 DAC (optional):
DAC pinOPi pin (phys)OPi pin name
BCKpin 27PCM0_CLK
DATApin 37PCM0_DOUT
LRCKpin 28PCM0_SYNC
GNDpin 34GND
GNDpin 39GND
VCCpin 2+5V

Configuration

  1. Load a loopback kernel module with:
modprobe snd-aloop
  1. Configure ALSA to output multiple streams with multi plugin. Example configuration is listed in asound.conf file: hw:1,0 is a normal soundcard, hw:3,0 is a loopback output, hw:3,1 is a loopback input. Just copy it with:
cp asound.conf /etc/

Change these settings if needed: run aplay -l to list all devices and correct card and device indices in the configuration file.

  1. Enable SPI and PCM devices in FEX (legacy kernel) file or add certain overlays (mainline). This is an optional step and depends on your hardware setup. See Armbian site for details.

  2. Configure an audio player. If you are using cmus, refer to cmus.rc file. I had no sound when default was specified in dsp.alsa.device option. Though out wrapper works fine.

  3. Play some music and run the script:

python3 spectrumLED.py

Real-world examples

Beto Sanchez: 1 and 2

About

Spectrum analyzer on a LED matrix 🔉

Topics

Resources

Stars

12 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages