Good, I think I can contribute a bit there:
So you get 8 readings with your ADC, and then simply average them. I had these ADC reading problems with Arduinos and ATTinys as well, and I found an alternative to averaging to get better readings. I don't know if it requires less or more bytes though. Never tested it.
So the solution: get the median.
The median is the value that separates the higher half , from the lower half. To get that: Do your readings, and put them in an array. Then order them (ascending or descending, whatever you like), and take the value in the "middle" of the array. That way, a bad reading doesn't affect the value you get.
Small tip: use an array with an uneven length. If it would be an even number, you would have 2 middle values and need to take an average of those two.
I don't know how familiar you are with programming, so I'll just write it. Please let me know if you don't need code bits, it takes so long with the advanced post editor.
in C++:
//sorting array in ascending order
int i, j, temp, median;
int length = 9; //uneven is better
int array[length];
for(i=0, i<length, ++i){ //get value in array
for(j=i+1, j<length, ++j){ //get value next to it in array
if(array[j] < array[i]){ //if value next to it is higher, swap them
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
median = array[(length-1)/2] //for an even length it would be (array[(length-1)/2]+array[(length)/2])/2
There's even a way without using a temporary int, here's just the principle:
int x = 5;
int y = 7;
x = x + y; //x now 12
y = x - y; //y now 5
x = x - y; //x now 7, swap done