Go Down

Topic: Multi Channel High Sampling Rate ADC (Read 277 times) previous topic - next topic

merdogan

Hi everyone
I am using Arduino Mega2560 to acquire audio signals from 2 channels (A0 and A1). The default sampling rate seems to be around 4 kHz. When I try to read two channels( with the analogRead function) the sampling rate reduces to half per channel. I want to use both channels with at least 16ksPs. How can I achieve this?
Can you provide me with sample codes?
Here is my code :
Code: [Select]

void loop() {

int j=0;
    for(int i=0;i<900;i+=4)
    {
      sense_val=analogRead(sensor_pin);
      sense_val2=analogRead(sensor_pin2);

      d_t_s[i]=sense_val>>8;
   
      d_t_s[i+1]=sense_val&0b0011111111;

      d_t_s[i+2]=sense_val2>>8;

      d_t_s[i+3]=sense_val2&0b0011111111;}

      client.write((const uint8_t *)d_t_s,900);
 
}

wvmarle

Max rate is just under 10 ksps - for all channels together.

Solution: get an external ADC that can reach your required sampling rate.

By the way, how do you plan to deal with all that data?
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

merdogan

Actually I was able to increase sampling rate by setting  the relevant bitd of the register ADCSRA with appropriate values.
But, thank you!

wvmarle

#3
May 16, 2018, 08:07 am Last Edit: May 16, 2018, 08:07 am by wvmarle
True, you can increase the rates quite a bit but you will be losing precision (you go down to 9 or 8 significant bits).
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

MarkT

What are you trying to actually do?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

horace

#5
May 16, 2018, 05:53 pm Last Edit: May 16, 2018, 05:55 pm by horace
consider using an arduino-due
for example, have a look at this topic Re: how to get the 1Msps in Due

merdogan

I am trying to sample 2 separate signals with maximum frequency of 4kHz and then send them to computer via ethernet. I want to do this as fast as possible. Also, is there any way that I can get conversion results from two channels using interrupt?

ard_newbie

is there any way that I can get conversion results from two channels using interrupt?
Yes

Go Up