Black Lives Matter - Action and Equality. ... Adafruit joins the Stop Hate for Profit campaign.
0

Changing ADC to over-sampling mode for higher resolution?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Changing ADC to over-sampling mode for higher resolution?

by kevinjwalters on Mon Apr 20, 2020 11:47 am

Is there a way to change the ADC mode in CircuitPython? I see the nRF52840 has a 14bit mode with over-sampling in hardware.

kevinjwalters
 
Posts: 631
Joined: Sun Oct 01, 2017 3:15 pm

Re: Changing ADC to over-sampling mode for higher resolution

by kevinjwalters on Mon Apr 20, 2020 1:45 pm

For background, I've been looking at how fast I can sample the ADC in CircuitPython and how well the arithmetic mean across some (unfiltered) samples deals with noise. Here's a USB-powered Adafruit CLUE measuring an old alkaline battery on P1. The second graph is a set of samples where the value has been dragged down and judging by the weighted line which is created with reduced effect of outliers it's the low outliers causing the mean not to represent the actual/desired value.

batterys5-samples-fitted-lines.png
Adafruit CLUE measuring an old alkaline battery - first set of samples
batterys5-samples-fitted-lines.png (40.13 KiB) Viewed 76 times


batterys6-samples-fitted-lines.png
Adafruit CLUE measuring an old alkaline battery - second set of samples
batterys6-samples-fitted-lines.png (39.35 KiB) Viewed 76 times


The colour/size coding for outliers is not consistent between graphs, btw.

kevinjwalters
 
Posts: 631
Joined: Sun Oct 01, 2017 3:15 pm

Re: Changing ADC to over-sampling mode for higher resolution

by tannewt on Mon Apr 20, 2020 2:11 pm

kevinjwalters wrote:Is there a way to change the ADC mode in CircuitPython? I see the nRF52840 has a 14bit mode with over-sampling in hardware.


Not from Python code. If you find a better default setting for a single read then we could just integrate it into the source.

tannewt
 
Posts: 1680
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.