Your firmware prints a number: 2047. Another run: 2052. The sensor has not moved, the supply looks clean, and still the value walks around. What does that number actually mean, and how much of it can you trust? Let us decode one ADC reading properly, using a setup every embedded engineer knows: a 12-bit ADC with a 3.3 V reference.
1. The reading is a ratio, not a voltage
An ADC does not measure volts. It compares your input against its reference and reports the fraction. With a 12-bit ADC you get 2^12 = 4096 codes, numbered 0 to 4095. The conversion is simple:
code = (Vin / Vref) x 4096, roughly.
So code 2048 is not "2048 of something". It means the input sits at about half of Vref. With a 3.3 V reference, that is about 1.65 V. If your reference is not actually 3.3 V, the same code means a different voltage. The number only has meaning relative to the reference.
2. One step is 0.8 mV
The resolution of a 12-bit ADC on a 3.3 V reference is one LSB:
1 LSB = 3.3 V / 4096 = about 0.8 mV.
NXP's application note AN5250 works out the same figure: 3.3 / 4096 = 0.805 mV. For a single ideal conversion, any input voltage sits at most half an LSB from its nearest code, so the ideal quantization error is ±0.5 LSB, about ±0.4 mV here. Resolution is not accuracy: a real converter adds its own offset, gain and noise errors on top. And sub-LSB change is not always invisible: noise that crosses a code threshold, or deliberate oversampling and averaging, can reveal movement smaller than one step. Also notice the top of the scale: code 4095 corresponds to about 3.299 V, one step below the reference, not exactly 3.3 V.
3. The reference is half of your measurement
Because the reading is a ratio, every millivolt of trouble on the reference lands directly in your result. AN5250 gives a striking example. A clean 1 V input with a 3.3 V reference converts to (1 / 3.3) x 4095 = 1241 (4D9h). Now let ripple ride the reference 40 mV above nominal, to 3.34 V at the peak, the kind a switch-mode supply can produce: the same input converts to (1 / 3.34) x 4095 = 1226 (4CAh). That is a 15 LSB error from the reference alone.
If you chase a "noisy ADC" in firmware, first measure Vref itself. Check its line and load regulation and its drift over temperature. When accuracy matters, a dedicated reference chip beats running the ADC from a rail that also feeds the rest of the board.
4. Use the whole range you paid for
Twelve bits give you 4096 codes, but only if your signal uses them. A signal that swings 0 to 2.5 V into a 3.3 V reference reaches only about code 3103 at its peak. Almost a quarter of your codes, about 993 of them, never occur. Your effective resolution drops with them.
AN5250's advice is to match the reference to the signal: if the signal lives between 0 and 2.5 V, choose a 2.5 V reference so the full code range works for you. When the reference is fixed, a small preamplifier stage does the same job from the other side. Either way, the goal is the same: spread your signal across as many codes as possible.
5. The source has to keep up
Inside the ADC, a small sampling capacitor charges through resistance: the ADC's own switch resistance plus your source resistance. AN5250 writes the charging time constant as the total resistance times the sampling capacitor: tc = (RADC + RAIN) x CADC. A high-impedance source, a sensor output without a buffer, a big resistor divider, charges that capacitor slowly. If the sampling time ends before the capacitor settles, the conversion reads a voltage that is still changing, and the result is wrong in a way that looks exactly like noise.
The fixes are boring and effective: lower the source impedance, add a buffer, or give the ADC a longer sampling time. If one channel reads fine and another wanders, compare what drives each pin.
6. Averaging helps, but only sometimes
For DC measurements, software averaging is the first tool everyone reaches for, and AN5250 supports it with one condition: the input must stay at the same voltage while the samples are taken. Average several conversions of a steady DC level and random noise largely cancels, while systematic offset, gain and reference errors remain untouched. Average a signal that is actually moving and you mix different voltages together and invent errors of your own.
For high-frequency noise riding on the signal, the hardware fix is a simple RC low-pass filter with its cutoff just above the frequency range you care about; for this case NXP suggests sampling at two to five times the cutoff. Underneath every such choice sits the sampling theorem: twice the highest frequency present is the theoretical floor, and practical designs sample well above it.
7. A five-minute checklist before blaming the ADC
Check 1: Compute your LSB. Vref divided by 4096 for 12 bits. Every other error makes sense only next to this number.
Check 2: Measure the reference. Its ripple and drift enter the reading one-for-one.
Check 3: Compare your noise with the LSB. Noise well below one LSB usually hides inside quantization, unless it crosses a code threshold or you average enough samples.
Check 4: Match the range. If the signal uses only part of the codes, change the reference or amplify.
Check 5: Check settling. High source impedance plus short sampling time equals phantom noise.
Check 6: For DC readings, average only while the input holds steady, and filter what is truly high frequency. Averaging does not remove offset, gain or reference errors.
The takeaway
An ADC reading is a fraction of a reference, quantized in steps of about 0.8 mV for a 12-bit converter on 3.3 V. The code is only as honest as the reference behind it, the range it spans, and the settling you allow. Get those right, and that wandering number between 2047 and 2052 becomes what it should be: a quiet, trustworthy measurement.
Frequently asked questions
Why does my ADC reading jump around even when the input is steady?
The usual suspects are reference ripple, noise on the analog input, and a source that has not settled. Measure Vref first, then compare the noise you see with your LSB size. The fix follows from whichever one is guilty.
Can a 12-bit ADC detect changes smaller than one LSB?
One LSB is the spacing between codes, not a wall. Any input that crosses a threshold between two codes flips the reading, and an arbitrarily small change sitting near a threshold can do that. A single conversion still cannot report fractions of a code. But average many conversions of a steady DC level and sub-LSB movement shows through, and with enough random noise or deliberate dither, oversampling techniques can push effective resolution below one LSB.
Why does my full-scale input read 4095 and not 4096?
A 12-bit ADC produces 4096 codes numbered 0 to 4095. The top code 4095 sits one LSB below the reference, about 3.299 V on a 3.3 V reference. That is normal, not a fault.
Is 12 bits enough resolution for my sensor?
Ask how many codes your signal actually uses. A 0 to 2.5 V signal on a 3.3 V reference leaves about 993 codes unused. If you need finer steps, match the reference to the signal range or add a preamplifier, not a higher-bit ADC by default.
Does averaging always make my readings more accurate?
No. For a DC measurement taken while the input holds the same voltage, averaging can reduce random noise. It does nothing for systematic errors: offset, gain error and a drifting reference pass straight through an average. And if the signal is moving while you sample, you blend different voltages into a wrong value, so changing signals need proper filtering and sampling, not a bigger average.
How do I check whether my reference is the problem?
Measure it with a multimeter and, if you can, watch it on a scope while the board runs. Remember the ratio: AN5250 shows a 40 mV excursion on a 3.3 V reference moving a 1 V reading by 15 LSB. A drifting reference drifts every channel with it.
Sources
- NXP Semiconductors, "How to Increase the Analog-to-Digital Converter Accuracy in an Application", Application Note AN5250 (https://www.nxp.com/docs/en/application-note/AN5250.pdf): LSB size, quantization error, reference-noise example, dynamic-range matching, source resistance and averaging.
- STMicroelectronics, "Understanding and Minimising ADC Conversion Errors", Application Note AN1636 (https://www.st.com/resource/en/application_note/an1636-understanding-and-minimising-adc-conversion-errors-stmicroelectronics.pdf): how gain, offset and external errors appear in real conversions.
Written by ARDRA LAB, Common Research Team.
Read this on our website: https://www.ardralab.com/blog/technical-blogs-5/what-your-adc-reading-really-means-30
Prit Varmora | +91 93164 94418 | service@ardralab.com | www.ardralab.com

