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.
-
\$\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– Andy aka2020年11月15日 10:55:16 +00:00Commented Nov 15, 2020 at 10:55
1 Answer 1
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.
-
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– Wxy2020年11月18日 02:19:57 +00:00Commented Nov 18, 2020 at 2:19