I currently have a setup,AUDIO-> LM386 -> MSGEQ7 ->ATMEGA328p (16mhz)
and it works to light up an 8×8 LED matrix. 16mhz crystal.
each column lights up to represent a frequency: average, 63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz and 16kHz.
Now i want to take out the MSGEQ7 because it is $7AUD per chip, i want to make it as cheap as possible. from this link, he takes the amplified input and shifts down the values from 0-1023 to +512 – -512. http://www.waitingforfriday.com/index.php/Real-Time_Audio_Spectrum_Analyser
question:
1) Do i need to do the same? (shift the values down)
2) Instead of having 64 evenly spaced selected frequency, am i able to just choose the value that i want? (63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz and 16kHz.) im thinking of using an array of frequencies. my perception of DFT or FFT is that the samples are evenly spaced. if they are evenly spaced a cant do 8 point sample because im using a 16Kmhz crystal and means my max cutoff frequency is 8Kmhz? I will also lose anything below 1Khz?
3) at low samples, is it any more effective to implement a FFT than DFT for 7 frequencies?
4) im reading the DFT and FFT code from Texas instruments:
http://www.ti.com/lit/an/spra291/spra291.pdf
page 38-39. Thank you for the patience im just trying to proceed pretty cautiously
Best Answer
The frequency range and resolution of a DFT/FFT is dependent on the following parameters:
According to the well-known Nyquist therorem, the maximum frequency covered by the FFT is f_s / 2. In your case, the minimum sampling frequency is required to be greater than 32 kHz.
Frequency resolution (in other words: the DFT bin width) is dependent on the measurement duration: f_res = 1 / t_measurement. For your application, you need to observe a timespan of at least t_meas_min = 1 / f_min = 15.9 ms. In this case, exactly one period of your minimum frequency (63 Hz) is observed.
As a result of these constraints, you need to analyse at least ~508 samples (at 32 kHz). For improving your results, consider higher values for both parameters.
To reduce processing load, the goertzel algorithm might be a good choice as only the required frequency bins are evaluated.
In general, no value shifting is required as a constant offset is mapped to the lowest frequency bin (as long as you are not intending to use a window function to reduce spectral leakage). However, for microcontroller implementations, a value shift might be required, depending on variable types.