Hey everyone,
I am try to understand about the speed at which the arduino CAPTURES and STORES each sample of analog data..
How do i change the sampling rate/frequency of how the arduino reads data(analogread rate)?
Basically how can i increase the clock rate at which the device catches data?
I see that the SPECS says that the clock speed is 16Mhz but is that the rate at which it reads data or is that like a default max or something??
If Anyone can give me abasic breakdown of anything related to this i would be extremely grateful..
The ADCs could theoretically have a new 10-bit value on every clock cycle, such as the 16MHz clock you refer. But that doesn't mean you could use them all.
It's a microcontroller, and you write the program that does whatever you want (including sampling the ADC inputs). So the rate depends on what ELSE your program does.
If you wrote,
while (1)
x = analogRead(4);
This would do NOTHING but read samples from the Analog 4 pin repeatedly. It wouldn't store them, it would just sample. There is a significant overhead on the analogRead() function, so you probably won't get anywhere near 16MHz sampling rate.
while (1) {
x = analogRead(4);
[glow]// do something with the sample[/glow]
}
It all depends on how long it takes for you to do something with the sample. Or what other tasks you decide to put in the main loop function.
Also, there's not a lot of RAM, so if you're hoping to log or data-collect, you have to figure out what you're going to do with each sample. Write it to a serial port? Write it to a serial EEPROM? Write it to an SD card? Write it to an audio processing queue?
The 16 Mhz is the clock of the Atmega processor, and is not directly related to the ADC.
The "sampling" of the analog ins take place when you call the AnalogRead() function. There is of course an upper limit to how fast you can do that, i can't remember that limit of the top of my head, but it is probably what you want to do with the value you read that will be the factor that determins how fast you can go.
Guys thanks for the response..
I'm trying to see if i can read or store a audio signal of say 1 second.. I am in the process of looking into increasing the capacity to store the data: either, SD or the i2c EEPROM upgrade..
I wanted to use the amplitude of say 400 samples for further analysis.. From your professional opinion do you think this could possibly work???
But this sucks b/c i'm not too nifty with the arduino and i program average... Not to mention time is running out on my project>>
Trying to do the hardware part on speech recognition. So I'm at least trying to store the sound data from the mic ... it seemed like it would have worked but now i'm wondering.
One of the first things you should consider is the extreamly limited memory of tha Arduino boards. The newest boards has 2KB of RAM. Some of this is used by internal datastructures in Arduino the rest is for all your programs variables and data.