I have recently migrated from the uno to the mega and am using adc with an external reference.
On the Uno, the guidance was to use a 5k resistor between the external source and the Aref pin and that there was a 32k resistor equivalent inside the part. so the actual ref voltage included the 5k, 32k voltage divider, or an 86.5% voltage divider. with this, it all seemed very clean and predictable.
On the mega, I haven't yet seen this series 5K resistor need documented and a quick perusal of the ATmega2560 datasheet didn't reveal it, although i cannot say it is not there.
I included the series 5k sort of blindly on the mega migration, but now am seeing different performance on two different mega boards. One one board the 5k R seemed to give similar performance as on the uno and my application had good numbers. On a second mega board, I don't see the expected voltage division when measuring with a DVM and my measurement numbers are off.
I wondered if anyone had been through this particular thing before and could offer guidance.
Doesn't using the default 5V reference connected to Aref internally provide the same results on all boards with no resistor? Is your 5V supply varying between the boards?
Perhaps selecting External and using a precision reference is needed, such as REF194, a precise 4.5V reference powered from 4.75V to 5V:
I don't know who wrote about the 5k, but I don't use it. Connect the reference to AREF, as CrossRoads wrote.
The only thing to remember is to set the analogReference() before doing a analogRead().
Do you use a capacitor at AREF to reduce noise ? (if the voltage reference allows it). Some cheap clone boards omit that capacitor.
I'm using AD780 as a 3v reference. I'll remove the 5k which was recommended on the uno both on the forum and in the datasheet.
My observation has been that the 5v varies some, mostly between usb powered and externally powered board sets. I was also concerned when I get to POE usage. I didn't want to have to deal with this variation and had the external reference anyway so used it. I was also concerned over temperature.
So you can't use the internal 2.56volt reference of the Mega.
Internal references (1.1 and 2.56) are supposed to be as good as external ones.
A simple divider could bring your 3volt source in the 2.56volt range.
Leo..
"I'm using AD780 as a 3v reference."
That would have been good to know to start.
"I'll remove the 5k which was recommended on the uno both on the forum and in the datasheet."
Not in the AD780 datasheet.
Not in the 328P datasheet.
Twilkers, the 5k is only to protect the AREF. To say: "recommended" is too much credit for the 5k resistor.
It is also in the reference : analogReference(EXTERNAL) AREF & 3.3V pin - Interfacing - Arduino Forum
The 5k resistor is to be able to use any sketch; for electronics beginners; for prototyping; and so on.
For a good voltage reference, don't use the 5k.
The internal 1.1V and 2.56V are different for every Arduino board. You have to measure it (measure AREF) or tune it in software and use the accurate value in the sketch. After that the internal voltage reference depends a little on the VCC and the temperature. Since I use my Mega with a DC-DC converter and only indoors, those two variables stay the same.