Chapters

25 ADC Fundamentals: Conversion and Resolution

electronics-controller-design
analog
digital
adc

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.

MVU: Analog-to-Digital Conversion

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
In 60 Seconds

Analog-to-digital converters (ADCs) are the bridge between the continuous physical world and the discrete digital domain: they sample an analog voltage at regular intervals and quantise it into a binary number. Resolution (bits) determines how many discrete levels are available, while sampling rate must exceed twice the signal bandwidth to avoid aliasing. Understanding ADC fundamentals is essential for reading any real-world sensor on a microcontroller.

Chapter Roadmap

Use this path through the chapter:

  1. First connect analog sensor voltage to sampling, quantization, reference voltage, and ADC codes.
  2. Then compare bit depth, quantization error, and the 12-bit ESP32-style numbers used throughout the chapter.
  3. Next choose between SAR, sigma-delta, flash, and pipeline architectures based on speed, power, and precision.
  4. 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:

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

WordWhat It Means
ADCA translator that converts smooth values to stair-step numbers
ResolutionHow many stairs the ADC builds (more stairs = more precise)
BitsThe ADC’s power level - 8-bit, 10-bit, or 12-bit
QuantizationRounding to the nearest stair step
VrefThe highest voltage the ADC can measure (the top of the stairs)

25.7.4 Try This at Home!

The Staircase Translation Game!

  1. Draw a ramp from 0 to 10 on paper
  2. Now draw 4 stairs on top of the ramp (this is like a 2-bit ADC: 2² = 4 steps)
  3. Pick a point on the ramp (like 7.3)
  4. 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 nn-bit resolution provides 2n2^n 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 (VrefV_{ref}): 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.

An analog signal becomes a held sample, a SAR chosen level and a stored 12-bit code. Quantization is the lossy step: nearby voltages share one supported level.
Figure 25.1: ADC architecture showing the conversion from analog sensor signals to digital values

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.

Diagram showing the analog nature of real-world sensor measurements including temperature varying smoothly from 20.0 to 25.7 degrees, light intensity ranging continuously from 0 to 1000 lux, and sound levels changing fluidly between 30 and 85 dB. Emphasizes that physical quantities have infinite precision between any two values.
Figure 25.2: The Analog World: Continuous Sensor Measurements

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.

Diagram illustrating the digital world where values exist only as discrete steps. Shows binary representation with 0s and 1s, step changes between fixed voltage levels, and finite resolution determined by the number of bits. Contrasts with the smooth continuous nature of analog signals.
Figure 25.3: The Digital World: Discrete Binary Values and Step Changes

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.

Flowchart showing the three-stage ADC conversion pipeline. Stage 1 Sample and Hold captures the instantaneous analog voltage. Stage 2 Quantize maps the voltage to the nearest discrete level based on resolution. Stage 3 Encode converts the quantized value to binary output format for the microcontroller.
Figure 25.4: ADC Internal Architecture: Sample-Quantize-Encode Pipeline
  1. Voltage Vera: Vera catches one point from a moving wave in a clear sample cup.

    Vera freezes the sensor voltage at one instant.

  2. Voltage Vera: Vera places the cup beside the closest rung on a stepped measuring rack.

    She maps the held value to the nearest allowed level.

  3. Voltage Vera: A small code printer turns the selected rung into a pattern of light and dark blocks.

    The chosen level gets a code the controller can store.

  4. Voltage Vera: Vera points from a finer rack to separate noisy wire, drifting sensor, and weak reference warnings.

    More levels do not fix noise, drift, or a bad reference.

CW-0012 walkthrough: A converter freezes one voltage, maps it to an allowed level, and names that level with a code; more levels cannot fix every source of error.

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:

  1. Input range: the permitted minimum-to-maximum input span.
  2. Reference voltage (VrefV_{ref}): the voltage scale used by the conversion.
  3. Resolution: the number of bits, and therefore the number of available codes.
  4. 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.

A 2.0 V sensor input passes through sample and hold, quantize and encode to code 2482. Below, input range, reference voltage, resolution and sampling rate have different jobs.
Figure 25.5: Analog-to-Digital Converter operation and components

The top row in Figure 25.5 reinforces the representation changes: waveform, held sample, chosen step, binary code. Below it, VrefV_{ref} 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.

The ADC samples, quantizes and encodes voltage; the DAC converts digital codes to voltage and filters the output. Lost detail is not recreated.
Figure 25.6: ADC and DAC conversion processes

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)

BitsValuesResolution @ 5VResolution @ 3.3VExample Use
825619.5 mV/step12.9 mV/stepLow-cost sensors
101,0244.88 mV/step3.22 mV/stepArduino Uno
124,0961.22 mV/step0.806 mV/stepESP32, STM32
1665,5360.076 mV/step0.050 mV/stepPrecision 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 Vref=3.3V_{ref} = 3.3 V, the engineering step size (LSB) is Vstep=Vref/2n=3.3/4096=0.806V_{step} = V_{ref} / 2^n = 3.3 / 4096 = 0.806 mV. With codes running 0 to 4095, reading a 2.0V sensor gives digital value D=(Vin/Vref)×2n=(2.0/3.3)×4096=2482D = \lfloor (V_{in} / V_{ref}) \times 2^n \rfloor = \lfloor (2.0 / 3.3) \times 4096 \rfloor = 2482. Quantization error is up to ±Vstep/2=±0.403\pm V_{step}/2 = \pm 0.403 mV. If the sensor signal is 100mV (\approx 124 counts), and noise causes ±2\pm 2 count variation, SNR is 20log10(124/2)=35.820 \log_{10}(124/2) = 35.8 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 mathematical gist. An ideal NN-bit ADC divides a 3.3 V reference into 2N2^N levels, so q=Vref/2Nq=V_{ref}/2^N, the rounding limit is q/2q/2, RMS quantisation noise is q/12q/\sqrt{12}, and the full-scale-sine limit is 6.02N+1.766.02N+1.76 dB. At 12 bits those values are 0.806 mV, 0.403 mV, 0.233 mV, and 74.0 dB; real converters add reference, timing, and linearity errors.

Math Bridge · guided foundationsHow does one extra ADC bit shrink the staircase error?Let Eddie connect levels, step size, noise, and ideal SNR.

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.

ADC bit-depth examples double the values with each additional bit; a zoom compares 10-bit and 12-bit steps at 3.3 V. More values do not guarantee accuracy.
Figure 25.7: ADC Resolution Comparison: 1-bit to 16-bit Value Ranges

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.

Interactive ADC Resolution Visualization

Explore quantization with the Falstad Circuit Simulator:

Open Circuit Simulator →

What to explore:

  1. Load the “Voltage Divider” example from the menu (Circuits → Passive Filters → Voltage Divider)
  2. Observe the smooth analog voltage on the oscilloscope
  3. Mentally “staircase” the smooth wave: A 3-bit ADC (8 levels) would snap to nearest voltage
  4. Compare 8-bit (256 steps — smooth staircase) vs 4-bit (16 steps — chunky staircase)
  5. 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.

Voltage VeraCheckpoint: 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.