Pages: [1]   Go Down
Author Topic: Going from pure matlab program to hardware  (Read 532 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

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?

Thanks!
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Thanks!
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Portugal
Offline Offline
God Member
*****
Karma: 6
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: