
You can modify / create different pattern easily. Amplitude of every frequency band is mapped between 0 to 8, depending upon the amplitude corresponding number of LEDs in each column get turned ON.įive display modes are available in this program which is basically achieved by turning on/off LEDs at different positions in every column. This library provides function to turn on/off any number of LEDs in a column which is being used in this program. MD_MAX72xx library made the display controlling part very easy. But arduinoFFT library is slow for calculation with 128 samples hence I stick to the best highest of 64 samples.ĭisplay used in this project is 32 columns x 8 rows LED matrix. ArduinoFFT library can do FFT of samples between 16 to 128, this can be configured in the program. Prototype is configured to make 64 samples and does FFT with those samples. I found this library is easy to use and produced best accurate output for this project.
#LED MUSIC VISUALIZER PROGRAM CODE#
Later in the code this 512 which is caused by DC bias is being subtracted so that the reading represent the actual input signal variation.ĪrduinoFFT library is the heart of the code which does translation of input analog signal into frequency spectrum. With this DC bias ADC will produce 512 in the output even if the input signal is disconnected. Same 3.3v stabilized voltage is divided with two resistors R1 & R2 and then fed into the analog input for DC bias. This ensure that ADC output doesn’t clip on the negative cycles of the input signal. As analog signal oscillates above and below zero voltage level we need a DC bias at the analog input of the ADC. In this project reference voltage for is derived from the 3.3v stabilized voltage source on the Arduino board. You may use a audio splitter cable so that you can feed same music simultaneously into spectrum analyzer and into another amplifier ( if needed ).ĪDC is configured to use external reference voltage. Hence left and right audio channels are mixed together and fed into the A0 analog input of the ADC. Sampling frequency of 38.64Khz means that digital samples can reproduce input frequency of upto 19.32Kz (Nyquist's theorem) which is good enough for audio signals.Īs I mentioned in the beginning, the intended purpose of this project is to display frequency spectrum of audio music signal. This is achieved by configuring ADC prescaler to 32. ADC is configured to sample input signal with the clock frequency of 38.46khz. Please make sure R1 & R2 (refer schematic) are of same value.Īrduino board (ATmega328P) has built in Analog To Digital converter (ADC) which is being used here for converting input audio signal into digital samples. Resistor values are not very strict, you may choose any closest value. 5 volt power supply (usb supply will do).Push button switch - 1 no (normally comes with Arduino kit).Arduino Nano or Uno (I tried with Nano and Uno, must work with other models as well).Audio can be fed from headphone output or Line-out of music system / amplifier.


Main features of this frequency spectrum analyzer Components used in this project are low cost items and are easy to assemble. Expected audience of this project is any audio enthusiast, student or a beginner who has basic understanding of electronic components, Arduino and C programming. This project is for making a 32-band audio (music) frequency spectrum analyzer / visualizer using Arduino.
