I just wrote a library to get up to 21-bits of precision (user-specified from 10 to 21 bits) when reading in analog voltages with the Arduino’s built-in ADC (Analog to Digital Converter). This is VERY useful when you need extra precision reading in analog sensors, so I thought I’d post a link to my library here.
Realistically, based on some limitations of oversampling, & the fact that a single 21-bit reading takes ~500 seconds (8.33 minutes–refer to the table at my link below), I’d stick to 16-bit resolution or less (where a single 16-bit reading takes only ~0.5 sec). However, I specify “up to 21-bit precision” simply because my library accepts a precision value of up to 21-bit without breaking. I’m not saying that the ADC will really give a reliable 21-bit result, I’m saying it won’t break the code. Having said that, I do think that 16-bit precision results returned from my library are valid, and I have watched and compared them to other commanded precisions while seeing them read a potentiometer. That is what I am doing in the example codes you can run that come with the library when you download it. I recommend you run those examples to see for yourself.
Additionally, my library permits data smoothing by sampling many times (a user-specified amount), then returning the average of all those samples, at a user-specified sampling precision.
Happy coding! I hope you find this useful.
I love Arduino!
If you click on my link above, you will see my explanation for how I am doing this. You will also see my reference, namely, that: the basis for what I am doing is Atmel Application Note “AVR121 Enhancing ADC resolution by oversampling” (found here: http://www.atmel.com/Images/doc8003.pdf). Please don’t respond or make any comments until you have informed yourself about this concept by reading this paper, AND visited my first link above, having read that article on my website, AND downloaded & tested the library.