Page 1 of 1

Arduino Data Acquisition

PostPosted: Fri Dec 12, 2014 2:26 am
by Ali_Challenger
Good evening,

Anyone know what is the maximum Analog data rate per second(Samples per second)?!, If I wanna read Analog data from Arduino via MATLAB software.

Thanks.

Re: Arduino Data Acquisition

PostPosted: Fri Dec 12, 2014 2:51 am
by yonghui
Mentioned by arduino site 10ksps. But since ur are going to transfer from.arduino to matlab it will need some time to transfer and also depending on ur communication speed

Re: Arduino Data Acquisition

PostPosted: Fri Dec 12, 2014 10:53 am
by Ali_Challenger
yonghui WROTE:Mentioned by arduino site 10ksps. But since ur are going to transfer from.arduino to matlab it will need some time to transfer and also depending on ur communication speed



Thank you for your reply,
Am using serial communication "COM" via "USB", and I get maximum reading in MATLAB only "150sps". Is it normal ???
How can I get more samples ?!
Thanks

Re: Arduino Data Acquisition

PostPosted: Fri Dec 12, 2014 10:55 am
by yonghui
How much is your com baudrate?

Re: Arduino Data Acquisition

PostPosted: Fri Dec 12, 2014 11:02 am
by yonghui
If your are going to do display of analog signal on MATLAB maybe u can do it this way. Read the signal on analog pin continuously for the number of samples that u want to display for example 50 samples store into variable array. Then one go send to MATLAB and display that 50samples. The rate will be how fast in arduino reading the analog. Or else if u sample once and send it,will delay by communication.

Re: Arduino Data Acquisition

PostPosted: Fri Dec 12, 2014 11:03 am
by Ali_Challenger
I set the BaudRate to "115200"

Thanks.

Re: Arduino Data Acquisition

PostPosted: Fri Dec 12, 2014 11:09 am
by Ali_Challenger
Thank pretty much for your idea,

But, the problem is I am doing realtime analog signal processing by MATLAB, So I need to communicate in realtime with ARDUINO, and the samples I got are not enough for that.

Re: Arduino Data Acquisition

PostPosted: Fri Dec 12, 2014 11:30 pm
by yonghui
if you really need real time transfer of data between arduino and matlab at very very high rate then mayb arduino is not so suitable because of the speed.
for your COM speed of 115200bps which this will mean that the COM speed is 11520 byte per seconds. but u will need to consider the time taken by arduino to write to transmit buffer of serial COM. so the actual rate of transfer will need to take consider of copying data for the converted samples sending out to computer, computer buffers and matlab retrieve it. if your taking the 10bits resolution for the analog signals, means u will need 2 bytes transfer per sample. this will again slower down your data rate.

i still recommendes that you buffer up enough data in arduino, then transfer the whole data packets to computer for processing. and this can make the data rate stable, and not so much fluctuating because of COM communication.
i guess most oscilloscope is doing this way too.

for example: if you are doing FFT of a signal and the signal is 100HZ. so if my requirements is the signal need to be sample at 10 times of the signal frequency, i will sample it at 1Ksps, with the help of timer interrupt set to 1Khz, i will jump to interrupt and read adc every interrupt and save to buffer. if my requirement is 100 samples. i will stop timer interrupt and sampling after 100 samples complete, and by this time i will send whole 100 samples to matlab for processing. then after that i will repeat the process again and again by turning on timer interrupt and sending to matlab after 100samples. with this my sampling rate is fixed with timer interrupt and wont be affected by lagging of COM communication at computer side.

Re: Arduino Data Acquisition

PostPosted: Sat Dec 13, 2014 11:43 am
by Ali_Challenger
Thank you pretty much Eng. yonghui, for your useful Idea.

So, I realized from your reply that there is no other options to speed up the data rate except buffering the data before send it to MATLAB.