Audio Spectrum Visualizer Using Arduino & Matrix Display

Nearly everyone has either inexpensive or pricey music systems in their houses. The majority of musical performances, festivals, and nightclubs have expensive disco lights to create visual effects that sync with the beat of the music. I therefore intended to construct a custom audio spectrum visualizer that could react to sound effects. The Arduino Nano worked as the project’s central component, along with a sound sensor, 32×8 Dot Matrix Display, and other components.

The Dot Matrix Display’s LEDs will respond to the Analog audio signals that the Arduino Nano’s sound sensor—which is attached to its Analog pin—receives. The Analog audio signals from the sound sensor can be received by Arduino’s built-in ADC (Analog to Digital Converter) input pin, which can then convert them to digital signals.

Project

Audio-Spectrum-Visualizer-Matrix-Display

Circuit Schematic

Audio-Spectrum-Visualizer-Circuit-Diagram

Components

  • Arduino Nano
  • MAX7219 Dot Matrix Display Module (8×32)
  • Sound Sensor
  • Connection Wires
  • Breadboard
  • 5 Volt Power Supply

About Parts

Dot Matrix Display

There are various colours of LED matrix on the market, including single, dual, and RGB colours. Additionally, they come in a variety of sizes, including 5×7, 8×8, 16×16, 8×32, 32×32, and more.

This 8×32 LED Matrix Display is made up of four internal connections between individual matrix displays. Given that each module has a single Maxim MAX7219 chip and may be linked using the same power and data connection, these displays can also be detached from one another. Because of this, it will be simple to replace any damaged single displays.

MAX7219 LED Driver Chip

There are two ways to operate these matrix displays. One method involves sending the parallel data to every row or column in a parallel fashion. The second method is serial data transmission, in which data is delivered serially and transformed into parallel data using an integrated circuit.

A common cathode display driver with parallel and serial output is the MAX7219. It connects 64 individual LEDs to microprocessors and microcontrollers. The MAX 7219 is linked to the 8×8 LED matrix. The Arduino board provides the MAX7219 with the data input.

Circuit Connection of Audio Spectrum Visualizer

The following describes the entire circuit connection for the Arduino Nano to interface with the 32×8 LED Dot Matrix Display and sound sensor.

The Arduino Nano 5V output pin provides a 5V power supply for the Dot Matrix Display and sound sensor. However, for a better current supply, you can use an external power source. The Arduino Nano’s A0 pin is linked to the sound sensor’s analogue data pin.

You are now in the section on Dot Matrix Display. Attach the display module’s VCC and ground pins to the Arduino Nano’s +5V and ground pins, respectively. Additionally, attach the DIN, CS, and CLK pins to the Arduino Nano’s D11, D10, and D13.

Arduino Code

#include <arduinoFFT.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
MD_MAX72XX disp = MD_MAX72XX(MD_MAX72XX::FC16_HW, 10, 4);
arduinoFFT FFT = arduinoFFT();
double realComponent[64];
double imagComponent[64];
int spectralHeight[] = {0b00000000, 0b10000000, 0b11000000,
                        0b11100000, 0b11110000, 0b11111000,
                        0b11111100, 0b11111110, 0b11111111
                       };
int index, c, value;
void setup()
{
  disp.begin();
  Serial.begin(9600);
}
void loop()
{
  int sensitivity = map(analogRead(A6), 0, 1023, 50, 100);
  Serial.println (analogRead(A6));
  for (int i = 0; i < 64; i++)
  {
    realComponent[i] = analogRead(A0) / sensitivity;
    imagComponent[i] = 0;
  }
  FFT.Windowing(realComponent, 64, FFT_WIN_TYP_HAMMING, FFT_FORWARD);
  FFT.Compute(realComponent, imagComponent, 64, FFT_FORWARD);
  FFT.ComplexToMagnitude(realComponent, imagComponent, 64);
  for (int i = 0; i < 32; i++)
  {
    realComponent[i] = constrain(realComponent[i], 0, 80);
    realComponent[i] = map(realComponent[i], 0, 80, 0, 8);
    index = realComponent[i];
    value = spectralHeight[index];
    c = 31 - i;
    disp.setColumn(c, value);
  }
}

Leave a Comment