Reading all analog pins at once, dumping to RAM. + AREF question

My father insists that, on the hardware level, this should be possible. To clarify: One Command dumps all the Analog Pins' input values to diff. memory locations. As far as I can find, there is no command for such a thing in the IDE. Ideally, I would like to be able to dump all 16 pins from the mega, in as few cycles as possible. The 13-25 cycles per read analogRead gives are way too slow, resulting in 400 cycles per check of all of them. That only gives roughly 38 reads per second on each pin (given 16 mhz) and I need it much higher.

Also, does the AREF voltage have precision limits? I will be dealing with measurements somewhere in the .01v to .001v range, and I would like to be able to use that for the AREF, with the external option, but I'm worried it won't be precise enough to give me the waveform precision I desire.

Or, perhaps there's a way to overclock the mega to, say, 100 mhz?

Willrandship: My father insists that, on the hardware level, this should be possible. To clarify: One Command dumps all the Analog Pins' input values to diff. memory locations. As far as I can find, there is no command for such a thing in the IDE. Ideally, I would like to be able to dump all 16 pins from the mega, in as few cycles as possible. The 13-25 cycles per read analogRead gives are way too slow, resulting in 400 cycles per check of all of them. That only gives roughly 38 reads per second on each pin (given 16 mhz) and I need it much higher.

It has one A-D multiplexed in time. Cheap and fast are two conflicting requirements. There's nothing to stop you adding multiple external AD chips or external amplifiers to boost low level signals.

One Command dumps all the Analog Pins’ input values to diff. memory locations.

you just need to include the function below in your code and call oneCommand(); wherever you like…

uint8_t ports[16] = {A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15};
int value[16];

void OneCommand()
{
  for (int i=0; i<16; i++) value[i] = analogRead(port[i]);
}

Watch out for the macro edition, to be released soon :wink:

Requirements are ambiguous most of the time

Also, does the AREF voltage have precision limits? I will be dealing with measurements somewhere in the .01v to .001v range, and I would like to be able to use that for the AREF, with the external option, but I'm worried it won't be precise enough to give me the waveform precision I desire.

Yes it has definitely limits, for such low voltages you need an opamp to boost the voltage .

If you use AREF == INTERNAL =1.1Volt => you get 1023 steps from 0..1.1Volt so approx 0.001V per step in theory, in practice there is noise, interference and gremlins that will make the last 1 or 2 (or more) bits not precise. Can partially be solved by multiple readings that are averaged.

What is the waveform you want to monitor? where does it come from?

perhaps there's a way to overclock the mega to, say, 100 mhz?

That would amount to severe underclocking ;)

Maybe some DSP like chip would fix your problems?

Well, here's what I'm trying to do. I'm trying to make an EEG reader, without using the $500 hardware you can get based on the openEEG project. Since you are fundamentally just recording voltages, I figured something with an Analog Input with a fast enough recording speed would work.

I suppose I could live with less than 16 channels...:P But it would be nicer with all of them.

The noise shouldn't be too much of an issue. I'll be using active shielding on the signal wires. The 1.1v internal setting might be enough, I'm not sure. From what I'm reading, it needs to be a signed value, though. Can Analog input do that?

Can you recommend a good chip which can, in some form, communicate with a computer while reading multiple analog channels? Preferably low-cost, but anything below $200-$300 still saves money over the OpenEEG designs.

Perhaps you can follow the lead of this project:

http://www.whatartistprojects.com/myopenarduinoeeg/

The bill of materials prices out at $84.07 and that includes the Arduinio clone!

http://www.whatartistprojects.com/myopenarduinoeeg/wp-content/blogs.dir/2/files/group-documents/1/1290212580-BOM_ArduinoEEG.pdf

That's an interesting project posted above. Difficult to navigate to any content. Maybe one needs to sign up first.

For acquiring 16 channels of data, you can just use a MCP3208 over SPI to get 8 channels of 12-bit ADC. You can use more than one. They are only $3 or $4 each. They can sample about 40,000 samples per second in total.

The problem will be the amplification for one channel, much less 16 channels.

@johnwasser

Did you try looking at any of the schematic files on that site? I didn't have any luck viewing any of them, though it is my first time trying to even look at schematics.

I see that he mentions gEDA (http://gpleda.org/) as the schematic capture program he used. Perhaps you need to download and run that to view the schematics.

Yeah, I tried that. It opens up but looks blank. I've never used it so I didn't know if I was using it right. Thanks for the tip tho.

bubulindo:
Maybe some DSP like chip would fix your problems?

Well at least a good ADC. They are usually multiplexed too, note, but might have a much faster sample rate. Knowing what problem you are trying to solve would help identify good candidate ADCs (there are literally thousands available)