LED Matrix Audio Spectrum Visualizer

Everyone enjoys listening to music and LEDs look sweet. Put them together in this awesome Arduino based Audio Spectrum Visualizer that not only vibes with your sick jams but has other cool effects for an interesting room ornament.

Overview

The basis of this project is an 30×8 LED matrix and the MSGEQ7s band graphic equalizer chip all controlled by an Arduino that allows you to visualize levels of 7 frequency bands of any audio you play.

The LED used is the WS21812B. These little guys are easy to use, product great colors and can be pretty bright. They are effectively NeoPixels but you can get great deals on them from Aliexpress.

The MSGEQ7s are seven band graphics equalizers that include the anti-aliasing filters, bandpass, and multiplexor 63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz and 16kHz, making this kind of audio detection a breeze. We’ll use two of them for left and right audio.

Some other ways to do this would be through an FFT done on the Arduino as shown in this Adafruit article or doing the FFT on your PC in Processing and sending the spectrum levels serial to the Arduino as done here. Ultimately, I settled on the MSGEQ7s as they are just really easy to use. They are fairly common in these types of hobby projects you can find plenty of other similar audio spectrum visualizers out there that use them as well. Some times you can’t beat the ease of analog.

An old ATX PSU was used to provide the fairly large power required by the 240 LEDs. At max brightness and full white each LED takes about 60mA, so about the total matrix could potentially draw up to 14.4A! You can use some other supply if its rated high enough, or you can make sure you don’t run them at full brightness or just make a smaller matrix.

BOM

  1. Bare bones Arduino board
  2. 240 WS2812B Digitally Addressable RGB LED.
  3. Old PC ATX PSU. I used a 240W, which can provide 30A at 5V which is plenty. Amazon also has cheap ones.
  4. 2x MSGEQ7 Band Graphic Equalizer IC
  5. 2x 3.5mm audio jacks (these are pretty cheap ones, might be worth get some better quality ones)
  6. MCP4725 DAC Module (not necessary for the audio visualizer aspect but I added this as extra feature to provide a variable reference voltage on my bench)
  7. 1000uF bulk cap for LEDs (smaller may be acceptable depending on size of LED matrix)
  8. 4x 0.1uF cap
  9. 2x 0.01uF cap
  10. 2x 33pF cap
  11. 2x 200kΩ res
  12. 2x 20kΩ res.
  13. 300-500Ω resistor
  14. Banana jacks for power connections
  15. Assorted wiring and connectors. I use these is for simple power connections and and jumper wires for board wiring so I take it apart if I want.

Schematic

Audio Spectrum Visualizer Schematic

Assembly

LED Matrix

How you make your LED matrix is totally up to you, what your willing to spend and how creative you want to make it. I kept my low cost and lightweight by using two 12″x 16″ painting canvases that I had lying around, painted them black, used chopsticks and glue to stick them together (for a final size of 24″x 16″) and glued my LEDs to it. Not glamorous but you can’t really notice it as the LEDs are so bright.

Painting the canvas black

 

Fixing two canvases together using chopsticks and hot glue like a professional.
LEDs glued and wired in 30×8 matrix to canvas

The WS2182Bs serially interfaced, so when wiring strings make sure you look at the arrow direction on the strip. Also don’t forget the series 300-500Ω resistor on the data line to prevent voltage spikes from damaging it.

LED Matrix connections

You’ll also want to distribute power and GND connections across the LED string, rather than have only a single power and GND connection on one end. When you have the LEDs at higher brightness this will ensure each LED gets enough power (you can most notice this by turning up the brightness with all LEDs white, you’ll notice some won’t be white but more yellow/orange.)

Matrix Controller and Power

First, I cut most of the wiring out of the ATX PSU and added a switch to turn it and off, there plenty of articles online on how to do this, but typically you switch a certain wire to GND to turn it on. Then I add an LED and resistor to one of the voltage rails to indicate power on.

Inside of front panel (not final so not all connections shown)

Using the cover of the ATX PSU I then drilled holes and added the appropriate external connections. These included power indicator LED, power switch, potentiometer (for brightness control), rotary encoder (for feature selection), a couple 5V and GND connections (using the banana jacks) and the jumper wires. The jumper wires were used for:

  • RESET, RX, TX for programming the Arduino. Rather than drilling extra holes for these I routed these jumper wires out of the cooling slits on the side of the ATX PSU.
  • 5V, GND, DAC out for the MCP4725 DAC module
  • Arduino UNO digital pins 12 and 13, for which 12 is used for the LED data line, 13 is extra for something I may want in the future.
  • 5V, GND, Audio left, Audio right, RESET, STROBE for the MSGEQ7 peripheral board, also routed through the cooling slits.

