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.
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.
I 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
For All Your PCB Need, One-stop PCB Solution Services Appear:
EasyEDA: free PCB design tool, 200,000+ engineers are using
PCBs: 10pcs 2-layer 10x10cm only $8.21, on-time global shipping
Components: save 50% on cost, save on freight if shipped with ordered PCBs
Current Project / Post can also be found using:
- sound pic
- isis proteus kit pic32mx
- audio specturm pic