At what Rate or Frequency can the Arduino Mega read Value from Analog Sensors?

Hey,
I wanted to know, at what rate is it possible to read analog sensor values and the display it on the serial command window of the Arduino IDE.
My project requires me to get value from analog sensors at around 500 - 1000 Hz (ie: 500 - 1000 times in a second).
I might be using either an Potentiometer or an Infrared sensor or maybe an LDR etc.

Can anyone plz tell me if it is possible to do this with arduino board & and if it is, can you please guide to any page which describes the coding required for doing such high speed calculations or any other information with reference to this matter.

Thanks in advance :smiley:

mehtaatur: Hey, I wanted to know, at what rate is it possible to read analog sensor values and the display it on the serial command window of the Arduino IDE. My project requires me to get value from analog sensors at around 500 - 1000 Hz (ie: 500 - 1000 times in a second). I might be using either an Potentiometer or an Infrared sensor or maybe an LDR etc.

Can anyone plz tell me if it is possible to do this with arduino board & and if it is, can you please guide to any page which describes the coding required for doing such high speed calculations or any other information with reference to this matter.

For something that slow you can just use analogRead().

The limiting factor for speed will most likely be the serial communications to the PC. So pay attention to the baud rate you use and the formated length of your serial messages to the PC and you should have no problem meeting your speed requirements.

Lefty

Thanks Guys,

-So what would be the maximum rate at which I can read the values (ie: 1k Hz, 2k Hz and so....) -Also, at high rates of 1k Hz and more, will it be possible to get values from 2 or more sensors simultaneously. -Lastly, can i get this data saved in a text file on the PC? If yes then how?

Thankx a lot for your quick replies :)

There's little point reading an LDR at 1kHz.

The maximum normal ADC rate is around 9500 conversions a second. Remember, there is only one ADC.

mehtaatur: Thanks Guys,

-So what would be the maximum rate at which I can read the values (ie: 1k Hz, 2k Hz and so....)

From the arduino reference on analogRead:

It takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second.

-Also, at high rates of 1k Hz and more, will it be possible to get values from 2 or more sensors simultaneously.

Yes

-Lastly, can i get this data saved in a text file on the PC? If yes then how?

Yes, if you use one the the many free PC serial terminal programs available for PCs, most have the ability to save the incoming test to a file. Lefty

Thankx a lot for your quick replies :)

AWOL:
The maximum normal ADC rate is around 9500 conversions a second.
Remember, there is only one ADC.

So if I have 3 different sensors, can I get them to read values at 1k each simultaneously? (this would total up to 3000 conversions/sec)
and does this have anything to do with the baud rate??

mehtaatur: Thanks Guys,

-So what would be the maximum rate at which I can read the values (ie: 1k Hz, 2k Hz and so....) -Also, at high rates of 1k Hz and more, will it be possible to get values from 2 or more sensors simultaneously. -Lastly, can i get this data saved in a text file on the PC? If yes then how?

Thankx a lot for your quick replies :)

Normal rate is just under 10kHz bet the chip is capable of 1mHz sample rate. You can have as many sensors as analog pins but there's only one ADC so it's shared among them. ie. Two sensors at normal rate will give you about 5kHz on each.

Lots of PC programs can capture serial data. Google for one.

Thankx guys, that was helpful. :D

mehtaatur:

AWOL: The maximum normal ADC rate is around 9500 conversions a second. Remember, there is only one ADC.

So if I have 3 different sensors, can I get them to read values at 1k each simultaneously? (this would total up to 3000 conversions/sec)

Yes.

mehtaatur: and does this have anything to do with the baud rate??

No. That's the serial port transmission speed.

Normal rate is just under 10kHz bet the chip is capable of 1mHz sample rate

Well, one sample every 1000 seconds is easy, but pretty useless.

You cannot sample simultaneously; there is only one ADC. The baud rate defines how fast you can shift readings off the controller.

So if I have 3 different sensors, can I get them to read values at 1k each simultaneously? (this would total up to 3000 conversions/sec)

Yes.

sp. "NO"

mehtaatur:

AWOL: The maximum normal ADC rate is around 9500 conversions a second. Remember, there is only one ADC.

So if I have 3 different sensors, can I get them to read values at 1k each simultaneously? (this would total up to 3000 conversions/sec) and does this have anything to do with the baud rate??

Well your sketch has to do things beside just reading the analog input pins as it has to format the returned values in to message lines and then send them to the PC. As the arduino has little SRAM space you will not be able to store up analogRead values (buffering them) so you can only read new data as fast as you can send out the data to the PC before reading new values once again. So baud rate has an effect on the whole sketch 'cycle time' of reading new analog values and sending them off.

Lefty

AWOL:

So if I have 3 different sensors, can I get them to read values at 1k each simultaneously? (this would total up to 3000 conversions/sec)

Yes.

sp. "NO"

Ok, the sampled values won't be strictly 'simultaneous' across the three channels but you can connect and use three sensors at the same time.