seeking Guidance on frequency analysis.

Hi everyone, the goal of my project entails recieving analog signal from a photoresistor that is subjected to a strobe light, and then using either the FFT or FHT library (both links provided below) to view the weighted or primary numeric HZ frequency at which the light is blinking in the serial monitor. Both libraries offered a method to visualize the data which would be cool, but truly I need to acquire the dominant frequencies in readable numeric values so that I may incorpate the observed values into further code. I am sure this must be doable as the comments section is filled with individuals who had no troubles using the code
I would be very greatful if someone would drop some knowledge on me ( I am at a beginner level in coding .) much appreciated.

here is the link to the FFT library i have tried to employ:

http://wiki.openmusiclabs.com/wiki/ArduinoFFT


Here is the link of the FHT variation of the library that i have tried to employ. It seems very promising and this is the library i would prefer to use due to its processing speed,:

http://wiki.openmusiclabs.com/wiki/ArduinoFHT


Here is the fft_adc code provided in the first library:

/*
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.
*/

#define LOG_OUT 1 // use the log output function
#define FFT_N 256 // set to 256 point fft

#include <FFT.h> // include the library

void setup() {
  Serial.begin(115200); // use the serial port
  TIMSK0 = 0; // turn off timer0 for lower jitter
  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
      fft_input[i] = k; // put real data into even bins
      fft_input[i+1] = 0; // set odd bins to 0
    }
    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_log(); // take the output of the fft
    sei();
    Serial.write(255); // send a start byte
    Serial.write(fft_log_out, 128); // send out the data
  }
}

Here is the code i have been trying to employ from the FHT library:

/*
fht_adc.pde
guest openmusiclabs.com 9.5.12
example sketch for testing the fht library.
it takes in data on ADC0 (Analog0) and processes them
with the fht. the data is sent out over the serial
port at 115.2kb.  there is a pure data patch for
visualizing the data.
*/

#define LOG_OUT 1 // use the log output function
#define FHT_N 256 // set to 256 point fht

#include <FHT.h> // include the library

void setup() {
  Serial.begin(115200); // use the serial port
  TIMSK0 = 0; // turn off timer0 for lower jitter
  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 < FHT_N ; i++) { // 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
      fht_input[i] = k; // put real data into bins
    }
    fht_window(); // window the data for better frequency response
    fht_reorder(); // reorder the data before doing the fht
    fht_run(); // process the data in the fht
    fht_mag_log(); // take the output of the fht
    sei();
    Serial.write(255); // send a start byte
    Serial.write(fht_log_out, FHT_N/2); // send out the data
  }
}

when I open the serial monitor it displays only characters and symbols.

A generous commentor from the linked website offered this advice;
“the data is coming out in raw binary. you can change this by doing
serial.println for each data bin. there is also a puredata visualizer
and processing visualizer on the wiki. best of luck”

I am still very beginner at coding and did not understand how to achieve this.
Again just to clarify, my only goal is to view the realtime numeric primary frequency values( perhaps weighted to indicate which frequencies are most dominant?) in Hz (in the serial monitor) associated with the incoming analog signal.

I am also open to try other libraries that could achieve this same goal.

Thank you very much, any and all wisdom that can be lended would really help me out.

For my self I'd just use anlaogRead to get the values, send them via serial to the PC and use the PC to do any real work (graph in a spread sheet).

But while an uno can do around 10,000 reads per second it can't send them in real time (Serial is too slow to keep up, in which case it blocks and then your reads are not spaced evenly). Google Arduino o'scope for more info.

Mark

You don't need an fft if there is only one dominant tone, better to use this library: http://interface.khm.de/index.php/lab/experiments/frequency-measurement-library/ fft is unavoidable with 3 and up tones

Magician: Thank you for showing me that library, I had not yet seen this one. I think I may be setting up the pins incorrectly as i was confused by the code lines "connect pin 5,6,7 to input circuit" I could not decipher from the code what pin the analog signal is to be read from? At this point , the code uploads fine but the serial monitor still dispalys symbols. However from the link you posted I think if this works this will be extremely useful for me thank you very much

holmes: thanks for the suggestion on the o_scope i will def look into that as well.

I am still just reading symbols on the monitor not sure whats wrong. Thx to all who have any advice at all