Skip to content

ADC Sample Speed #1070

Dec 27, 2022 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

Using a simple test

void setup() {
  Serial.begin();
  delay(5000);
  uint32_t start = millis();
  int sum = analogRead(A0);
  for (int i = 0; i < 1000000; i++) {
    sum += analogRead(A0);
  }
  uint32_t end = millis();
  Serial.printf("ADC reads per second: %0.0f\n", 1000000.0 / ((end - start) * 0.001));
}

void loop() {
}

With the current core I get

ADC reads per second: 184298

Not 500k, but not completely atrocious.

With the simple optimizations in #1072 I get about 20% speed improvement:

ADC reads per second: 226347

The remaining difference is down to the SDK/manual reading of the ADC inputs which we have no control over.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@NuclearPhoenixx
Comment options

@earlephilhower
Comment options

@NuclearPhoenixx
Comment options

@earlephilhower
Comment options

Answer selected by NuclearPhoenixx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants