Band Audio Spectrum Visualizer Analyzer

by John3904 in Craft > Art

2520 Views, 2 Favorites, 0 Comments

Band Audio Spectrum Visualizer Analyzer

24835.jpg

About The Project

This project is used to make 32-band audio (music) spectrum analyzer/visualizer using Arduino. The intended readers of this project are audio enthusiasts who have a basic understanding of electronic components, Arduino, and C programming.

Main Features Of This Frequency Spectrum Analyzer

  • Use the easy-to-install libraries (Arduino TFT) and (MD_MAX72xx).
  • The audio signals of the left and right channels are mixed together, so you will not miss any beat.
  • The prototype uses a 32x8 LED matrix display, which can be changed and easily modified.
  • Audio can be input from the headphone output or the line output of the music system/amplifier.

Supplies

Arduino Nano ×1

Resistor 10k ohm ×1

Resistor 4.75k ohm ×3

Capacitor 100 nF ×2

Resistor 100k ohm ×2

Sparkfun button switch 12mm ×1

32×8 LED matrix display ×1 or 8×8 LED matrix display ×4

Schematic Diagram

1590323246249.png

The Arduino development board can be powered through the USB port or 5v charger socket. For the LED display power supply, it is powered by the 5v pin on the Arduino board. The different voltages mentioned in the schematic are approximate and may be slightly different in your system.

System Describe

The Arduino development board (ATmega328P) has a built-in analog-to-digital converter (ADC) that can be used to convert the input audio signal to digital samples. The ADC is configured to sample the input signal at a clock frequency of 38.46khz. This can be achieved by configuring the ADC Prescaler to 32. The 38.64Khz sampling frequency means that digital sampling can reproduce up to 19.32Kz (Nyquist theorem) input frequency, which is enough to meet the requirements of audio signals.

As I mentioned at the beginning, the intended purpose of the project is to display the spectrum of audio music signals. Therefore, the left and right audio channels are mixed together and fed into the A0 analog input of the ADC. You can use an audio splitter cable to feed the same music to the spectrum analyzer and another amplifier (if needed).

The ADC is configured to use an external reference voltage. In this project, the reference voltage comes from a 3.3V stable voltage source on the Arduino board. When the analog signal oscillates above and below zero voltage level, we need to apply a DC bias to the analog input of the ADC. This ensures that the ADC output does not limit the negative period of the input signal. Use two resistors R1 and R2 to divide the same 3.3V stable voltage, and then feed it into the analog input to obtain DC bias. With this DC bias, the ADC will produce 512 in the output even if the input signal is disconnected. The 512 caused by the DC offset is then subtracted from the code so that the reading represents the actual input signal change.

The ArduinoFFT library is the core of the code, which converts the input analog signal into a frequency spectrum. I found this library easy to use and provided the best accurate output for the project. The prototype is configured to take 64 samples and perform FFT on these samples. The ArduinoFFT library can perform FFT on samples between 16 and 128, which can be configured in the program. But the 128 samples of the Arduino TFT library are very slow, so I stick to the best and highest 64 samples.

The display used in this project is a 32-column x 8-row LED matrix. The MD_MAX72xx library makes display controls very easy. The library provides functions to turn on / off any number of LEDs in the column being used in the program. The amplitude of each frequency band is mapped between 0 and 8, depending on the amplitude corresponding to the number of LEDs in each column.

The program has five display modes, which can basically be achieved by turning on / off the LEDs in different positions in each column. You can easily modify/create different modes. Use the buttons here to change the display mode. Each time you press, the display mode will move to the next mode and finally reset to the default mode. This button is connected to one of the digital inputs and will be scanned every time the display is refreshed.

Connection Input

擷取.PNG

You can feed audio input to this spectrum analyzer in many ways. You can get a LINE audio output from the music system/amplifier. Another option is to get audio from the headphone output of the mobile phone/music system. I do not recommend using other microphones to receive audio, because the signal level and frequency response will depend on many factors.

This is an example diagram of connecting LINE from the amplifier/music system to the Spectrum Analyzer.

Code

If you wanna see more click Here

Photos and Video

24394.jpg
Band Audio Spectrum Visualizer Analyzer