How do you obtain the real and imaginary parts of a signal using FFT in arduino? I could not find a particular tutorial with code for this purpose in the internet.

  • Probably not. The Arduino isn't exactly the tool of choice for digital signal processing. All you need is any FFT implementation in C, and you should be able to port it to the Arduino pretty easily. The problem is getting a steady, fast sampling rate on the Arduino - that, and processing it fast enough on a slow, general purpose processor. – JRE Jan 1 '20 at 16:04
  • 2
    There are some implementations around such as arduinolibraries.info/libraries/arduino-fft - whether it extracts the real and imaginary parts I do not know. – Peter Smith Jan 1 '20 at 16:07
  • @PeterSmith Good hint, and it should return a imaginary part too! The Compute-Method takes two double pointers one to the real part samples and one to an array of 0.0 initialized imaginary part samples. Both arrays must have the same size. After computation the imaginary array is filled with the imaginary parts of the FFT. The library also provides examples. – Peter Paul Kiefer Jan 1 '20 at 18:11

Most libraries will either take one array of samples as input and then fill two other arrays of real and imaginary data, or it will take one array of samples and one empty array as input, and the sample data will be replaced by the real data and the empty array filled with the imaginary data.

You will have to first choose a library to use and then read the examples or documentation to see what the format of the functions are.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.