Unstable AREF?

retrolefty:
Shame on you, even after you went through the whole mega1284P update process, of posting a sketch that is device specific. What about running it on a mega, micro, etc?

I know, I'm soooo embarrassed :blush:

Here is one I'm always playing with. Wrote it on top of blink just for grins:

Works very nice, on a 328P or on a 1284P. The internal reference voltage does indeed have about a 9% tolerance according to the datasheet. But like a lot of things with these MCUs, I find that they're usually a lot closer than the advertised worst-case scenario. I did a little experiment to compare (see results below), without tweaking the constant in the calculation. If I assume the Fluke meter is correct, then I have a 328P with a very close internal reference voltage, and a 1284P that is not as close, but not too bad either. 2% or 3% error is probably good enough for a lot of battery monitoring applications. Still probably worth checking and maybe calibrating because there are no guarantees.

Untitled.png