Sampling Rate of Arduino Uno Card

Hello friends,
I am working on a project in which i am sending my analog data onto the serial port.
The data is received on a Software named Labview on which i am presenting it as waveform.
I have a little problem while doing so.
I need to know the sampling rate at which the adc converts the analog data and sending it to the serial port.
Kindly guide me what would be the sampling rate of the ADC.
Thanks

ADC conversion on the Arduino (analogRead)

However the limiting factor may well be the rate at which you transmit the data to Labview.

Thanks Nick Gammon
It is my imagination that i since i am sending my data at 9600 baud rate, which i pretty lower than the clock cycle, therefore my sampling should at the rate of serial communication.
What do you suggest?
Regards

I suggest using 115200 baud.

ok,
and just to confirm.
from the document you sent in your first reply mentions that it takes 13 cycles for the adc to convert the data into digital form.
since the crystal frequency of the Arduino uno board is 16MHz.
1 cycle takes 6.25 x 10-8 sec therefore
13 clock cycles will take 8.125 x 10-7 time to convert the analog data into digital form.
Therefore the frequency of it will be 1.23MHz.
And this will be the sampling frequency.

But after conversion it will be waiting to send the data to the serial port, who is communicating at 9600. so the actual sampling frequency at which we are receiving the data will be the communicating baudrate.
Regards

from the document you sent in your first reply mentions that it takes 13 cycles for the adc to convert the data into digital form.
since the crystal frequency of the Arduino uno board is 16MHz.
1 cycle takes 6.25 x 10-8 sec therefore
13 clock cycles will take 8.125 x 10-7 time to convert the analog data into digital form.
Therefore the frequency of it will be 1.23MHz.

No.

From my page you will see that it takes 13 ADC cycles.

You can choose various prescalers, from 2 to 128. This divides down the processor clock speed to give an ADC clock speed. The default prescaler is 128, so you are out by a factor of 128.

The default conversion time is 104 µS.

At 9600 baud you transmit a byte every 1/960 seconds (1.04 ms) so it would take 7.29 ms to send a 5-digit number, plus carriage-return and linefeed. So the serial communications is the limiting factor.

At 115200 baud you transmit a byte every 1/11520 seconds (86.8 µs) so it would take 607.6 µs to send a 5-digit number, plus carriage-return and linefeed. So the serial communications is still a factor but not quite as much.

So what i got is that,
If i am sending an 8 bit data at for e.g 9600 baud rate, than the total time could be calculated as under.
8bit + 1 stop bit is the total data.
The time req to transmit one bit is 1/9600 i.e 0.1 x 10 -3 sec
So the total time to send all 9 bits will be 9 x 0.1 x 10 -3 = 0.937 x 10 -3
Therefore the Frequency at which the data one complete data is received will be 1/ 0.937 x 10 -3 = 1.06 KHz.

Pls confirm this calculation is now correct.
Regards

Can you live with collecting a set of samples and then transmitting that to your Labview?

With the USB connect, use 115200 baud. You can sample and deliver maybe 100 sets/second.

Some Arduinos (and compatibles like Teensy's) have USB in the chip and data transfer speed is USB 1.1 speed, enormous compared to 115200 baud.

Another choice is to add an SD module and log data to that then see it later either through the Arduino or by actually removing the card and reading it on the PC.

If i am sending an 8 bit data at for e.g 9600 baud rate, than the total time could be calculated as under.
8bit + 1 stop bit is the total data.

No, there is a start bit too, which is why I divided by 10.

Therefore the Frequency at which the data one complete data is received will be 1/ 0.937 x 10 -3 = 1.06 KHz.

Is your data one byte only?

@GoForSmoke
Nice idea Pls recommend me a board and the technique, i will definitely work on this idea.

@Nick Gammon
1- So the mistake in my calculation was to take 10 bits into account, otherwise the calculations were correct.
2- I am sending data continuously. So would it effect the sending rate any way?

Thanks to all.

If you read your ADC, send it to serial as a packed 2 byte value and then use Serial.flush() to wait for result to finish sending then Labview could use the value and the time it arrives as the basis to drawing the graph.

Or you could just sample at a *suitable fixed time interval. Suitable meaning enough time to read and send the result without filling the serial buffer. Labview would then have a fixed timebase for the graph instead of the variable one you would get with the first idea.

learntodo:
1- So the mistake in my calculation was to take 10 bits into account, otherwise the calculations were correct.

Well, yes. At 10 bits per byte, clearly the frequency at 9600 baud will be 960 Hz.

2- I am sending data continuously. So would it effect the sending rate any way?

If you don't read the ADC asynchronously, it will first spend 104 µs reading and then do the sending. However if the sending is slower than the reading it will be waiting for the send to finish, so I doubt it will affect the sending speed. I would be using a faster baud rate myself.