ADCs are naturally non-linear. Roughly the transfer function starts at 0, then increases faster than the expected linear transfer function until it reaches #bits/2 and then curves back to where it should be. I can draw a diagram if this explanation is not clear.
The main problem is that you are assuming the converter has the linear transfer function with Voltage = 5V/250*(value from ADC). It does not and the error isn't even linear, as you've already observed. Given the shape of the real transfer function, the data provided by Andy, and the way you are computing the errors at higher voltages the pattern you are seeing is as expected.
I don't think you stated, but let me make a conjecture based on this analysis: Your ADC consistently overestimates the voltages. This is because the slope (5V/250) is near the maximal of the slope of the real transfer function.
Edited to add: Maybe it was clear from your post they are being overestimated since Err % is always > 1. It is clear if Err%=(ATMega reading)/(real value)
2nd edit: Actually, what you can do easily and see how the results change: Put 20V across the voltage divider. You will get a number say $N$ then define psu_adc_corr=N and myAdc = 20/psu_adc_corr=20/N. I would be interested to see what you get.
I will first talk about decoupling capacitors, and then specifically the options the Atmel 328P has for it's AVCC and AREF pins.
Decoupling capacitors are used to provide short bursts of energy during digital switching circuits (they go from zero to full voltage in a very short amount of time, they need energy and available current source nearby to do this) and as a general value everybody just puts 100nF (0.1uF) capacitors at the power pins of every single IC used in their boards. This is a safe and good strategy. It is not, however, strictly needed unless your system is large and complex. If you have a regulator (with it's own capacitors) very close to your Atmega you will be fine with out them.
Your regulator is fine with a 10uF capacitor on the input and output, you do not need to change those. In the future though, you should ALWAYS consult your regulator's datasheet. Some regulators cannot use high "ESR" capacitors as they can cause unstable operation, and likewise some regulators cannot handle ultra-low ESR capacitors like Ceramic capacitors because they will "ring" and ripple uncontrollably (overshoot constantly) among other hilarious power control system challenges.
AVCC is the analog voltage supply used internally by the ADC and is most commonly internally connected to the AREF pin, used directly as the reference for ADC readings. You can either filter and decouple AREF, or VCC, but the one that matters most depends on what you actually want for your ADC. The Atmel328P has internal Vref (2.56V or other ones) you can select, for exampl. You can also provide your own reference voltage at the AREF pin, and other than power supply ripple your AVCC becomes less important in terms of filtering. You might have bought a precision 3V reference IC, and followed it's datasheet guidelines for suggested circuit, and then put the Vout into the AREF pin of the AVR. In this case, AVCC can be left with either:
- direct connection to VCC
- or a simple decouple 0.1uF cap to help with local noise filtering
- with an inductor or ferrite bead in series from VCC into the AVCC for AC current ripples, and if you put a capacitor to ground here as well (AFTER the inductor), it becomes a current AND voltage ripple filter - nice and clean!
AREF could be left unconnected, and merely filter VCC. Often if the AREF pin is un-used and AVCC And AREF are internally connected, you can put a 0.1uF capacitor on the AREF pin, which will have the same effect as putting the capacitor on AVCC due to the internal connection. Maybe this can assist with circuit layout?
If you have a slow, steady state error on your temperature sensor, I bet you it's not related at all to ADC or power supply filtering - I bet that the error is within tolerances given by the datasheet (usually +-15% which is quite a lot!). You almost always need to (usually only once) 'calibrate' your ADC readings by getting a known (working) thermometer at ambient temperature nearby, and adjust the offset of readings to make it line up with expectations. The sensor's rate of change (mV/Degrees celcius) should still be fine, it's just the 'steady state error' inherent to low tolerance manufacturing.
Best Answer
The 47pF actually forms a low pass filter, as it's wrapped round the op-amp. 10k//47pF = 0.5us = 300kHz (in round numbers). The gain rolls down from 11x above 300kHz. You could increase the value of the cap somewhat to reduce the bandwidth.
The 10uF caps are both high pass filters. The input cap into the parallel 100k resistors goes down 1 below 1Hz. It's mainly shifting the ground-based input up to 2.5v for the amplifier. The second cap decoupling the 1k resistor goes down to 16Hz. This is not so much a 'signal processing' filter, as much as a way to give the amplifier unity gain at DC, so that the output sits at 2.5v on average. You may want to reduce the values of these caps to increase the highpass filter corner, to pass guitar frequencies, while attenuating lower mains frequencies.
It's always a good idea if you are making a 'signal conditioning' amplifier/filter to restrict the range of wanted frequencies as much as you can, to avoid things like mains interference or radio interference to get into the input.
A gain of 10 sounds a reasonable place to start. It's easy enough to change if you find your input too low or too high.
[edit] markrages comment about the 5532, indeed a bizarre choice for this position. It is a very old skool, high rail, poor output swing close to rail, amp. You would be much better off with 1/4 of an LM324, and you could have 4 input channels, or better still a CMOS rail to rail type, there are plenty of those speced for 5v rail. [/edit]