FFT Library for Arduino Due, SAM3X

Hi, Magician!

Thank you for the library!

I'm doing the first steps and so I apologize for the childish questions))
There is a periodic signal. What are the close values of frequencies of the signal will be optimal for the algorithm?
How to set the size of the sample ?

Безымянный.jpg

I don't understand your questions. Signal shown on the picture doesn't need an fft, regular digital counter 'd be sufficient to determine F. Plz, start another thread if you don't know how, as it not related to fft at all.

Magician:
I don't understand your questions. Signal shown on the picture doesn't need an fft, regular digital counter 'd be sufficient to determine F. Plz, start another thread if you don't know how, as it not related to fft at all.

It is a signal from the receive coil of the metaldetector.
I want to try to decompose the signal from the target using fft, to accumulate data from multiple samples , and to process the obtained data.
This should improve the quality of recognition of the material type and purpose.

sorry, I'm missing the link for the FFT lib for Due in between those many posts -
can anybody please provide a download link (e.g., on githib or where ever)?

ArthurD:
sorry, I'm missing the link for the FFT lib for Due in between those many posts -
can anybody please provide a download link (e.g., on githib or where ever)?

On drive google : https://drive.google.com/file/d/0Bw4tXXvyWtFVTGxGdVlJS0JmTjg/view?usp=sharing
https://drive.google.com/file/d/0Bw4tXXvyWtFVTGxGdVlJS0JmTjg/view?usp=sharing

sorry, don't see a FFT Arduino Sketch lib

ArthurD:
sorry, don't see a FFT Arduino Sketch lib

What is it?

  1. You didn't see it before, but now you see it.
  2. You don't see it now.
  3. You can't navigate to google drive link.
  4. You can't download
  5. You can't open file.
  6. You don't see a library in the downloaded and unpacked file.
    7 Something else, what exactly

ok, forget it, thanks.
I expected a github link to a Sketch lib.

Thx Magician.

It´s alive!

Board: arduino Due
TFT: ILI9341, 2.8" and 2.2"

Library: ILI9341_due V094 by MarekB

sketch and font

Thanks for the Library. If my FFT_SIZE is 1024, do I just have to take every other value from the table

const int16_t  Sinewave[NWAVE] PROGMEM = {

    +0,   +13,   +25,   +38,   +50,   +63,   +75, ....

?
thanks
chris

[Doing FFT to determine the responses of flies expressing Parkinson's related genes]

biol75:
Thanks for the Library. If my FFT_SIZE is 1024, do I just have to take every other value from the table

const int16_t  Sinewave[NWAVE] PROGMEM = {

+0,  +13,  +25,  +38,  +50,  +63,  +75, ....



?
thanks
chris

[Doing FFT to determine the responses of flies expressing Parkinson's related genes]

You don't need to worry about sinewave table, algorithm takes care itself. You only change declaration:

#define    FFT_SIZE          2048  <--- this to 1024
#define    LOG2_FFT            11 	/* log2 FFT_SIZE */ <------ and this to 10

Thanks for the quick response - very helpful
chris

I've been with arduino nearly since the begining. (had a Parallax Basic Stamp as my first MCU, then the Propeller (wow) and then bought a MEGA2560ADK (official). And over the last few years I've gotten a YUN, HUZZAH ESP8266, a few mini's and now a DUE last week. Been on the forums for a few years learning C && C++ fun.
Forgive my ignorance on the subject. So the FFT_SIZE is 2x the number of "bands" available and the analog sample rate is 2x the nyquist sample rate? Does it matter if I configure it for say 16 or 32 or 512 FFT size and audio rates?
I've little background in algebra and dont know calculus so sorry for that. Tried to read a book on FFT and howto implement it in a digital sense but found it hard to follow the calculus (frustrating having only some AEES studies sometimes)

If i can get this to compile and want to display maybe 7 bins/bands for starters on my TFT, I just leave the FFT library as standard in Magicians library demo and just pick every 146 bin for display (1024 / 7 = 146)?

I found this elsewhere rinkrides hope this helps you out.

johnwasser:
The results of the FFT will be a list of amplitudes at a set of frequencies. The frequency of each sample depends on the sample frequency.

For each 'bin' N the frequency is N * Sample_Rate / FFT_Size

Your sample rate is whatever the free-runing rate of the ADC is. I don't remember offhand. It should be in the datasheet. Let's call it 70 KHz.

Your FFT_Size is 256.

Bin 0 frequency = 0 * 70,000/256 = 0 (DC offset)
Bin 1 frequency = 1 * 70,000/256 = 273.43 Hz (this will also be the step size in your frequency)
Bin 2 frequency = 2 * 70,000/256 = 546.875
Bin 3 frequency = 3 * 70,000/256 = 820.3125
...
Bin 127 frequency = 127 * 70,000/256 = 34,726.56

The top frequency is half the sample rate.
The sample step size is the sample rate divided by the the sample size.

And now i have a question myself. I understand what i am getting. but I do not understand the operation. When ever i try to take the array (magnitude) and try to do some processing on it, it just stops working and no further process happens. ... it even prints half of the message out of my Serial.println. I spent a good 4 days fiddling with this stuff between google and the program. Cant really get it to work.

HEREs what i know for sure... I have no idea how the example code works. so i do not know when it gets samples in data (altho i have an idea when) and where it starts to process that data. I would like to take that data and crunch some data out to make some light flash in different locations based on frequency. Thanks in advance

Don't know if there original problem was already solved. I've tried several options, including FFT/FHT from Open Music Lab, fix_fft and Radix_4. However, I found the library not easily readable for beginners. So I wrote my own version FFT with the basic Cooley-Turkey algorithm.

Here is the link: GitHub - dujianyi/ardFFT: A simple FFT for Arduino DUE.

I've tried on Arduino Due and it works perfectly. I didn't put the .ino file in GitHub, but if someone needs it, I can send it to you.

Hope it helps the beginners.

dujianyivapor:
Here is the link: GitHub - dujianyi/ardFFT: A simple FFT for Arduino DUE.

I didn't put the .ino file in GitHub, but if someone needs it, I can send it to you.

Hope it helps the beginners.

Hi, thanks for sharing your FFT solution, I have previously looked at the Radix-4 FFT solution posted on the no longer existent coolarduino.wordpress.com site, I am interested in looking at yours also, would you mind sharing the .ino with me please?
I wonder if you use interrupts or how you read the signal and use the functions provided.

Many thanks.

Hi Magician. Both links you have provided in the past to the library are broken. Any chance you could post it somewhere again please?

Thanking you in advance, Steve.

I am using these FFT libs -
is there anything wrong with it for the Due?

http://paulbourke.net/miscellaneous/dft/

(for FFT scroll down!)

CM_Guy:
Hi Magician. Both links you have provided in the past to the library are broken. Any chance you could post it somewhere again please?

Thanking you in advance, Steve.

Hi, I updated a link in the original post, try and see if it works.

Thanks Magician, I that link worked. I'll try the code out soon.

Steve.