1
\$\begingroup\$

I know the Arduino ATmega-based boards’ maximum ADC sampling rate of an analog pin is 10 kHz, but what about the MKR family (SAMD21-based) boards?

I couldn’t find any info about it.

\$\endgroup\$
1
  • \$\begingroup\$ I'm sure there is info but asking for help to find the info isn't a valid EE question for this site. Focus on finding a data sheet. \$\endgroup\$
    – Andy aka
    Commented Nov 15, 2020 at 10:55

1 Answer 1

1
\$\begingroup\$

Under optimal circumstances (low source output impedance, etc.; see this answer) the ADC on the SAMD21G can do a maximum of 350 ksamples/s.

There's more to it than just the number from the datasheet, though; when using the standard Arduino libraries you will get nowhere near that number because of code overhead, but mainly because the library sets the ADC to a whopping 63 clock cycles per sample.

There are ways around this, of course; I have put some example code for faster settings for the SAMD21G's ADC here on GitHub.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Thank you so much for the example codes, orcdu!! Unfortunately I could not test the code with my Arduino MKR Zero yet as it is still in shipping process :( I also found alternative ways in Arduino forums such as hacking the SAMD wiring.c core file or reinitialize the pre-scaler and sampling rate in declaration. However, I still have to wait for the shipment arrives. \$\endgroup\$
    – Wxy
    Commented Nov 18, 2020 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.