# Voltage reference sampled by ADC (12 bit) gives value that is off by more points than other measurements

I am using the TI REF3020 voltage reference (2048mV) in combination with a microcontroller in order to have a reference for voltage measurements.

The microcontroller is powered by 5V (5.00V), the MCUs ADC Reference is set to 5.00V too. Due to the fact that I don't want to rely on the VDD rails being referentially stable, I wanted to add a precision voltage reference.

In my test setups, I can easily measure the VDD (ADC reference) voltage and calculate the voltage to ground of an ADC input pin. For testing purposes, I used an external power supply as an input for an ADC pin. After measuring the voltage at the pin with an oscilloscope and a DMM, the MCU measured, without any further calibration, the actual correct voltage down to the LSB of the ADC. (I am using a 12-bit ADC) This experiment was successfully carried out with multiple voltages between 0V and 5V.

I further used the aforementioned REF3020 voltage reference in the same setup as an input for an ADC. Both oscilloscope and DMM confirmed precisely 2.048V. Measuring the same voltage with the MCU via an ADC, the value was off by 15 points. Instead of a bit-value of 1677, the MCU measured 1663:$$U=\frac{1663}{4095}\cdot5V\approx2.0305V$$

The value measured by the MCU does not oscillate nor drift over time and the (to be honest, relatively narrow window of) temperature I tested. The (averaged) value constantly stays at 1663. Without averaging, the value ranges from a minimum of about 1660 to 1666. The influence of temperature should be negligible though, because the other experiment was conducted at the same temperature (room temperature).

For this application I am using an average of 128 samples in a time window of about 4ms. I even tried to make the sample and compare times longer. Did not help either.

The voltage reference is even a high-current one. It can safely supply up to 25mA according to the datasheet. This should by far be enough to be sampled by a single ADC channel. There are no other loads connected to the voltage reference.

I could easily calibrate the offset error, but this would in essence defeat the whole purpose of the voltage reference in this application.

What else could be the cause for this deviation that manifests only when measuring the voltage reference's output voltage?

• Please provide a schematic. Things like grounding or decoupling capacitors could matter, and with a schematic we don't have to play the guessing game. – marcelm Jun 27 '16 at 23:17
• Could it be that the reference is more accurate than the supply rails? It'd be useful if you have some other precision references to check with, if you see a constant offset then the adc buffer probably has some bias or something like that, if you see a constant gain error then the adc's internal reference may be slightly low (as the odds of several different references being ratiometrically out are really low). It's possible that the reference is just low, it's out by 2030.5/2048 = 0.85% is it speced to better than 1%, some ultra low drift references have wide voltage variability – Sam Jun 27 '16 at 23:20
• What do you observe if you probe the ADC input pin with your scope, with the voltage reference connected, while the ADC is sampling? Is the ADC input pin stable at 2.048V (suggesting the ADC is off for some reason), or does it dip (suggesting another type of problem)? – marcelm Jun 27 '16 at 23:21
• @marcelm Both the voltage reference and the rails probed with the scope and a DMM show stable 5.00V (sometimes 4.99V) and 2.048V, respectively. EDIT: As the datasheet states, that additional (decoupling) capacitors are not needed, I did not add any in my current design. I'll see what I can do about the schematic. – fscheidl Jun 27 '16 at 23:23
• What makes you think it's the reference that's out and not the supply rails? The scope has more internal error than you're measuring with the 12b ADC, any deviation from 5V, any noise, internal bias, etc is going to throw out your measurements. Unless you've got a HP 662x series power supply or equivalent, I wouldn't trust it's accuracy either – Sam Jun 27 '16 at 23:42

Try providing a little more settling time (a few msec) before taking each measurement. By this I mean time between when the ADC channel is selected and when the conversion starts. I use the REF3020 and it has poor response to changes in load, even though it can provide high current into a fixed load. You won't see it with a DMM or even a scope because it's hard to set the trigger set very fine.

• Perfect, thank you! After further increasing the sampling time, I now get the correct value. – fscheidl Jun 28 '16 at 10:54

I don't think you are using the voltage reference in the best way. You wrote "The microcontroller is powered by 5V (5.00V), the MCUs ADC Reference is set to 5.00V too." so you are actually using your 5V rail as the ADC's reference. You're not using 2.048V as an ADC reference. Thus, your ADC can only be as accurate as your 5V rail.

What you really want to do is to connect the 2.048V reference voltage to the MCU's ADC VREF input and configure the MCU to use that as its reference. This means that your 5V rail can move up and down as loads come and go but your ADC will always read full-scale at exactly the VREF IN reference voltage.

Downside is this means full-scale readings are limited to 2.048V. That's why I typically use a 4.096V reference and any voltages I need to read above 4V, I scale it down with resistors and/or opamps.

Also, make sure you read the specs on our ADC. Even with a perfect voltage reference, the ADC will have some error. The price you paid usually dictates how small this error is. Here's a good article on reading ADC specs. Hope that helps.