An ADC (Analog-to-Digital Converter) is a hardware peripheral that translates continuous analog voltage into discrete digital integers (bits). If you are querying what is adc converter to read a sensor, the direct converted answer depends entirely on your microcontroller's reference voltage and bit-depth. On a standard 5V, 10-bit Arduino Uno, an input of 1.00V converts to a digital value of 205. On a 3.3V, 12-bit ESP32, that exact same 1.00V input converts to 1241.
The universal formula used to substitute your specific values is:
Digital Count = (Vin / Vref) × (2n - 1)
For the ESP32 reading 1.00V: (1.00 / 3.30) × (212 - 1) = 0.303 × 4095 = 1241.
The Core Conversion: Volts to Digital Counts
An ADC does not measure 'voltage' directly; it measures the ratio of the input voltage against a reference voltage, then scales that ratio to its maximum bit depth. The smallest measurable change is called the Least Significant Bit (LSB). On a 5V/10-bit system, 1 LSB equals 4.88 mV. On a 3.3V/12-bit system, 1 LSB equals 0.805 mV.
Below is a conversion table showing how the digital output shifts for a nominal 2.5V input, mapped across a ±20% variance range on a standard 5V, 10-bit AVR microcontroller (like the ATmega328P).
| Analog Input (V_in) | Variance from Nominal | Digital Count (0-1023) | Calculated Voltage |
|---|---|---|---|
| 2.00V | -20% | 409 | 1.997V |
| 2.25V | -10% | 460 | 2.246V |
| 2.50V | 0% (Nominal) | 512 | 2.502V |
| 2.75V | +10% | 563 | 2.750V |
| 3.00V | +20% | 614 | 2.998V |
What Assumptions Fix Your ADC Reading?
The digital number your code receives is only as accurate as the assumptions fixing the conversion. Three primary variables dictate the final value:
Assumption 2: Logic Level Shifts (The 3.3V vs 5V vs Differential Divide).
Just as AC power calculations shift drastically between 120V single-phase, 230V single-phase, and 400V 3-phase, ADC conversions shift based on the architecture's voltage domain:
- 3.3V Systems (ESP32, STM32, Raspberry Pi Pico): Max input is 3.3V. Exceeding this by even 0.2V can permanently damage the silicon. 12-bit resolution yields 4095 max counts.
- 5V Systems (Arduino Uno/Mega, ATtiny): Max input is 5V. 10-bit resolution yields 1023 max counts. Tolerates higher noise floors but offers less granularity.
- Industrial Differential (±10V to ±250V via dividers): Internal microcontroller ADCs cannot read negative voltages or high voltages directly. You must use a differential ADC (like the 16-bit ADS1115) or an isolated amplifier, which shifts the 'zero' point to the middle of the bit range (e.g., 32768 on a 16-bit signed integer).
Assumption 3: Single-Ended vs. Differential. Single-ended measures voltage relative to a common ground. Differential measures the voltage difference between two pins, rejecting common-mode noise. Assuming single-ended when wiring a differential sensor will result in saturated, maxed-out readings.
When Analog-to-Digital Conversion Becomes Meaningless
An ADC will happily return a number even when the underlying physics make that number garbage. The conversion is mathematically valid but practically meaningless under these conditions:
- Source Impedance > 10kΩ (AVR/Arduino): The internal sample-and-hold (S/H) capacitor requires a low-impedance path to charge fully during the acquisition time (typically 1.5 ADC clock cycles). If your sensor (like a high-value thermistor divider) has an output impedance over 10kΩ, the capacitor won't charge, and the ADC will return 'ghost' readings influenced by the previous pin's voltage.
- Raw AC Signals Without DC Bias: Microcontroller ADCs are unipolar (0V to V_ref). If you feed a 12V AC transformer signal directly into an ESP32, the negative half of the sine wave is hard-clipped to 0. You must bias the AC signal to V_ref/2 using a voltage divider and a coupling capacitor.
- Noise Floor Exceeds 1 LSB: If your switching power supply introduces 15mV of ripple, and your 10-bit ADC has an LSB of 4.88mV, the lowest 2 bits of your reading will just be random noise. Averaging 64 samples in software is mandatory here.
Decision Tree: Picking the Right ADC Hardware
Do not default to the internal microcontroller ADC for every project. Use this decision matrix to terminate your hardware selection with a concrete part number.
| Your Application Scenario | Required Resolution & Speed | Concrete Hardware Pick | Interface |
|---|---|---|---|
| Reading slow DC (battery voltage, temperature, light) with high precision on any MCU. | 16-bit, 860 SPS max | Texas Instruments ADS1115 (Includes programmable gain amplifier) | I2C |
| Adding analog inputs to a Raspberry Pi 4/5 (which lacks an internal ADC). | 10-bit, 200 kSPS | Microchip MCP3008 (8-channel multiplexer built-in) | SPI |
| Reading audio envelopes, joystick positions, or rough sensor data on an ESP32. | 12-bit, high sample rate | Internal ESP32 ADC1 (Pins GPIO32-39. Never use ADC2 if WiFi is active) | Internal |
| Measuring mains AC current via a CT sensor with high isolation requirements. | 16-bit, differential, isolated | Texas Instruments AMC1301 (Isolated delta-sigma modulator) | Analog Diff |
Frequently Asked Questions
What is the Nyquist rate and why does it matter for ADCs?
The Nyquist-Shannon sampling theorem states you must sample an analog signal at least twice as fast as its highest frequency component to reconstruct it. If you are digitizing a 1 kHz audio tone, your ADC must sample at >2 kSPS (Samples Per Second). Failing to do so causes aliasing, where high-frequency noise folds back into your data as false low-frequency signals.
Why does my ESP32 ADC read 4095 when the pin is disconnected?
Floating pins act as antennas, picking up 50/60Hz mains hum and electrostatic discharge. The high input impedance of the ESP32's CMOS gates means even micro-ampere leakage currents will charge the internal S/H capacitor to the rail. Always use a 10kΩ pull-down resistor to ground if the sensor might be disconnected.
Can I increase ADC resolution using software?
Yes, through oversampling and decimation. By taking 4 times as many samples as needed and averaging them, you can theoretically gain 1 extra bit of resolution. Taking 16 samples and shifting right by 2 bits yields a 12-bit equivalent reading from a 10-bit Arduino Uno ADC, provided the input signal has at least 1 LSB of natural dither (noise).
For deeper architectural insights, refer to the Texas Instruments ADS1115 Datasheet for precision delta-sigma conversion mechanics, or the Microchip MCP3008 Datasheet for Successive Approximation Register (SAR) implementations. When working with ESP32 variants, always consult the Espressif ESP-IDF ADC Oneshot API documentation to ensure you are mapping the correct GPIO pins to ADC1 channels, as pinouts vary between the WROOM and WROVER modules.






