This is a promoted post written by 43oh member, Fmilburn. You may find a detailed post with code and schematics in his build thread “FFT“.

I was inspired a while back by the simplicity of the FFT application written by Shane Ormond and featured on the 43oh blog.  It was easy to duplicate and I’ve made a few changes, additions, and such that seemed worth documenting.

I didn’t have a signal generator other than the 1kHz square wave on my oscilloscope and some clunky code that I wrote for a microcontroller so I ordered an inexpensive AD9850 and hooked it up to a FR6989 LP so I could use the LCD to display frequency.  I’ve been pleased with the AD9850 and it is hard to beat it for the price.  The sine wave is more than sufficient for my needs up to 40 MHz – I don’t see any deviation from the scope.  The code is here.  This is a picture of the setup being tested on the oscilloscope and nailing it:

AD9850_fft_MSP432_launchpad (3)

I need to make a little boosterpack for this so it is a little handier to use. I made several modifications to Shane’s code:

  • Number of samples can be specified
  • Bin readings are matched with corresponding frequency interval
  • Frequency resolution of bins can be set
  • Frequencies of up to 5 kHz or more can be measured

I used a MSP-EXP432 for the most part but the code was also tested and works on the TM4C123.  You really need an ARM to get this granularity.  The code is here.

To increase the sample size and allow measurement up to higher frequencies I used Energia’s delayMicroseconds instead of millis.  The right way to do this would be with timers and I hope to come back and address this at some point.  To calibrate the bins to their actual frequencies I used a simple one step approach with a single pass that measures the deviation in the sampling time from expected to actual.  Deviations occur due to the lag associated with Energia code and the actual time it takes to sample.

Precision depends on the bin size and number of samples as well as inaccuracies in using delayMicroseconds.   I posted the serial output into a spreadsheet to get some plots.

1000 Hz Square Wave

1000 Hz Square Wave

 

1000 Hz Sine Wave

1000 Hz Sine Wave

 

5000 Hz Sine Wave

5000 Hz Sine Wave

My original goal was to create something that could process sound in the range of human hearing and this pretty much gets there.  I need to clear my desk for another project but hopefully I get back to it some day or perhaps someone else will find it interesting and report back ;)

This is my list of potential improvements:

  • use timer for sampling times
  • add a microphone
  • improve the graphical display / GUI

It would be neat to get this working on an Educational BoosterPack.

Discuss this project and ask questions in Fmilburn’s “FFT” thread.

Pin It on Pinterest

At least I'm not a mid-screen pop up.

We'll only send you 2-4 emails a month, right when new posts come out.

You have Successfully Subscribed!