An analog-to-digital converter (ADC) is a peripheral that samples a continuous analog voltage and converts it to a discrete digital value proportional to the input relative to a reference voltage. ADCs are used whenever a microcontroller needs to measure a real-world quantity -- temperature, pressure, current, position, audio -- that originates as an analog signal.
In practice
Most MCUs include at least one on-chip SAR (successive-approximation register) ADC with multiple multiplexed input channels, though topologies, channel counts, and resolutions vary by family. Common resolutions are 10-bit (1024 counts, found on AVR and many PIC devices), 12-bit (4096 counts, typical on STM32, Kinetis, MSP430, and many Cortex-M parts), and 16-bit or higher on precision-oriented devices, though 8-bit, 14-bit, and 18-bit variants also exist in widely used families. Sampling rate and resolution trade off against each other: running a SAR ADC faster than its specified throughput -- or failing to give the sample-and-hold capacitor enough acquisition time -- can degrade effective resolution and accuracy, though the exact impact depends on the ADC design and source impedance. These pitfalls are covered in detail in "Analog-to-Digital Confusion: Pitfalls of Driving an ADC."
The reference voltage sets the full-scale range. Many MCUs allow selecting between an internal bandgap reference (often 1.2 V to 2.5 V, chip-dependent), the supply rail (VDD/AVDD), or an external precision reference, though some parts offer only a subset of these options. Ratiometric measurements -- where the sensor and the ADC share the same reference -- can cancel out supply noise and are a common design technique for resistive sensors like NTCs and potentiometers.
On-chip ADCs are typically located in a mixed-signal domain (sometimes labeled AVDD/AGND) that should be decoupled carefully from the digital supply. Switching noise from GPIO toggles, PWM outputs, or the CPU itself can couple into the analog front end and degrade SNR. Techniques to mitigate this include sampling during a quiet window (disabling DMA bursts or PWM edges), using hardware oversampling and decimation (supported natively on some STM32 and SAM parts), and filtering the analog input externally.
For higher accuracy or electrical isolation, external delta-sigma ADCs are common. These trade throughput for resolution, often achieving 18 to 24 bits at audio or industrial measurement rates. Isolated sigma-delta modulators -- covered in "Isolated Sigma-Delta Modulators, Rah Rah Rah!" -- push the modulator stage across an isolation barrier, with digital reconstruction happening on the MCU side, useful in motor drives and power metering. When working under an RTOS, driver architecture matters: "How to use analog input (ADC) on NuttX RTOS" illustrates how ADC access is abstracted through a device-file interface on NuttX, which differs significantly from bare-metal register access.
Discussed on EmbeddedRelated
Frequently asked
What does ADC resolution actually mean in practice?
Resolution is the number of bits in the digital output word, which determines the number of discrete steps across the full-scale input range. A 12-bit ADC divides the reference voltage into 4096 steps. If the reference is 3.3 V, the smallest measurable voltage change (1 LSB) is roughly 0.8 mV. Higher resolution only helps if the analog front end and PCB layout are clean enough to support it -- noise, offset, and gain error all reduce effective number of bits (ENOB) below the theoretical maximum.
What is the difference between a SAR ADC and a delta-sigma ADC?
SAR (successive-approximation register) ADCs use a binary-search algorithm with a
DAC and comparator to resolve each sample, making them fast and power-efficient at moderate resolutions (8 to 18 bits). They are found in most general-purpose MCUs. Delta-sigma ADCs oversample the input at a very high rate and use noise shaping plus a digital decimation filter to achieve very high resolution (16 to 24 bits) at lower throughput rates. Delta-sigma converters are preferred for precision measurements such as weigh scales, temperature sensors, and audio where speed is less important than accuracy.
How do I reduce noise when using an on-chip ADC?
Common approaches include: adding a low-pass RC filter on the analog input to band-limit noise before sampling; sampling during a quiet period when high-frequency digital activity is minimal; using hardware oversampling and decimation if the
MCU supports it (STM32 and SAM D/E series have built-in oversampling); separating AVDD and DGND planes or at least adding a ferrite bead and decoupling capacitor on the analog supply pin; and choosing an external precision reference instead of VDD when VDD is noisy. The blog post 'Analog-to-Digital Confusion: Pitfalls of Driving an ADC' covers input impedance and source resistance pitfalls in detail.
What is acquisition time and why does it matter?
Before a SAR ADC begins its conversion, a sample-and-hold capacitor must charge to the input voltage. Acquisition time is the minimum time needed for this capacitor to settle to within the required accuracy. If the source impedance driving the ADC input is too high, the RC time constant of source resistance and the sampling capacitor is too long, and the capacitor will not fully settle -- causing gain error and distortion. Datasheets specify maximum source impedance or minimum acquisition time; exceeding these limits is a common cause of unexpected ADC inaccuracy.
Can I use DMA with an ADC?
On most 32-bit MCUs (STM32, Kinetis, SAM, nRF52 series, and others), the ADC peripheral can trigger a
DMA transfer on each completed conversion, filling a buffer in memory without CPU involvement. This is the standard approach for continuous or multi-channel scanning use cases. On smaller 8-bit MCUs (PIC, AVR), DMA is often absent or limited, so ADC results are typically read in an
ISR or polled. When using DMA with ADC, mark the destination buffer
volatile or use appropriate
cache maintenance if the target is a Cortex-A or Cortex-M7 device with data cache enabled.
Differentiators vs similar concepts
ADC is sometimes confused with the specific converter topology used to implement it. The term ADC describes the functional block (analog-in, digital-out); SAR, delta-sigma, pipeline, and
flash are architectures that implement that function with different speed, resolution, and power tradeoffs. ADC is also distinct from
DAC (digital-to-analog converter), which performs the reverse conversion, producing an analog output voltage from a digital input value.