Martin's corner on the web

Thoughts on AVR ADC accuracy

I was thinking about the accuracy of the battery measurements the other day, are these accurate or not? I measured the battery using Fluke 27 multimeter and compared that to the readout using the internal bangap method and found a small difference. Googling on the subject revealed that the supposedly 1.1V internal bandgap reference can actually vary. The Atmega328 datasheet states it can be anywhere between 1.0 and 1.2V, which is a pretty big margin:


That variation means slightly inaccurate ADC measurements too because you rely that the internal bandgap is exactly 1.1V when doing Vcc measurement to back calculate the ADC reading to voltage.

Another thing that Google revealed is that Glyn and Trystan from have had exacty the same concerns recently, they even put together a calibration sketch. The sketch requires that you manually measure the Vcc using a multimer and compares that against Vcc measured assuming 1.1V bandgap voltage. This way it is able to calculate the exact bandgap voltage for that particular chip. You can then use that calibrated value to correctly measure the Vcc. The chip that I calibrated had a Vbg of 1.056V.

Interesting stuff, maybe an overkill for most home DIY projects, but good to know.



One thought on “Thoughts on AVR ADC accuracy

  1. Isaac Wingfield

    Sorry to be late to the thread, but I just saw a link to this page on another site.

    If you’re concerned about the accuracy of the chip’s Vbg, instead of going through all the stuff described above (and the link to the sketch is broken anyhow), why not just measure it directly? It’s available on pin AREF of the ATmega 328 when the internal reference is selected.