25 ADC Fundamentals: Conversion and Resolution
25.1 Overview
This first route explains the conversion chain and turns bit depth, reference voltage, codes, and quantization into bounded calculations.
This is part 1 of 2. Continue with ADC Fundamentals: Architectures and Interfaces for the second focused route.
25.2 Start Simple
Turn One Known Voltage Into a Defensible Number
Picture a light sensor producing a voltage between dark and bright conditions. A displayed number is not yet a good measurement. The first check is whether a known input becomes the expected code, unit, and decision.
An analog-to-digital converter is a circuit that turns a measured voltage into a number. ADC is the short name for that converter. A microcontroller means a small computer chip that reads inputs and controls outputs.
Apply low, middle, and high known voltages. Record reference voltage, code, step size, time, noise, and converted unit. Add noise, sample too slowly, repeat a boundary value, and restart. Reject extra displayed digits that the input path cannot support.
This runway does not prove measurement accuracy from bit count alone. The deeper sections explain sampling, hold time, quantisation, code steps, error, rate limits, converter types, and calibration evidence.
Imagine a light sensor voltage between 0 V and 3.3 V that must become a number. The ADC does that by sampling the voltage and choosing the nearest code from a fixed set of steps. Start with the reference voltage, bit depth, sensor range, and the smallest change the product must detect.
Core Concept: An ADC (Analog-to-Digital Converter) translates continuous real-world signals (voltage) into discrete digital numbers that microcontrollers can process. Resolution (bit depth) determines precision: a 12-bit ADC divides the voltage range into 4,096 steps, while 10-bit provides only 1,024 steps.
Why It Matters: Every IoT sensor that measures physical quantities (temperature, light, pressure, sound) produces analog signals, but microcontrollers only understand digital values. The ADC is the mandatory bridge - without it, your microcontroller literally cannot “see” the physical world. Understanding ADC resolution and quantization error helps you choose the right hardware for your accuracy requirements.
25.3 Learning Objectives
By the end of this section, you will be able to:
- Trace ADC Operation: Describe the sample-hold-quantize-encode pipeline that converts analog voltages to digital values
- Apply ADC Formulas: Calculate digital output, step size, and reconstructed voltage from input parameters
- Differentiate Resolution Levels: Analyze how bit depth (8, 10, 12, 16-bit) determines voltage precision and quantization step size
- Estimate Quantization Error: Calculate maximum measurement error for a given ADC resolution and reference voltage
- Classify ADC Architectures: Contrast SAR, sigma-delta, and flash ADCs by speed, resolution, power, and IoT suitability
Use this path through the chapter:
- First connect analog sensor voltage to sampling, quantization, reference voltage, and ADC codes.
- Then compare bit depth, quantization error, and the 12-bit ESP32-style numbers used throughout the chapter.
- Next choose between SAR, sigma-delta, flash, and pipeline architectures based on speed, power, and precision.
- Finally apply the selection workflow to noise, filters, microcontroller choices, precision logging, and quizzes.
Checkpoints recap the design decisions; calculators, Ada audits, and optional field notes provide deeper proof when you need the arithmetic.
25.4 Analog-to-Digital Conversion
An ADC (Analog-to-Digital Converter) is the bridge between the smooth, continuous real world and the stepped, numerical world of computers. Imagine a thermometer that reads 23.7 degrees — the ADC is the component that turns that smooth temperature into a number your microcontroller can work with. The more “bits” an ADC has, the finer the steps and the more precise the measurement, like using a ruler with millimeter marks instead of just centimeter marks.
25.5 Prerequisites
Before diving into this chapter, you should be familiar with:
- Binary Number Systems: Understanding of binary representation and powers of 2
- Electricity Fundamentals: Understanding voltage, current, and basic circuit analysis
- Sensor Fundamentals: Familiarity with sensor output types (analog voltage, current)
25.6 How To Use This Chapter
- Read this chapter as the answer to a specific practical question: how does a real sensor voltage become a number in code.
- On a first pass, focus on the conversion pipeline, resolution, and quantization error. The ADC architecture details can come second.
- Whenever the text mentions bits or voltage range, connect it to a real sensor choice: temperature sensor, potentiometer, light sensor, or microphone front end.
25.7 Why ADCs Matter for IoT
The gap between analog and digital is THE fundamental challenge in IoT.
The world is analog (temperature, pressure, light), but microcontrollers are digital (0s and 1s). Understanding this interface is essential for every IoT sensor application.
The ADC is like a translator between the smooth real world and the step-by-step computer world!
25.7.1 Number Translator Story
Temperature Terry was frustrated. “I can feel exactly how warm it is - 23.456 degrees! But the microcontroller keeps asking me for simple numbers like 23 or 24!”
Max explained: “I’m sorry, Sammy. I can only work with whole numbers - I count in steps, not smooth slides. When you tell me 23.456, I don’t know what to do with the .456 part!”
the LED had an idea. “What about asking ADC Andy for help? He’s the best translator in all of IoT City!”
ADC Andy arrived wearing a special badge that said “12-bit”. He explained: “My badge tells me how precise I can be! With 12 bits, I can translate Sammy’s smooth feelings into 4,096 different steps!”
“Watch this,” Andy continued. “Sammy, tell me the temperature.”
“It’s 23.456 degrees!” said Sammy.
ADC Andy thought for a moment. “With my 4,096 steps for temperatures between 0 and 100 degrees, that’s about step number 961. Here you go, Max!”
Max was delighted. “961! Now that’s a number I can work with! I’ll save it, send it over the network, and compare it to yesterday’s reading!”
the battery smiled. “And because Andy translates so efficiently, I don’t waste energy trying to send impossibly precise numbers!”
25.7.2 The Staircase Analogy
Imagine you’re on a smooth ramp that goes from 0 to 100:
- Analog Sammy can stand ANYWHERE on the ramp: 23.1, 23.2, 23.3456789…
- Digital Max can only stand on STAIRS
ADC Andy builds the stairs:
- 8-bit Andy builds 256 stairs (big steps, less precise)
- 10-bit Andy builds 1,024 stairs (smaller steps, more precise)
- 12-bit Andy builds 4,096 stairs (tiny steps, very precise!)
More stairs = smaller steps = closer to Sammy’s exact position!
25.7.3 Key Words for Kids
| Word | What It Means |
|---|---|
| ADC | A translator that converts smooth values to stair-step numbers |
| Resolution | How many stairs the ADC builds (more stairs = more precise) |
| Bits | The ADC’s power level - 8-bit, 10-bit, or 12-bit |
| Quantization | Rounding to the nearest stair step |
| Vref | The highest voltage the ADC can measure (the top of the stairs) |
25.7.4 Try This at Home!
The Staircase Translation Game!
- Draw a ramp from 0 to 10 on paper
- Now draw 4 stairs on top of the ramp (this is like a 2-bit ADC: 2² = 4 steps)
- Pick a point on the ramp (like 7.3)
- Which stair is it closest to? That’s your “digital value”!
Now try with 8 stairs (3-bit) - is your answer more precise?
What you learned: ADCs work just like this! More bits = more stairs = better precision. But even the best ADC rounds to the nearest step - that tiny error is called “quantization error”!
25.8 Key Concepts
An ADC connects a sensor’s continuously varying voltage to the microcontroller’s finite set of numbers. It does this at particular moments set by the sampling rate, so every result says both “which voltage band?” and “at what sample time?” Those two axes must fit the signal: code spacing must be fine enough to distinguish a useful change, and samples must be frequent enough to follow useful variation.
The voltage axis depends on reference voltage and resolution together. The reference establishes the conversion scale, while an -bit resolution provides possible codes across that scale. Assigning a continuously variable input to one code is quantization, and the difference between the input and its representative level is quantization error. More bits can reduce the ideal step, but they cannot repair an unstable reference, a noisy front end, or a poorly chosen sampling rate.
Keep these five terms as a compact summary:
- ADC: converts a sampled analogue voltage into a digital code.
- Resolution: sets the number of available codes through bit depth.
- Quantization error: is the difference introduced when an input is represented by one supported level.
- Reference voltage (): defines the voltage scale used by the converter.
- Sampling rate: states how often a new conversion is made.
25.9 The Analog vs Digital Divide
Before tracing an ADC conversion, build a mental picture of the boundary it crosses. A sensor presents a voltage that can vary continuously, while a microcontroller stores one code from a finite set. Figure 25.1 compresses that whole journey into one row. Read it from left to right, asking what representation exists at each boundary and what information is lost when the representation changes.
In Figure 25.1, start at the green waveform on the left: at this point, voltage is still a continuously varying electrical signal. The sample-and-hold block takes one time-specific snapshot and keeps it steady long enough to measure. This example then shows a SAR engine narrowing down the nearest supported level by comparison with an internal DAC. Only after that decision can the encoder emit the bit pattern on the right. The important change is not simply “analog in, digital out”; it is continuous signal → held sample → chosen level → stored code. That sequence is the bridge the rest of the chapter will unpack.
25.9.1 The Analog World
Temperature, light, pressure, and sound can all change between two observations without waiting for a digital clock edge. Figure 25.2 gives three sensor examples so you can separate the physical quantity from the number eventually stored for it. Look first at what each curve represents, then at the shared property across all three panels.
Read Figure 25.2 from temperature to light to sound. Their units and timescales differ, but each curve can occupy values between the marked examples; the physical signal is not restricted to integer code levels. “Continuous” does not mean that a real sensor has infinite accuracy. Sensor noise, bandwidth, calibration, and the analogue front end still limit what can be known. It means that the signal presented to the ADC is not yet confined to the converter’s finite codebook.
As a summary, an analogue signal is:
- continuous in value within its operating range rather than restricted to codes;
- able to change between sample times, whether slowly or quickly; and
- measurable only to finite accuracy once a real sensor and circuit are involved.
25.9.2 The Digital World
A processor needs repeatable symbols it can store, compare, and transmit. The digital view therefore replaces the continuum with an agreed set of codes. In Figure 25.3, follow the panels from binary symbols, through the staircase of allowed values, to the finite set of levels created by a chosen bit depth.
In Figure 25.3, the left panel shows the storage alphabet: bits. The centre panel turns those bits into a staircase, making the missing in-between output values visible. The right panel connects the number of available steps to bit depth. A code is stable and easy to copy, but it represents an interval of possible input voltages rather than the exact original voltage. This is where quantization uncertainty enters the measurement chain.
Digital representation is therefore:
- discrete — only the available codes can be stored;
- step-based — a small input change may leave the code unchanged or move it by one level; and
- finite in resolution — bit depth sets the size of the codebook.
Why Digital?
Once a voltage has become a valid code, the system can copy and process that code without repeatedly interpreting an analogue level. Valid logic margins can tolerate some electrical disturbance, error checks can protect transmission, and arithmetic can turn readings into decisions. Those advantages explain why IoT systems digitise sensor signals early, but they do not recover detail discarded during sampling or quantization. The next section follows that conversion explicitly.
25.10 Analog-to-Digital Converters (ADC)
An analogue-to-digital converter (ADC) observes an input voltage at a chosen time and assigns it one of the digital codes the converter supports. To understand the result, do not jump straight from voltage to bits. The conversion has three distinct decisions, and each one answers a different question. Use Figure 25.4 as the map for the rest of this section.
-
Vera freezes the sensor voltage at one instant.
-
She maps the held value to the nearest allowed level.
-
The chosen level gets a code the controller can store.
-
More levels do not fix noise, drift, or a bad reference.
Read Figure 25.4 from left to right. Sample and hold first captures the input at one instant and keeps that voltage stable; without a stable sample, the later comparison would chase a moving target. Quantize then decides which supported level represents that held voltage. This is the lossy step: a band of nearby input voltages must share one level. Encode finally names that level with a binary code the microcontroller can store. The code is therefore a description of the selected level, not a perfectly precise copy of the original signal. When firmware later converts the code into volts or engineering units, it is interpreting the end of this same chain.
25.10.1 ADC Components
Four settings define what that pipeline can do. The input range states which voltages the front end is designed to accept; an out-of-range signal cannot be rescued by extra bits. The reference voltage provides the scale against which the held input is judged. Resolution sets how many codes divide that scale, while the sampling rate sets how often a new held value can enter the pipeline. Together they determine coverage in voltage and time.
Keep the roles distinct:
- Input range: the permitted minimum-to-maximum input span.
- Reference voltage (): the voltage scale used by the conversion.
- Resolution: the number of bits, and therefore the number of available codes.
- Sampling rate: how frequently the converter can produce new observations.
25.10.2 ADC Resolution
Resolution is easiest to understand by connecting the signal path to the converter settings. In Figure 25.5, read the top row left to right to revisit one conversion. Then inspect the lower row: each parameter changes either the voltage span, the number of divisions across that span, or how often the conversion repeats.
The top row in Figure 25.5 reinforces the representation changes: waveform, held sample, chosen step, binary code. Below it, and input range set the scale, resolution divides that scale into codes, and sampling rate controls the spacing between observations in time. More bits make the voltage divisions finer, but they do not widen a safe input range, increase the sampling rate, or remove sensor and circuit error.
Figure 25.6 adds a useful reverse comparison. Follow the ADC path on the left from a smooth input to samples and codes; then follow the DAC path on the right from codes back to an electrical output.
On the ADC side of Figure 25.6, many possible input voltages collapse onto the same code. On the DAC side, that code can be turned back into a representative output level, and filtering may smooth the visible steps, but the original between-code detail is not recreated. This is why the number of available codes matters: it bounds how finely the converter can distinguish input voltage before any later processing begins.
Resolution is the number of discrete values the ADC can output.
Formula: Number of values = 2^n^ (where n = bits)
| Bits | Values | Resolution @ 5V | Resolution @ 3.3V | Example Use |
|---|---|---|---|---|
| 8 | 256 | 19.5 mV/step | 12.9 mV/step | Low-cost sensors |
| 10 | 1,024 | 4.88 mV/step | 3.22 mV/step | Arduino Uno |
| 12 | 4,096 | 1.22 mV/step | 0.806 mV/step | ESP32, STM32 |
| 16 | 65,536 | 0.076 mV/step | 0.050 mV/step | Precision instruments |
Read down either voltage column and notice the pattern: each added bit doubles the number of codes and halves the ideal step size for the same reference span. The table describes theoretical code spacing, not guaranteed system accuracy. Reference error, front-end noise, linearity, and the sensor itself can all make the useful resolution coarser.
See the full resolution comparison table for additional bit depths (6-bit through 24-bit) with error calculations.
For a 12-bit ADC with V, the engineering step size (LSB) is mV. With codes running 0 to 4095, reading a 2.0V sensor gives digital value . Quantization error is up to mV. If the sensor signal is 100mV ( 124 counts), and noise causes count variation, SNR is dB — adequate for most IoT temperature sensors but marginal for precision instrumentation.
For a bipolar ADC range, use the whole span. A sensor front end that accepts +/-10 V has a 20 V span, so a 16-bit converter has a theoretical step size of 20 V / 65536 = 305 microvolts per count. Noise can consume those bits: 16 noisy counts are four bits of uncertainty, so the effective clean resolution is closer to 12 bits until the noise source is reduced.
Sensitivity must include that noise floor. With a +/-1 V input range and a 12-bit ADC, one count is about 2 V / 4096 = 0.488 mV; if the signal jitters by +/-4 counts, the smallest reliable peak-to-peak change is roughly +/-1.95 mV. Averaging 64 independent samples can reduce random noise by sqrt(64) = 8, but it costs time and does not fix bias, nonlinearity, or correlated noise.
The derivation above explains the error associated with one step; Figure 25.7 zooms out to show how rapidly the number of available values grows with bit depth. Read from the short 1-bit bar toward the 16-bit bar, comparing codebook size rather than physical accuracy.
In Figure 25.7, each move to the next bit doubles the represented values, so the bars grow exponentially rather than by a fixed amount. That finer partition is the source of the smaller ideal step and higher ideal quantization SNR derived above. It still does not promise that every code is noise-free or accurate; the figure counts possible outputs, while the worked numbers and later pitfalls decide how many of those outputs carry trustworthy information.
Explore quantization with the Falstad Circuit Simulator:
What to explore:
- Load the “Voltage Divider” example from the menu (Circuits → Passive Filters → Voltage Divider)
- Observe the smooth analog voltage on the oscilloscope
- Mentally “staircase” the smooth wave: A 3-bit ADC (8 levels) would snap to nearest voltage
- Compare 8-bit (256 steps — smooth staircase) vs 4-bit (16 steps — chunky staircase)
- Watch how a slow-changing analog signal (like temperature) gets approximated by discrete digital values
The simulator shows electron flow animation and real-time voltage/current graphs, helping visualize how continuous analog voltages map to discrete digital numbers.
Checkpoint: Conversion and Resolution
You now know:
- An ADC samples a continuous input, holds it briefly, maps it to the nearest code, and encodes that result for the microcontroller.
- A 12-bit converter has 4096 levels, so a 3.3 V reference gives a 0.806 mV step in the chapter’s ESP32-class examples.
- For the 2.0 V example, the ADC code is 2482 and the maximum quantization error is about +/-0.403 mV.
25.11 Continue to Part 2
Continue with ADC Fundamentals: Architectures and Interfaces.
