Ads

Get STM32 tutorial using HAL at $10 for a limited time!

Showing posts with label FFT. Show all posts
Showing posts with label FFT. Show all posts

Thursday, June 23, 2016

ARM Cortex-M3 (STM32F103) Project - 16 Point FFT Audio Spectrum Analyzer

This project is the application of FFT algorithm from my previous post. I made an audio spectrum analyzer project using ARM Cortex-M3 (STM32F013C8) and LED matrix 8x8. I used 16 point FFT. 16 point FFT will produce 16 point frequency spectrum. I only display the frequency spectrum from index 1 to 8 on LED matrix 8x8. Index 0 of frequency spectrum (DC signal) is not displayed. Index 9 to 15 of frequency spectrum (symmetrical frequency) is also not displayed.


My audio sampling rate is 35.15kHz, but the frequency sampling of FFT sample is 35.15kHz/2=17.5kHz. So, the maximum frequency domain signals that can be displayed is up to 8.75kHz (Nyquist's theorem) and the resolution is 8.75kHz/81kHz.

Wednesday, June 22, 2016

Complex DFT and FFT Algorithm Implementation Using C++ Programming Language

All four types of Fourier Transform family can be carried out with either real number or complex number. In my previous post, I shared how to implement real DFT algorithm using C++. In this post, I will implement the complex number version of DFT algorithm using C++. After that, I will also implement the Fast Fourier Transform (FFT) algorithm. FFT is another method for calculating the DFT. While it produces the same result as the DFT algorithm, it is incredibly more efficient, often reducing the computation time by hundreds. The algorithm that I use in this post is based on The Scientist and Engineer's Guide to Digital Signal Processing book. This book is very good for beginner to learn DSP.

The complex DFT transforms two N point time domain signals into two N point frequency domain signals. The two time domain signals are called the real part and the imaginary part, just as are the frequency domain signals. You can calculate the real DFT using complex DFT by move the N point signal into the real part of the complex DFT's time domain, then set all of the samples in the imaginary part to zero. Samples from 0 to N/2 of complex DFT correspond to the real DFT's spectrum.