I'm designing a system which reads values from a microphone and feeds it to the Arduino to calculate a few sound parameters. The measuring happens during a couple of milliseconds. The problem is that it's way faster than the processing speed of the Arduino. So I was wondering if it was a good idea to first feed all the data to a memory and then the Arduino would get it at its pace? What kind of memories do you recommend to this application?


closed as unclear what you're asking by Chris Stratton, Dmitry Grigoryev, Finbarr, pipe, awjlogan Oct 29 '18 at 19:46

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Depends on how much is all the data. If it's just a few KB (up to 100), SRAM will likely be a good choice. \$\endgroup\$ – anrieff Oct 25 '18 at 13:11
  • \$\begingroup\$ Lets say it can reach up to 256kb \$\endgroup\$ – PLDfan Oct 25 '18 at 13:12
  • \$\begingroup\$ This is really not the solution. You want a chip with more internal RAM, or for larger needs one actually designed to efficiently interface external RAM. And you probably want one that is faster and more suitable for audio computations. An Arduino's AVR is none of these. \$\endgroup\$ – Chris Stratton Oct 25 '18 at 13:48
  • \$\begingroup\$ Sure chris i could even buy a system that was already made for the purpose. Or pay an engineer to do it for myself. These are all ways of getting to the same end, but the question is...having an arduino to process the information (and it can take how long its needed, as i didnt said that the processing system would have to be fast) will an intermediate memory work? And whatwould be the recommendation for that type of memory? Those were the questions with the constraints that it will have to be the arduino processing the data. \$\endgroup\$ – PLDfan Oct 25 '18 at 14:40
  • \$\begingroup\$ "calculate a few sound parameters", "measuring happens during a couple of miliseconds", "it can reach up to 256kb" - The numbers don't make sense to me. How can sound yield hundreds of kB in "a couple of milliseconds"? \$\endgroup\$ – JimmyB Oct 25 '18 at 15:12

SRAM will do the trick.

  • It wastes minimal amount of power and it's easy to interface (just SPI);
  • Unlimited writes/rewrites
  • Fast

Getting a chip that has 256 kB (keep in mind in most places such chips are labelled by the number of bits, so 256kB will be labelled as 2 MBit) and still retains the easy-to-use SPI interface might be more challenging, but I bet it exists. I managed to find a 1MBit one (23LC1024) in a local shop.

Keep in mind that "Arduino" has become a vague term which is more about the framework, not really about the chip. There are Arduino-compatible boards that use an ARM microcontroller inside, whose computing speed should be enough to get you computation done without the need of intermediate cache SRAM. It depends on what's most convenient and what you are actually trying to achieve.

  • 2
    \$\begingroup\$ The add on memory is unlikely to be a good solution. And no, an external SRAM interfaced to an Arduino will not be fast. Faster than the Arduino's unsuited ADC yes, but very slow in memory terms. The switch to a better board is the more meaningful part of your answer; the memory part merely endorses the asker's mistake. \$\endgroup\$ – Chris Stratton Oct 25 '18 at 13:44
  • \$\begingroup\$ I agree it's not the best solution, hence my suggestion. Since you bring up a valid point, I'd clarify that the SRAM thing only works if the low ADC sample rate of the AVR does not present a problem for the data aquisition. @PLDfan must have done the math on that part, as otherwise the AVR would be inappropriate even if it had enough memory. \$\endgroup\$ – anrieff Oct 25 '18 at 16:12

With an external 16-bit ADC, you can sample and store at 44.1KHz to SD card, or to an SRAM or FRAM, and then process, with a 16 MHz 328P or 1284P. Mono only, not enough cycles for stereo.

There is a topic at the Arduino forum website for that. (Search for sample and store for playback later, from 2 or 3 summers ago). I'd pull up the link, but I can't access the site right now.

256K samples will take nearly 6 seconds, that's way more than a few ms.

  • \$\begingroup\$ Just be clear here. This is not about sound processing, it is about getting information from an array of pressure values. Not correcting your comment, just clarifying. \$\endgroup\$ – PLDfan Oct 25 '18 at 14:35
  • \$\begingroup\$ @PLDfan Are we or are we not talking about "sound", a.k.a "audio" here? Please specify sampling rate, number of channels and width of the samples. \$\endgroup\$ – JimmyB Oct 25 '18 at 15:15
  • \$\begingroup\$ @JimmyB if i tell you i'm using a microphone to measure the pressure change at an high sampling rate, you dont necessarily need to call it sound or audio. Actually if i would be measuring pressure waves with frequency over the "audible" range you cant call it "audio"...because its not audible. It is not even sound for you.....Sounds good? ;) \$\endgroup\$ – PLDfan Oct 25 '18 at 15:27
  • \$\begingroup\$ @PLDfan So you don't want to tell us the numbers? (sampling rate, number of channels and width of the samples) \$\endgroup\$ – JimmyB Oct 25 '18 at 15:42
  • \$\begingroup\$ @JimmyB Considering that all the information presented was already enough to answer my question. No, I wont disclose more information. Thank you for your help. \$\endgroup\$ – PLDfan Oct 25 '18 at 15:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.