If you wanted this could also serve as a bench power supply and you could add extra banana jacks for the various power rails from the ATX supply, eg. ±3.3V, ±5V, ±12V.

Plastic board mount for ATMEGA328 based bare bones Arduino board.

Using a piece of plastic cut from a food container and some M3 screw standoffs I fashioned a mount for the bare bones ATMEGA328 Arduino board. Then simply make the appropriate connections  to the Arduino board and peripherals, carefully fit it in the enclosure and making sure nothing shorts to anything it shouldn’t. I didn’t need to physically attached the microcontroller board as it seem to fit snuggly with all the wires in the housing.

Internals of the ATX PSU with ATMEGA328 and extras highlighting my lack of wire organisation.
Finished assembly. Shown with LED power and data lines connected (with 1000uF bulk cap). The MSGEQ7 peripheral board connections shown on the right side of ATX box.

You’ll also want a beefy bulk cap for all the LEDs depending on how many you have and expected brightness, I used 1000uF.

MSGEQ7 and Audio Connect Peripheral Board

I wasn’t able to fit all the components within the ATX PSU so a peripheral board was made for the 2 MSGEQ7 chips and the 3.5mm audio connections. I simply used a prototype perf board for this and used epoxy to make a 100mil pitch header connector to interface to the jumper wires of the main ATX assembly. I would also highly recommend using DIP sockets for the MSGEQ7s as they are quite ESD sensitive and you may need to replace them.

MSGEQ7 and Audio connection peripheral board.

You’ll then simply connect your audio in (eg. computer) and the audio out (eg. speakers) to the 3.5mm jacks and the 100mil pitch header connection to the ATX controller assembly.

Side of device showing programming headers and MSGEQ7 peripheral board connection.

Once the whole system is assembled you shouldn’t have to take it apart and can program it through the RST, RX, TX header connections as mentioned in my bare bones Arduino build.

Enclosure for MSGEQ7 Board

As the MSGEQ7 peripheral board wasn’t able to fit in the ATX PSU I made a simple 3D printed enclosure for it, which I covered in this post.

3D printed MSGEQ7 board enclosure.

To secure this to the ATX PSU and just used some industrial adhesive velcro tape.

Completed Audio Spectrum Visualizer system.

Code

Below is the first revision of the code. I will continue to add features to this project and update the code provided here.

RML Audio Spectrum Visualizer

This first revision has the following features:

  • Potentiometer controls brightness.
  • Pushbutton to move between effects
    • Several different Audio Spectrum Visual effects. Rotary encoder typical changes rate of color change. Most of these effects rely on an average of the left and right audio channels.
    • Solid Color. Encoder shifts through RGB colors including white.
    • Rainbow effect.
    • Rainfall effect, rotary encoder selects frequency of new raindrops.
    • Adjust the DAC output level with encoder, LED matrix visually shows level between roughly 0 to 5V.

Since the MSGEQ7 is analog the amplitude of the frequency bands is dependent on the volume of the music played through aux jack. The downside of this is that if the volume is too low the amplitudes will be low and alternatively if the volume is too high the levels will saturate. In both cases the audio spectrum visualizer won’t really look good. To correct for this you can adjust the volume from you audio playback device so that the amplitudes look good and then adjust the volume from your speakers to your desired listening level.

Results

 

Future Improvements

  • Noise reduction on the MSGEQ7 data. When not playing any audio, or when the volume is low a couple frequency bands from the MSGEQ7 are a bit noisy with occasional large spikes in amplitude. This isn’t noticeable when music of reasonable volume is played but can be a bit annoying in between songs and quiet parts.
    •  Likely I’ll do this through either oversampling the MSGEQ7s and damping the data before outputting to the matrix.
    • I’ve also heard from others that the MSGEQ7s chips are sometimes bad and exhibit these noise spikes, so replacing them may fix this.
  • More visual effects utilizing the audio spectrum levels input.
    • One example would be detecting the BPM of the song through the amplitude levels and create interesting visuals the change with the BPM
  • Housing for the MSGEQ7 and 3.5mm audio connection peripheral board.

Leave a Reply

Your email address will not be published. Required fields are marked *