EKMallon / UNO-Breadboard-Datalogger

Code for the basic UNO & Breadboard data logger described on the project blog
https://edwardmallon.wordpress.com/2015/12/22/arduino-uno-based-data-logger-with-no-soldering/
18 stars 9 forks source link

software-only ADC noise generator #1

Open nerdralph opened 6 years ago

nerdralph commented 6 years ago

I found your blog post about ADC resolution while attempting to reduce the ADC noise I'm seeing on one my projects. https://thecavepearlproject.org/2017/02/27/enhancing-arduinos-adc-resolution-by-dithering-oversampling/

One thing that helped reduce the noise was adding some settling time after changing the ADC Mux. Where you want to add noise, you can probably do that without any external components by switching the Mux input just before taking your intended reading.

EKMallon commented 6 years ago

I will give it a try, but the question there is will that generate truly random noise, or are you simply seeing the difference between the charge level on the sample and hold capacitor in front of the ADC between your two input lines. I suppose if you were switching over and then back from a completely floating pin it would give you something more or less random around 1/2 Vcc... but if the sample you are trying to read was significantly higher or lower than that, than theres a good chance you would only have noise in one direction...and that direction would change as your actual signal crossed the 1/2Vcc point... I will give it a try and see how it looks compared to the pin pulsing when I have some time...

nerdralph commented 6 years ago

The change in charge on the input capacitor is certainly part of it. I just finished some more tests to confirm it. I was sampling ADC0 on a t13, with a 100K pulldown on RST(ADC0), and a div16 prescaler. When not switching sources, with a 2us delay after resetting ADMUX, I was getting steady noise-free readings of 626. When I switched between ADC0 and ADC1(floating), I got readings of 609-610, indicating the S/H capacitor wasn't getting fully charged. With a 10us delay after resetting ADMUX, I got fairly random fluctuations between 625 & 626.