Go Down

Topic: sampling rate 40kHZ with Arduino uno r3 Please!!!! (Read 6657 times) previous topic - next topic

suchawinee

I'm want sinewave signal from a function generator which is about 40 kHz  with arduino.

I'm conecting the ground of the function generator to the arduino ground and the output to the A0 pin

AWOL

And?
With a normal maximum analogue sample rate of around 9kHz, what does Mr Nyquist say about your scheme?

suchawinee

I want to know that the board can be sample 40 khz
i'm test just 50h by code
int data[100];

void setup() {
 
  Serial.begin(9600);
  int data1[100]; // 100 point on serial monitor
  for(int i=0;i<100;i++)
  {
   data = analogRead(A0);
    delay(1000);
  }

  for(int i=0;i<100;i++)
  {
    Serial.println(data); 
  }
}
void loop() {
}

****I want  sample 40 khz

Grumpy_Mike

Quote
I want to know that the board can be sample 40 khz

but you said:-
Quote
I'm want sinewave signal from a function generator which is about 40 kHz

So you need a sample rate of at least 80KHz.

What sort of Arduino? It would be possible with a Due but not a Uno.

AWOL

Quote
i'm test just 50h by code

Code: [Select]
delay(1000);
If you say so.

Please use code tags - it avoids italics

Robin2

Two or three hours spent thinking and reading documentation solves most programming problems.

suchawinee


AWOL

I think the ADC will sample up to about 78k samples / second, but at fewer bits per sample.
You need to check the processor data sheet.


Still waiting for those code tags.

suchawinee

Sorry!!
i'm test just 50h by code
int data[60];
void setup() {
  Serial.begin(9600);
  int data1[60]; // 60 point on serial monitor
  for(int i=0;i<60;i++)
  {
   data = analogRead(A0);
    delay(10);
  }

  for(int i=0;i<60;i++)
  {
    Serial.println(data); 
  }
}
void loop() {
}

Grumpy_Mike


robtillaart

Using delay will slow down your code
delay(10) means stop for 10 milliseconds =>  that implies you can make max 100 samples per second.
So remove the delay of your code,

Code: [Select]
data = analogRead(A0);
this will not do what you want, please read the tutorial how to use arrays for the correct syntax.
- http://arduino.cc/en/Reference/Array -

Code: [Select]
Serial.println(data);
this will not do what you want, please read the tutorial how to use arrays for the correct syntax.
- http://arduino.cc/en/Reference/Array -

Code: [Select]
int data1[60]; // 60 point on serial monitor
this is not used, remove it from the code as it obfuscates problems

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

suchawinee

Hi someone to help, or enough to introduce me 40khz sampling signal by using the Arduino George do it. Made and inquiries made ??various moves that the board do not have the answer to it. But the advisers said, to read from the datasheet it done

AWOL

Quote
by using the Arduino George do it.

The what?

MarkT

The on chip ADC can be made to run a lot faster, but with less accuracy - the ADC clock
prescaler bits are in one of the control registers and are documented in the chip's datasheet.

The default setting is for a prescale of 1/128, giving an ADC clock of 125kHz on a 16MHz
board, conversions take about 13 ADC clocks.

The faster you run the ADC clock the lower the source impedance of you signal should be,
so 10k is recommended for 125kHz clock, but 1k for a 1MHz clock (which allows for a
>50kHz sampling frequecy which you'll need to capture 20kHz signals).

You might want to consider an external ADC chip, such as an MCP3204 or MCP3208
which both sample a lot faster and with 12 bit accuracy.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

suchawinee

Sorry I'm not good at English. , I help google
MCP3204 or MCP3208?
What is it, with this example

Go Up