Analogue to digital conversion (ADC) is the process of sampling a continuous real-world voltage signal and translating it into a discrete binary number that a microcontroller can process. In a physical circuit, an ADC changes the game by bridging the gap between continuous physical phenomena—like temperature, light, or sound represented as varying voltages—and the discrete logic of microcontrollers, allowing your code to make automated decisions based on real-world inputs.

The Core Mechanism: Sampling and Quantization

To understand how an ADC works without getting bogged down in semiconductor physics, think of measuring a wooden board with a standard tape measure. The board’s true length is continuous and infinitely precise, but your tape measure only has tick marks every 1/16th of an inch. You read the length and round to the nearest tick mark.

This is exactly what an ADC does, broken into two steps:

  • Sampling: This is when you look at the tape measure. The ADC takes a snapshot of the voltage at a specific moment in time, dictated by its sample rate (Samples Per Second, or SPS).
  • Quantization: This is the ruler's tick marks. The ADC maps the sampled voltage to the nearest available digital step, dictated by its resolution (bit-depth).

The difference between the true continuous voltage and the rounded digital step is called quantization error. You can never eliminate it entirely, but you can minimize it by choosing an ADC with finer "tick marks" (higher bit-depth).

The Math That Matters: Resolution and Step Size

When reading a datasheet, the bit-depth tells you how many discrete steps the ADC can divide its reference voltage into. The formula for the step size (also known as the Least Significant Bit, or LSB) is:

Step Size = Reference Voltage / (2^Resolution)

Numeric Example: 10-bit vs. 16-bit on a 5V System

Imagine you are reading a 0-5V sensor using a classic Arduino Uno (ATmega328P) which has a 10-bit ADC.

  • Total steps: 2^10 = 1,024 steps.
  • Step size: 5.0V / 1024 = 4.88 mV per step.
  • If your sensor outputs 2.510V, the ADC cannot see exactly 2.510V. It rounds to the nearest 4.88mV increment (e.g., step 514 = 2.508V).

Now, swap in an external 16-bit ADC like the Texas Instruments ADS1115, still with a 5V reference.

  • Total steps: 2^16 = 65,536 steps.
  • Step size: 5.0V / 65536 = 0.076 mV (76 µV) per step.
  • That same 2.510V signal is now resolved with roughly 64 times more precision.

For context on high-end architecture, the Analog Devices Data Conversion Handbook details how 24-bit ADCs achieve sub-microvolt step sizes, which is mandatory for load cells and precision thermocouples but overkill for a simple potentiometer.

Where You Meet ADC in Practice

You will encounter ADC whenever a microcontroller needs to "feel" the physical world. Common bench and jobsite applications include:

  • Battery Monitoring: Reading a 12V lead-acid or 4S LiPo pack via a resistor voltage divider to calculate State of Charge (SoC).
  • Sensor Interfacing: Reading variable resistors like thermistors (temperature), LDRs (light), or potentiometers (user dials).
  • Current Sensing: Measuring the millivolt output of a shunt resistor or a Hall-effect sensor (like the ACS712) to calculate DC or RMS AC current.
  • Audio Processing: Digitizing microphone signals for DSP (Digital Signal Processing) on platforms like the Raspberry Pi Pico or Teensy.

Common Confusions: Resolution vs. Sample Rate (and PWM)

When specifying an ADC, hobbyists frequently confuse three distinct concepts:

1. Resolution (Bits) vs. Sample Rate (SPS)
Resolution is how precise each reading is. Sample rate is how fast you can take those readings. They are usually inversely related. A 24-bit ADC designed for precision weigh scales might only sample at 80 SPS. Conversely, an 8-bit ADC inside a digital oscilloscope might sample at 1 GSPS (1 billion samples per second) to capture high-frequency transients. Do not buy a 24-bit ADC expecting to digitize high-fidelity audio; it will be too slow.

2. ADC vs. PWM
Pulse Width Modulation (PWM) is often mistakenly called "analogue output." PWM is strictly digital—it outputs a square wave that switches between 0V and VCC. By changing the duty cycle and passing it through a low-pass filter, you can simulate an analogue voltage. ADC is the reverse: taking a true, continuous analogue voltage and turning it into a digital number.

The ESP32 Internal ADC Gotcha: The ESP32 features an internal 12-bit ADC, but as noted in the official Espressif ADC documentation, it is notoriously non-linear near 0V and 3.3V, and suffers from high noise. If you need accurate readings on an ESP32, bypass the internal pins and use an external I2C ADC.

Decision Tree: Picking the Right ADC for Your Build

Use this decision matrix to select the right hardware for your next project. For deeper architectural choices, refer to the Texas Instruments ADC selection guide.

Your Application Required Precision Recommended Architecture Concrete Part Pick
Reading a basic UI potentiometer or push-button threshold Low (8-10 bit) Internal Microcontroller ADC ATmega328P (Arduino Uno) internal 10-bit
Reading 8 channels of slow-moving sensors (e.g., soil moisture) Medium (10-12 bit) External SPI ADC Microchip MCP3008 (~$2.50)
Precision battery voltage, current shunt, or load cell High (16 bit) External I2C Delta-Sigma ADC Texas Instruments ADS1115 (~$5.00)
Audio sampling or vibration analysis Medium/High (16-24 bit) + High SPS I2S Interface or Dedicated Audio ADC PCM1808 (I2S Audio ADC)

Default Recommendation: If you are paralyzed by choice or your internal microcontroller ADC is too noisy, buy an Adafruit ADS1115 breakout board (part number ADA1085, typically $6.50). It provides 16-bit precision, a built-in programmable gain amplifier (PGA), and communicates over I2C, solving 90% of hobbyist precision problems out of the box.

FAQ: Real-World ADC Troubleshooting

Q: My ADC reading is jumping around by 10-20 steps even when the input voltage is steady. How do I fix it?
A: This is high-frequency noise. First, place a 100nF (0.1µF) ceramic capacitor directly between the ADC input pin and ground, as close to the pin as physically possible. This creates a low-pass filter that stabilizes the voltage during the ADC's internal sampling window. Second, ensure your microcontroller and the sensor share a clean, common ground.

Q: Can I read a 12V car battery directly into a 5V Arduino ADC pin?
A: Absolutely not. You will fry the microcontroller's internal clamping diodes and destroy the chip. You must use a voltage divider (e.g., a 10kΩ and 4.7kΩ resistor pair) to scale the 14.4V maximum automotive voltage down to a safe ~4.6V. Remember to account for the resistor tolerance in your code's multiplier.

Q: Why does my 16-bit ADS1115 only seem to give me 15 bits of usable data?
A: The ADS1115 is a differential ADC. When configured in single-ended mode (measuring a single pin against ground), the most significant bit (MSB) is used for the sign (positive/negative). Therefore, a 16-bit chip in single-ended mode yields 15 bits of positive resolution (32,768 steps). To get the full 16 bits, you must measure differentially across two pins, which is rarely needed for basic hobbyist sensor work.