Go Down

Topic: Going from pure matlab program to hardware (Read 838 times) previous topic - next topic



I wrote an app in matlab that captures a sound clip from the microphone, fourier transforms the data, picks off the highest peaks, and outputs the frequencies of these peaks. It works but is entirely in my computer.

Now I want to program an arduino (or sanguino, or anything standalone) to do the same thing. I'm a newbie so a dumbed down answer is okay and appreciated. How do I first interface the microphone with arduino. And second how do I translate straight matlab programs I've written into something that runs on the arduino?


James C4S

There are any number of ways to physically connect a microphone to a microprocessor.

As for your Matlab algorithm, it will need to be re-created in C.  You'll take sampled data (probably from the ATmega's built-in A/D converter), process it, and do something with it.

Be prepared however, the Arduino only has 1-2k of RAM available.  Then limit tends to hamper it working with anything but the simplest DSP algorithms.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com


Great, thanks!

Re-writing in C is no problem. I'll keep looking in to physical connections but any other advice or links to similar projects would be great!

As for the 1-2k RAM limit, that sounds tricky. I did a little looking around and Sanguino seems to have more RAM? Perhaps "Sanguino" is a bad word on the Arduino forums, so I apologize, but anyway my point is: Which microcontroller would you recommend, such that I have enough RAM to do such a task.

Of course, it entirely depends on how long the sound segment is, and the sampling rate etc. However surely even without that knowledge, certain microcontrollers will come to the experienced user's mind, which have high RAM and are often used for audio stuff and fourier transforms?


James C4S

The Arduino-varient isn't the issue.  Arduino's are based on the ATmega series of processors.  Most of them are based on the 168 or 368, which has a 1k and 2k RAM limit.

The Mega2560 has a 8k limit, but even that is small compared to what matlab is use to.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com


In fact you can add external SRAM to one ATMEGA644(one sanguino stock it as 4K) or one atmega1284(an arduino mega).
Using the elm-chan hand-crafted FFT engine, doing one 64 points FFT uses about 480Bytes of Ram, thats not that much, the 512 points one should run in one atmega644, but I dont know about inverse FFT's to reproduce what you want.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131