Audio spectrum analyzer on PIC32 using pic microcontoller

This simple audio spectrum analyzer is based on PIC32 proto board on PIC32MX360F512L with 320×240px colour LCD (LVC75Z779 Eval Board).  The analyzer can be connected to unamplified audio source like PC’s sound card, MP3 player and so on.

Audio spectrum analyzer on PIC32SSD1928 Module Schematic diagram

The reference voltage of ADC is set to 1V with potentiometer connected to Vref+ pin of PIC32. Voltage of the audio signal could be negative but PIC’s ADC accepts only positive voltages. That’s why another pot is used to add 0.5V DC to audio signal. Finally coupling capacitor is used to isolate DC bias from audio source.


PIC’s ADC is configured to take samples at ~48kHz frequency. When each sample is converted interrupt is generated and sampled value is placed to the buffer. Sampling is completed when 2048 point buffer is full. It takes about 42ms at 48kHz sampling frequency.

Since sampling is done automatically in background we have enough time to do all calculations to previous samples while sampling new ones. First fast Fourier transform is calculated, then the results of FFT are scaled to volts or decibels and finally spectrum is drawn on LCD. At 80MHz it takes about 35ms to do all calculations and draw image on the screen.

Audio spectrum analyzer on PIC32I found FFT algorithm for this project from here. It uses fixed point arithmetic and is written in pure C without any optimisations for PIC32. I have expanded it to be able to calculate 2048 point FFT. It takes about 9ms to calculate 2048 points but I think the performance could be improved by optimizing the code for MIPS architecture.


For more detail: Audio spectrum analyzer on PIC32

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us: