Storing Acquired Data

Hello all,

As an introduction, I am very new to the Arduino and coding in general - so please don't be too harsh on me. :smiley:

I'm a research student at Indiana State University where we are essentially hoping to use the Arduino Uno to acquire data of nonvolatile organic compounds and store this data onboard the microprocessor so that we may then analyze/make sense of the data elsewhere. I've been working on this project since February (once or twice a week) and I have the basic knowledge of the Arduino via the SparkFun Interactive Kit (SIK) Guidebook.

I'm currently using a waveform generator to send a frequency to the Arduino at 1 volt with this extremely simple code:

void setup()
{
Serial.begin(115200);
}
void loop()
{
Serial.println(analogRead(A0));
}

*I would greatly appreciate any help in bettering this code

My instructor is hoping to be able to store the acquired data via onboard memory (Internal EEPROM) but he does not know much about the Arduino. Would the internal EEPROM be suitable for this type of project since it only stores 1 KB (ATmega328)? Also, being basically new to the coding scene, I'm uncertain as to how the EEPROM library works. What determines the value parameter in the EEPROM.write() function? I've read the reference page for the EEPROM at http://arduino.cc/en/Reference/EEPROM but I guess I'm simply not understanding due to my inexperience with coding.

Please forgive any of my idiotic questions.

Thanks,
Kris

The first thing to check is whether there's enough memory for what you want to do. Which Arduino are you using (so we know how much EEPROM you have), and how much data are you hoping to store?

Writing to EEPROM is straightforward: each memory location in the EEPROM can hold one byte of data. You specify the address and the data and the library handles writing it for you.

You'll need to write functions to put your data into the EEPROM and take it out one byte at a time.

-br

Thanks for the response Bill.

We are using the Arduino Uno. My instructor is hoping to have the maximum sampling rate achievable by the Arduino Uno with the quickest sampling time for I believe 5-10 microseconds. From what I have noticed, the Arduino is capable of running at a baudrate of 115200? So then ~1.152 bits; but we would like to have multiple samples if the Arduino is capable.

As for the EEPROM, does the value parameter indicate the increments of data to be stored? (Sorry.)

Kris

The baud rate controls the serial port speed; it has nothing to do with the sampling rate of your code.

Think of the eeprom as an array of 1024 bytes. You can write to or read from any selected byte. Which byte you write to or read from is called the address. The 8-bit data item that is read or written is called the value.

It's time for you to do a little arithmetic to figure out how many samples you can save at that sampling rate. (It's not very many.) Is it enough for your purposes?

-br

If my arithmetic is correct, it is only 10,000 samples/sec - which is not enough for my purposes. Is there any way to boost this up?

Well it's hard to do better than about 10k samples/second because that is approximately the sampling rate of the '328 analog to digital converter. If you really need faster sampling than that, check out the Arduino Due.

Even if a slower rate is acceptable, you'll quickly hit the storage limit. Some people have gotten excellent performance logging data to SD card, which is an easy addition to the arduino. Search the forums here for "fast data logger" and you'll get a zillion hits to wade through…

Good luck with your project,

-br