PaulStoffregen
Well-known member
Indeed there is a general signal processing theory about oversampling by simple averaging. If the signal has random uncorrelated white noise (and no other sources of error), you gain approximately 1 bit of additional resolution for every factor of 4 samples you average together.
Here's a very simple program you can run to put that theory to the test.
I'm running it right now on a Teensy 3.2 with this hardware. It does give surprisingly good results, at least with this very simple setup where nothing else is connected. But you don't get a "nice" zero or full scale max.
Here's a very simple program you can run to put that theory to the test.
Code:
const unsigned int bits = 4; // number of bits resolution to theoretically add
void setup() {
analogReadResolution(12);
}
void loop() {
unsigned int sum = 0;
const unsigned int count = powf(bits, 4);
for (int n=0; n < count; n++) {
sum += analogRead(A0);
}
sum /= (unsigned int)powf(bits, 2);
Serial.println(sum);
}
I'm running it right now on a Teensy 3.2 with this hardware. It does give surprisingly good results, at least with this very simple setup where nothing else is connected. But you don't get a "nice" zero or full scale max.