Embedded HandbookApps
All sections › XXI. Analog building blocks
STM32F103, STM32F407, STM32G431, STM32L431 · level intermediate · 6 min read
Open in the interactive handbook

177. Voltage references: divider, Zener diode, reference IC, drift and noise

Everything the ADC measures, it measures relative to the reference: the code equals U · 4096 / Uref. So the reference error goes straight into the result — and no gain calibration of the signal path will remove it if the reference drifts. This section shows how three ways of getting 2.5 V differ and what the lines of a voltage reference datasheet mean.

The numbers below come from an ngspice model: a 10 kΩ / 10 kΩ divider, a 2.5 V Zener diode through 2.2 kΩ, and a voltage reference IC with an output resistance of 0.1 Ω, 80 dB of supply rejection and a drift of 20 ppm/°C.

Terms used in the documentation

Term Meaning
voltage reference a source of a stable reference voltage
initial accuracy the output error of a new part at room temperature
temperature drift / tempco (ppm/°C) how the output changes with temperature
line regulation output change when the supply changes
load regulation output change when the load changes
dropout voltage the minimum input headroom above the output
output noise (0,1…10 Hz) output noise in the 0.1…10 Hz band
long-term drift slow change of the output over time
series / shunt reference a three-terminal reference / a two-terminal one used like a Zener
bandgap reference a reference based on the silicon bandgap voltage

177.1 Three ways to get 2.5 V

The supply is 5 V, and you need a 2.5 V reference. At 25 °C and with no load all three give almost the same: the divider 2.500 V, the Zener diode 2.513 V, the reference IC 2.500 V. The difference appears as soon as anything at all changes.

The supply changes from 4.5 to 5.5 V:

Reference 4.5 V 5.5 V Shift per 1 V of supply
divider 10 / 10 kΩ 2.250 V 2.750 V 500 mV
Zener diode through 2.2 kΩ 2.504 V 2.520 V 16.0 mV
reference IC 2.500 V 2.500 V 0.10 mV

The divider follows the supply one to one — it is not a reference at all, just a scaled supply. The Zener diode suppresses the shift 31 times, the reference IC 5000 times.

Output of the three "references" as the supply changes from 3 to 6 V


177.2 Load

A reference on the VREF+ input of a microcontroller is not "nothing": the input draws current, especially during a conversion. The model, 5 V supply:

Reference 50 µA load 500 µA load
divider 2.250 V (−250 mV) 0 V — collapsed
Zener diode 2.511 V (−1.8 mV) 2.491 V (−21.5 mV)
reference IC 2.500 V 2.500 V (−0.05 mV)

A 10 kΩ divider has an output resistance of 5 kΩ: 50 microamps pull it down by a quarter of a volt, and it simply cannot deliver 500 µA — that much current cannot pass through the upper resistor. The Zener diode does deliver the current, but pays with a shift: its dynamic resistance in the model is tens of ohms. The reference IC has an output resistance of 0.1 Ω, and 500 µA change its output by 50 microvolts.

Output of the three "references" at a load current from 0 to 1 mA


177.3 Temperature

Heating from 25 to 85 °C:

Reference 25 °C 85 °C Shift In codes of a 12-bit ADC
divider (ideal resistors) 2.500 V 2.500 V 0 0
2.5 V Zener diode 2.513 V 2.396 V −117 mV 192
reference IC, 20 ppm/°C 2.500 V 2.503 V +3.0 mV 4.9

Low-voltage Zener diodes have a negative and large temperature coefficient — the model uses a typical −2 mV/°C, and over 60 degrees that adds up to almost five percent. The divider in the model is ideal, but a real one has the TCR of its resistors (section 166.2): a pair with opposite TCR signs of ±100 ppm/°C gives 0.6 % — 25 codes.

Hence a simple rule: a reference must be a reference. A divider is good only where you measure a ratio (a bridge from the same supply), a Zener diode — as a rough threshold or for protection, and anything that must stay accurate over the operating temperature range needs a reference IC.

Reference for the ADC: a reference IC with capacitors versus a divider and a Zener diode


177.4 What to read in a voltage reference datasheet

A separate line is the shunt reference (two pins, connected like a Zener diode with a resistor): it is simpler, but the current through it is constant, and the resistor is calculated for the maximum load and the minimum supply.


177.5 The reference inside the microcontroller

STM32 has an internal reference: its voltage (about 1.2 V) is measured by the same ADC. In most families (F0, F3, F4, G0, G4, L4 and newer) the factory code of this reference, VREFINT_CAL, is stored in the system memory area, not in the program Flash. F1 does not have it: the reference is taken at its nominal 1.20 V, and the datasheet spread of 1.16…1.24 V gives about ±3 % on the calculated supply voltage (section 14.9). This gives you something unexpectedly useful: by measuring the internal reference, the program calculates the actual supply voltage, and so it can measure absolute values even if VREF+ is tied to the supply.

With the factory code, the accuracy of this scheme is tens of millivolts: the internal reference is not meant to be accurate, and it has its own drift. For measurements "in percent" this is enough; for scales or a 0.1 °C thermometer it is not.


177.6 Pitfalls

ADC readings drift together with the supply. The reference is the supply or a divider from it.

In summer the instrument is off by percents. A Zener diode instead of a reference IC: −2 mV/°C is almost 5 % over 60 degrees.

The reference "sagged" when the ADC was turned on. A divider or a reference IC without current headroom: the VREF+ input draws current pulses; you need a capacitor close by and a reference IC that can hold the load.

The reference IC oscillates. There is no capacitor at its output, or its value is wrong — check the documentation, it gives the allowed range.

After soldering the instrument drifted and did not come back. Long-term drift and mechanical stress in the package; calibrate after a burn-in.

The MCU internal reference gives the wrong value. It is used to calculate the supply, not as an accurate reference: it has its own drift and spread, and on F1, without a factory code, another ±3 % from the nominal.


177.7 Summary

Next: section 178 "Active filters".

Open in the interactive handbook