Some (complex?) noobie data aquisition/storage hel

I'm looking for any sort of direction on this I can get. I'm not a complete novice with the arduino (I've done every basic tutorial I know of, except maybe the I2C stuff), but I'm sure this is still very much over my head.

I'm a grad student looking to make a cheap data storage/acquisition system that would primarily get its data from something called a geophone... which, to summarize, basically puts out a small AC voltage/amperage (v in the range of a few hundred millivolts) depending on the mechanical energy it receives. I noticed one thread that came close to answering some of my questions, but it trailed off in another direction. I haven't really found anything else that was too useful.

I'd need a much higher resolution than what the arduino has to offer as far as its ADC (more like 16/20/24 bit resolution) recording say, at 3khz. I'd imagine the recordings would only go on for a quarter of a second on average, so an SD card would probably be sufficient as far as the size of the storage, but I guess i'm still curious about speed. Also, I'd need about 12 channels (which could conceivably be achieved by using multiple atmels or setups).

I suppose my questions are as follows: can you connect a higher resolution, higher frequency ADC to the arduino? can you write to an SD card at say 24 bit resolution 3000 times a second for a quarter of a second? could one arduino handle more than one channel? could one arduino take in more than one channel and also write more than one channel?

If anyone is curious, I'd be happy to keep up with whatever help I get and post responses... but really I need some guidance (either posts or links to helpful sites).

I haven't played with either ADCs or external storage, so I'm going to be of limited help, probably pointing out stuff you already know. If I do, my apologies.

can you connect a higher resolution, higher frequency ADC to the arduino?

Definitely yes for the resolution. There's a 12 bit ADC example with an MCP3208 (using SPI to communicate) in the playground: and there are a plethora of SPI or I2C ADCs you could use, with some small mods to existing examples with those two protocols. I'm not sure about bandwidth, tho. If I remember correctly, SPI has a higher bandwidth than I2C, at least theoretically, but I've never done anything that strains the limits of either, so I don't know how fast you could sample an external ADC like that. At 3,000 samples a sec, that's a third of a millisecond to sample the ADC and put the data somewhere.

can you write to an SD card at say 24 bit resolution 3000 times a second for a quarter of a second?

Looks like 24 bits = 3 bytes at 3,000 per second = 9kB/s and for a total file size of 2,250 bytes. An SD card can certainly handle that, but not having done it either, I don't know how fast the arduino could write to it. As for buffering on the arduino, there's not enough space in RAM, so you'd need to do it on the flash (where your program is stored) which will wear out after 10,000 cycles or so, so if those measurements happen often, not a good solution. If the card interface turns out to be too slow, perhaps it would still be possible to buffer to an external EEPROM or RAM on I2C or SPI, like here:

could one arduino handle more than one channel?

Aside from the bandwidth issue, the limit on channels is more on the ADC (the MCP3208 mentioned above has 8 channels) or on whether you have multiple ADCs on your bus. With SPI, that means a chip select line per ADC, plus MISO, MOSI, and the clock lines. With I2C, you give each ADC a unique address and you only need the SDA and SCL lines for any number of ADCs. In other words, assuming it can handle the amount of data, an Arduino should be able to handle quite a few channels with the right ADCs.

could one arduino take in more than one channel and also write more than one channel?

Again, a pure bandwidth question, I think.

There, I realize this doesn't help much, but perhaps it points you in the right direction. It looks like you need to find an ADC or combination of ADCs that have the resolution and bandwidth you want, then find out if the arduino can suck that much data out of them, and last how fast it can write out to some form of external storage, knowing you won't be able to buffer much onboard.

Thanks a lot, Mathieu. That really helps me to get going in the right direction and continue my search for a good ADC to use (and not to really give up hope that this is something that I’m capable of doing/learn to do).

So I suppose the hunt is on for the available bandwith on the Arduino…

A small correction to the above.

As far as i have understood it, you can NOT use the flash (program) memory to buffer incoming data. Using flash memory to store data is limited to static data that does not change, like string literals.

Another thing is the writing of data to an SD card. One thing is the actual transfer of data but another issue is actually adressing the SD card 3000 times a second to write a very small chunk of data. I think that might be problematic. But i don't have actual experiences to back my assumption up :-) So buffering is probably needed, and the Arduino RAm is not even sufficient for storing of data from a 1/4 of a second at 24 bit 3Khz datastream.

Yep, there is presumably some ideal amount of buffering to be done on Arduino between ADC reads and writes to external storage. Details will depend on the storage interface, but if the buffer is just a few bytes long (didn’t the value 30 bytes per write get used in one of the playground examples?) then the buffer can be a simple array so implementation shouldn’t be too hard.

At 30 bytes per write, that’s 10 measurements per write or 300 writes per second…

On another note, you need to be doing the ADC sample reads at the same time, and those will wait for no man, so I figure those writes either need to fit into spare time between samples, or be tolerant of being interrupted for each sample.


Another thing thing to consider is that while any beginner can string together a 10 or 12 bit A/D when you go up to 16 or 24 bits things get a lot more critical. It is unlikely you could get this resolution without a properly designed PCB.