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.
-
Hardware:
- Orange Pi PC (or Raspberry PI)
- PCM5102 DAC (or any other soundcard)
-
Software:
- Armbian (or Raspbian)
- Python 3 and third-party packages:
- ALSA
- LED matrix:
LED pin | OPi pin (phys) | OPi pin name |
---|---|---|
VCC | pin 4 | +5V |
GND | pin 25 | GND |
DIN | pin 19 | SPI0_MOSI |
CS | pin 24 | SPI0_CS0 |
CLK | pin 23 | SPI0_CLK |
- PCM5102 DAC (optional):
DAC pin | OPi pin (phys) | OPi pin name |
---|---|---|
BCK | pin 27 | PCM0_CLK |
DATA | pin 37 | PCM0_DOUT |
LRCK | pin 28 | PCM0_SYNC |
GND | pin 34 | GND |
GND | pin 39 | GND |
VCC | pin 2 | +5V |
- Load a loopback kernel module with:
modprobe snd-aloop
- Configure ALSA to output multiple streams with
multi
plugin. Example configuration is listed inasound.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.
-
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.
-
Configure an audio player. If you are using cmus, refer to
cmus.rc
file. I had no sound whendefault
was specified indsp.alsa.device
option. Thoughout
wrapper works fine. -
Play some music and run the script:
python3 spectrumLED.py