Jump to content
Automate

Frequency analyzer built from the new Stellaris Launchpad

Recommended Posts

Actually, I do have the code to display on the top row as well but it does not look too good due to the gaps between the row. I will clean up the codes a bit then release it. Keep in mind that this type of LCD need some delays between commands that could cause the audio mismatch. Thanks.

Share this post


Link to post
Share on other sites

Hi,

 

Would anybody dare to state what the maximum frequency would be that can be analysed ? I am still thinking about using either the C2000 or the stellaris as a Batdetector (20khz - 100khz range).

 

cheers

 

CorB

Share this post


Link to post
Share on other sites

Hey CorB,

I'm going to venture a guess and say you'd be able to modify my code pretty easily to suit your needs.  I don't have a datasheet handy, but if memory serves me right, the ADC peripherals on an lm4f120 have a max sampling rate of 1 MHz,.  To get an upper bound of 100 KHz, you'd want to sample around 200 KHz.  I'm fairly certain that the processor and DSP algorithms I use are good enough to give you a good data rate if you're sampling at that frequency.  Your frequency bins are going to be a bit large though... The maximum FFT size that the CMSIS library allows is 2048, which means your bins are going to be 200,000/2048 wide, or ~100 Hz per bin.  

 

You're probably going to need to do something fancy for your analog input though.  For one thing, standard microphones aren't normally designed for handling frequencies above ~25 Khz (since we can't hear much audio above that).  You'll also want to be careful in your opamp selection.  It shouldn't be hard to find one that can handle up 100 KHz, but I know the one I used for my project isn't spec'd for it.

 

The final point to consider is what you're going to be doing with the data.  If you want to take immediate action based on what's happening in a frequency range, you're good.  If you want to keep a record of things happening though, you're probably going to hit memory restrictions real quick.  I have a new version of my code that I'm going to be releasing this week, and the final compiled binary takes up 32,743 bytes of ram.  Note that the chip has 32,768 bytes of ram total.  When doing DSP on a microcontroller, memory gets scarce :/

 

Hope this helps, and happy hacking :)

Share this post


Link to post
Share on other sites

Hi Euphonistichack,

 

Thanks for answering. I am using a pre-amp scheme I have used before for a heterodyne batdetector. Nothing excotic, Options are to use a 40khz ultrasonic transducer (ive used those sucessfully) or to use an electret micro with some additional filtering. Theres many schemes around.

 

I wont need that many bins in the FFT as I am planning to display the data directly on an LCD and a resolution of 1 bin/khz would deliver enough information to determine the species by. Recording data is indeed not easy unless I would simply store the "footprint" with the data /bin. 

 

Thanks for confirming the possibility to use the stellaris to do this.

 

cheers

CorB

Share this post


Link to post
Share on other sites

Great !! You have closed down the gap for me. 80Khz would be great for a bat-detector ... that would probably give a 40khz maximum readout ?

 

cheers

 

CorB

Share this post


Link to post
Share on other sites

That is correct.  Honestly, though, the only reason I cap it at 80K is because there's no reason to go higher than that in my project.  The hardware is capable of handling higher frequencies, but the larger the maximum value, the more difficult it is to set the value using the touchscreen slider.  You can change the maximum sampling frequency pretty easy in my code by editing a single macro.

Share this post


Link to post
Share on other sites

Hi,

 

Ive tried to load your new project into CCS but it failed. During the import I get an error :

 

 
Error: Import failed for project 'freq_analyzer' because its compiler definition is not available. Please install the ARMv5.0 compiler before importing this project.
 
the led project imported just fine.
 
Cor
 
 
 
 

Share this post


Link to post
Share on other sites

bwar... I recently had to update to CCS 5.3 to for an unrelated project.  I'm assuming this will be a common issue, as 5.3 was released pretty recently.  If you want to get up and running right now, updating CCS should fix it.  I think I still have version 4.9 or 4.7 of the compiler somewhere on my build system... I'll see if I can revert the compiler version in my project settings and push that to github.

Share this post


Link to post
Share on other sites

Well, with 5.3, the CCS guys changed around a bunch of tool names, including the tms470 compiler that is used for the Stellaris line (they now call it the ARMv5 compiler).  That's why you're seeing the "Please install the ARMv5.0 Compiler" message... if it were just that my project was using a newer version of the tms470, CCS would still let you import, but give you a warning.  Since my project is using a compiler with both a different version and a different name from the one you have, it's outright not letting you import the project.  I'll push an update sometime today or tomorrow with the compiler set to the tms470... in the meantime, you can try poking around the .project files in the ccs directory to see if you can find out where the compiler is declared and switch that to whatever you're using.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×