Skip to content

Analogue-to-Digital Converters (ADCs)

Published On:
Sep 3, 2011
Last Updated:
Mar 26, 2024

An analogue-to-digital converter (ADC) is a device which converts an input analogue voltage level into a representative digital value. They are commonly used in embedded electronics to measure things such as values from an analogue sensor or voltage rails (typically fed through resistor dividers). They are very popular and many microcontrollers have one or more built in ADCs, with each ADC has multiple inputs (5 to 12 is common) shared with GPIO. You can also get stand-alone ADC ICs which normally offer greater precision and resolutions.

A symbol representing a analogue-to-digital converter (ADC).

Microcontroller ADCs

Microcontroller ADCs usually have a 8-12bit resolutions (with some going up to 20-bit). A typical microcontroller has only one ADC unit, but offers an input multiplexor to be able to select an analogue input from a number of pins. The ADC is controlled via registers, usually with voltage reference selectable from an external pin or an internal reference. Voltage dividers can be used to scale a larger voltage into the range acceptable to the microcontroller. Since the input to the ADC is usually of a very high impedance, the voltage at the ADC pin will the related to the ratio of the resistances in the resistor divider. A pull-down resistor is usually connected to an ADC input to prevent it from floating (and giving erroneous results when nothing is connected).

On the left-hand side of the below image is a schematic diagram on the of a Nordic nRF52 MCU with the ADC pins highlighted. There are 8 ADC channels, AIN0 through AIN7 (4 to 7 are called ANx not AINx for some reason). Firmware can connect any one of these channels to the internal ADC peripheral which can then measure the voltage at that pin. The right-hand side shows the same ADC peripheral in the MCUs block diagram.

On the left is a schematic diagram of a Nordic nRF52 MCU with the ADC pins highlighted. There is a single ADC peripheral inside the MCU with 7 channels. Channels can be connected 1-by-1 to the ADC via firmware and measured. On the right is the same ADC peripheral shown in the MCUs block diagram.

Accuracy And Resolution

The resolution of an ADC normally depends on the number of bit’s it supports. ADCs typically support a bit resolution of 8 to 24 bits, with the resolution error usually limited to the last bit. The accuracy can normally be increased by increasing the sample time, which lengthens the amount of time the input capacitor has to stabilize and allows the ADC to complete finer adjustments. Accuracy can also be increased by taking multiple samples and averaging them. A good way to do this with a microcontroller is to take a number that is equal to a power of 2n (i.e. 2, 4, 8, 16, …), and then to save computational time the result can be bit shifted right n times instead of using the divide function (essentially doing the same thing).

Measuring Techniques

There are many ways to convert a analogue signal into a digital one. The two most popular ADC methodologies are successive approximation register (SAR) and Delta-Sigma. SAR ADCs are usually faster but have a lower resolution (typically 8 to 12-bit) while Delta Sigma’s are slower but offer greater accuracy (typically up to 20-bit). SAR ADCs typically have a sampling rate of 100kHz-1MHz while Sigma-Delta ADCs have a sampling rate of 1-20Hz.

Delta-Sigma ADCs also take longer to switch between input signals (if measuring multiple signals with just one ADC) because they incorporate a filter which needs to be reset and stabilised before the measurements become accurate (essentially the filter’s response time).

Switched Capacitor Array

Many SAR ADCs use the switched capacitor array architecture1. Internally, they have a multiplexor to select from one of many input signals (separate pins on a dedicated ADC IC, or shared with GPIO on a MCU). One input is selected and is connected to the sample-and-hold capacitor CSHC_{SH}. The length of time it is connected to this capacitor is called the acquisition time or sample time.

Block diagram of the switched capacitor array architecture, used by many SAR ADCs.

The internal capacitance is also called CADCC_{ADC}2. The capacitance is small and normally in the range of 2pF10pF2pF - 10pF. For example, the CADCC_{ADC} for the STM32G491KE MCU is 5pF2.

The sample-and-hold capacitor is not normally discharged between successive measurements3. This means that when the sample period begins for a measurement, the capacitor will start of at the voltage of finished the previous sample at. This contributes to cross-talk, measurement error which is introduced by the previous measurement (or measurements!).

Model of a analogue input with source resistance RSR_S connected to a ADC input with input resistance.

Texas Instruments: Switched-Capacitor ADC Analog Input Calculations is a great walk through of how to calculate the maximum permissible source resistance RSR_S given a desired accuracy in LSB for an ADC.

You may need to add an external capacitor to ADC inputs to compensate for the voltage drop caused when the sample-and-hold capacitor is connected.

Models of ADC input circuitry can get complex! The below image shows the input model for the Infineon AURIX TriCore TC33xEXT AA family of MCUs.

Models of ADC input circuitry can get complex! This one is from the Infineon AURIX TriCore TC33xEXT AA family of MCUs4.

Medical Uses

ADCs are commonly used in medical devices for biopotential measurements. One common application is for the analogue front-end in EEG devices. The Texas Instruments ADS1299 is one example of an ADC IC designed for EEG applications.

4-20mA Current Loops

ADCs can be used to read the value from a 4-20mA current loop signal with the help of a current-to-voltage converting resistors (what all resistors do, right?).

See the 4-20mA Current Loops page for more info.

Examples

Texas Instruments ADS8866IDRCR

ParameterValue
Manf.Texas Instruments
Manf. Part NumADS8866IDRCR
TopologySAR
Resolution16-bit
Speed100ksps
Digital InterfaceSPI
PackageDFN-10-3x3-TP

Claims to be pin compatible with the Microchip MCP33131-05-E/MN, however the analogue supply voltage ranges are incompatible!

Microchip MCP33131-05-E/MN

ParameterValue
Manf.Microchip
Manf. Part NumMCP33131-05-E/MN
TopologySAR
Resolution16-bit
Speed500ksps
Digital InterfaceSPI
PackageDFN-10-3x3-TP

Suppliers

Footnotes

  1. Tom Kugelstadt (1998, Sep). Switched-Capacitor ADC Analog Input Calculations Application Report. Texas Instruments. Retrieved 2024-02-11, from https://www.ti.com/lit/an/slaa036/slaa036.pdf.

  2. STMicroelectronics (2021, Sep). STM32G491xC/STM32G491xE - Arm® Cortex®-M4 32-bit MCU+FPU, 170 MHz / 213 DMIPS, up to 512 KB Flash, 112 KB SRAM, rich analog, math accelerator [datasheet]. Retrieved 2024-02-12, from https://www.st.com/resource/en/datasheet/stm32g491ke.pdf. 2

  3. STMicroelectronics. STM32G4: ADC sampling and hold capacitor value [forum post]. Retrieved 2024-02-12, from https://community.st.com/t5/stm32-mcus-products/stm32g4-adc-sampling-and-hold-capacitor-value/td-p/145004.

  4. Infineon (2021, Mar). AURIX TriCore TC33xEXT AA MCU Family Datasheet. Retrieved 2024-03-26, from https://www.infineon.com/dgdl/Infineon-TC33xEXT_AA-step_DataSheet-DataSheet-v01_01-EN.pdf?fileId=8ac78c8c82ce566401833cdf75272dba.