Hi all, I modified example code to print out the values in each bin of FFT performed on ~1000Hz. I just have a couple of questions regarding these values. Attached below is a file containing the results and my code.

Why are the values in the first two bins so high? I read in another post that it may be due to the DC offset. I thought I accounted for it, as I used a simple voltage divider to feed 2.5v to A0, and subtracted the offset (512) before feeding the values into the FFT input array.

There seems to be a “bell curve” of values surrounding the 1050Hz bin. Is this normal?

The value in the 1050Hz bin is high, over 6500. What does this value represent, and is it an acceptable value?

The values in the other bins are low (<10), but not 0. Relative to the dominant frequencies, are these low values acceptable? If not, how can I reduce these numbers?
/*
fft_adc.pde
guest openmusiclabs.com 8.18.12
example sketch for testing the fft library.
it takes in data on ADC0 (Analog0) and processes them
with the fft. the data is sent out over the serial
port at 115.2kb. there is a pure data patch for
visualizing the data.
*/
// do #defines BEFORE #includes
#define LIN_OUT 1 // use the log output function
#define FFT_N 256 // set to 256 point fft
#define DC_OFFSET 512
#define SAMPLING_FREQ (16000000/(13*32))
#include <FFT.h> // include the library
int adc_val;
void setup() {
Serial.begin(115200); // use the serial port
TIMSK0 = 0; // turn off timer0 for lower jitter  delay() and millis() killed
ADCSRA = 0xe5; // set the adc to free running mode
ADMUX = 0x40; // use adc0
DIDR0 = 0x01; // turn off the digital input for adc0
}
void loop() {
while (1) { // reduces jitter
cli(); // UDRE interrupt slows this way down on arduino1.0
for (int i = 0 ; i < 512 ; i += 2) { // save 256 samples
while (!(ADCSRA & 0x10)); // wait for adc to be ready
ADCSRA = 0xf5; // restart adc
byte m = ADCL; // fetch adc data
byte j = ADCH;
int k = (j << 8)  m; // form into an int
k = 0x0200; // form into a signed int
k <<= 6; // form into a 16b signed int
adc_val = k  512;
fft_input[i] = adc_val; // put real data into even bins
fft_input[i + 1] = 0; // set odd bins to 0
}
// window data, then reorder, then run, then take output
fft_window(); // window the data for better frequency response
fft_reorder(); // reorder the data before doing the fft
fft_run(); // process the data in the fft
fft_mag_lin(); // take the output of the fft
sei(); // turn interrupts back on
Serial.println("start");
for (int j = 0 ; j < 128 ; j++) {
Serial.print("Frequency: "); Serial.print(j * (SAMPLING_FREQ / FFT_N)); Serial.print(" ");
Serial.println(fft_lin_out[j]); // print out the data
}
Serial.print("\n");
}
}
results1.txt (13.1 KB)