1.Why should I care?
Every analog sensor reading passes through an ADC, and most sensor bugs are really unit-conversion bugs. Two formulas and one idea (a step) let you read any ADC datasheet and know exactly how finely your machine can sense the world.
- ◇ Convert ADC counts to volts and volts to counts, given the reference and the number of bits.
- ◇ Calculate an ADC's step size and the resulting resolution in a physical unit.
- ◇ Explain quantisation error and why extra bits do not help when noise is bigger than a step.
2.Predict
A 10-bit ADC with a 3.3 V reference reads 512. Roughly what voltage is that?
Guess first. Being wrong here is how the surprise works.
3.Discover
Hold the temperature at 21.5 °C and step the ADC from 4 to 12 bits. Watch the count, the binary lamps and the temperature the firmware recovers. At how many bits does the error drop below 0.5 °C?
Loading the interactive…
Can't use the interactive? Read a description instead
The pipeline diagram shows five stages: the real temperature; the sensor output (500 mV + 10 mV per °C); the ADC count, also shown as binary digits; the voltage firmware calculates back (count × reference ÷ 2^bits); and the temperature firmware calculates. Changing the bits from 4 to 12 makes the steps smaller, so the recovered temperature gets closer to the real one, always within one step.
4.Checkpoint: guided practice
Check what you just discovered before going on. Hints appear after a wrong answer.
Practice 1 · a fresh version every time
What voltage does one step (1 LSB) of a 10-bit ADC with a 3.3 V reference represent, in millivolts?
5.Watch
→ Listen for how resolution and full-scale range are defined, then compare them with the formulas in this lesson.
Explains how an ADC turns a voltage into a number, and what resolution and full-scale range mean.
Length: see YouTube · captions on YouTube · source
Nothing loads from YouTube until you press play.
The video is optional: everything you need is also in the lesson text and the interactive.
6.Understand
Counts and steps
An ADC compares the input with a reference voltage and reports a whole number, a count. More bits give more counts and finer steps: 8 bits = 256 steps, 10 bits = 1,024, 12 bits = 4,096. With a 5 V reference, an 8-bit step is 5 ÷ 256 ≈ 19.5 mV; a 12-bit step is about 1.22 mV. Some datasheets divide by 2ⁿ − 1 instead; the difference is under one step, but check your chip.
Quantisation is rounding
The ADC cannot report 310.3; it reports 310. That rounding is quantisation: the staircase in the signal lab. Its error is always smaller than one step, and it is the same for every reading, so you can state it in advance: '±1 step, which is 0.32 °C for this sensor'.
When noise beats bits
Real signals carry noise. If the noise wiggles by 10 mV and your step is 0.8 mV, the last few bits just record the noise: extra resolution buys nothing. Then it is better to average several readings or filter the signal. Choose bits so the step is a little smaller than the noise and much smaller than the changes you care about.
Explain it another way
An ADC is a ruler with marks. Bits decide how many marks; the reference decides how long the ruler is. A shaky hand (noise) makes very fine marks pointless.
Real ADCs add offset, gain and nonlinearity errors and have an effective number of bits (ENOB) lower than the nominal count because of noise. Firmware often converts in integer millivolts: multiply before dividing to keep precision.
step = Vref/2ⁿ; V = c·Vref/2ⁿ; c = ⌊V·2ⁿ/Vref⌋ (capped at 2ⁿ − 1); resolution in physical units = step ÷ sensor slope.
A battery monitor with a 12-bit ADC and a 3.3 V reference sees 0.8 mV steps, plenty to track a battery draining from 4.2 V to 3.0 V (through a voltage divider) over a day.
Derivation: ADC resolution and conversions
An n-bit ADC has 2ⁿ possible counts, from 0 to 2ⁿ − 1. 10 bits → 1,024 counts (0–1,023).
It shares the reference voltage between them, so one step (1 LSB) is step = Vref ÷ 2ⁿ. 3.3 V, 10 bits: 3.3 ÷ 1,024 ≈ 3.22 mV.
Count to volts: V = count × Vref ÷ 2ⁿ. Count 310 → 310 × 3.3 ÷ 1,024 ≈ 0.999 V.
Volts to count: count = floor(V ÷ Vref × 2ⁿ). 1.00 V → floor(310.3) = 310. Every voltage in the same step gives the same count.
So the stored value can be up to one step below the truth (this lesson's ADC rounds down): that is quantisation error.
In sensor units: with a 10 mV/°C sensor, one 3.22 mV step is 0.322 °C. Each extra bit halves the step.
Worked example 1
A TMP36-style sensor (500 mV + 10 mV/°C) feeds an 8-bit ADC with a 5 V reference. It reads 38. What temperature is that, and how finely can this system measure?
V = 38 × 5 ÷ 256 ≈ 0.742 V = 742 mV. T = (742 − 500) ÷ 10 ≈ 24.2 °C. Step = 5 ÷ 256 ≈ 19.5 mV ≈ 1.95 °C: far too coarse for a greenhouse. A 10- or 12-bit ADC, or a 3.3 V reference, would do better.
Common mix-ups
- More bits always means more accurate measurements.
✓ More bits means finer steps. Accuracy also depends on the reference, the sensor and the noise. - A 10-bit ADC's biggest count is 1,024.
✓ Counts run from 0 to 1,023: that is 1,024 different values.
7.Practice on your own
Practice, not a test. Wrong answers get a hint and another try.
Practice 2 · a fresh version every time
A 8-bit ADC with a 5 V reference reads 53. Using volts = count × Vref ÷ 2^n, what voltage is that, in volts?
Practice 3 · a fresh version every time
A 10-bit ADC with a 5 V reference measures 2.94 V. What count does it report? (count = V ÷ Vref × 2^n, rounded down)
Practice 4
A 10 mV per °C sensor feeds a 12-bit ADC with a 3.3 V reference. What temperature change is one ADC step worth, in °C?
Practice 5
A sensor signal has about 15 mV of noise. You are choosing between a 10-bit (3.2 mV steps) and a 16-bit (0.05 mV steps) ADC. What happens with the 16-bit one?
Practice 6
A 10-bit ADC reads 512 and a 12-bit ADC reads 2,048, both with a 3.3 V reference. Are they measuring the same voltage?
8.Apply it
For the greenhouse project, choose an ADC (8, 10 or 12 bits) and reference (3.3 V or 5 V) for a TMP36-style sensor. Show the step size in °C, the count you expect at 16 °C and 24 °C, and the Python function that turns a count into °C. Check the function with one hand calculation.
9.Reflect
Concepts: Analog-to-digital conversion · Signals: amplitude, frequency and period · Noise and filtering