For a standard 12-bit analogue to digital converter circuit (like the internal SAR ADC on an ESP32-WROOM-32) with a 3.3V reference voltage, an analog input of 1.65V converts to a digital value of 2048. The formula used is Digital Value = (V_in / V_ref) × (2^n - 1). Substituting our exact values: (1.65 / 3.3) × (2^12 - 1) = 0.5 × 4095 = 2047.5, which the microcontroller's floor function rounds to 2048. This direct voltage-to-bit conversion is the foundational math for any sensor interfacing project, fixing the relationship between real-world physics and microcontroller logic.

Hardware Assumptions: Reference Voltage vs. Mains Power

In an analogue to digital converter circuit, the assumption that fixes the answer is the Reference Voltage (V_ref) and the bit resolution (n). If your V_ref drifts due to a poor voltage regulator, your digital output will be proportionally wrong, regardless of how stable your input signal is.

It is critical to contrast this with AC power calculations. When calculating real power (Watts) from apparent power (VA), the conversion is entirely meaningless if the power factor (pf) is unknown. However, in DC signal ADC conversion, phase angle and power factor are irrelevant; the ADC only measures instantaneous DC magnitude.

That said, an ADC conversion does become meaningless in two specific hardware scenarios:

  • Saturation (Clipping): When the input signal exceeds V_ref (e.g., feeding 4.0V into a 3.3V ADC pin). The ADC will simply return the maximum bit value (4095) and you lose all data about the actual over-voltage magnitude.
  • Aliasing: When measuring an AC waveform without satisfying the Nyquist-Shannon sampling theorem. If your input signal frequency exceeds half of your ADC sampling rate, the digital output will reflect a false, lower-frequency waveform. According to Analog Devices, an anti-aliasing analog low-pass filter must be placed before the ADC pin to prevent this.

ADC Resolution Reference Table (±20% Input Range)

When designing sensor biasing networks, you rarely hit the exact midpoint. Below is a spec-sheet-table showing how the digital output shifts across a ±20% range of our 1.65V baseline, assuming a 12-bit resolution and a strict 3.3V V_ref. This is highly useful for setting software thresholds in comparator logic.

Analog Input (V_in) Deviation from Baseline Calculated Raw Value Microcontroller Integer Output
1.320V -20% 1638.0 1638
1.485V -10% 1842.75 1842
1.650V Baseline (0%) 2047.5 2048
1.815V +10% 2252.25 2252
1.980V +20% 2457.0 2457

Note: Always consult your specific microcontroller's datasheet. The Espressif ESP32 Technical Reference Manual notes that internal ADCs can exhibit non-linearity at the extreme top and bottom of the voltage range, meaning a 10-bit or 12-bit reading near 0V or 3.3V may require software calibration offsets.

Mains AC Sampling: 120V, 230V, and 3-Phase Shifts

A common point of confusion for beginners is how the conversion shifts when moving from low-voltage DC sensors to mains AC monitoring. You never feed 120V or 230V AC directly into an ADC pin; doing so will instantly destroy the silicon and pose a lethal shock hazard.

To measure mains, your analogue to digital converter circuit must include a step-down isolation transformer (like the ZMPT101B voltage transformer module) or an isolated Hall-effect sensor. Here is how the math and hardware shift across different mains standards:

  • 120V Nominal (North America): The peak voltage is roughly 170V. Your voltage divider or transformer ratio must be tuned to map this 170V peak down to a maximum of 3.3V (or 1.65V if you are biasing the AC waveform around a 1.65V DC offset to read the negative half-cycles).
  • 230V Nominal (EU/UK/AU): The peak voltage is roughly 325V. The step-down ratio in your circuit must be nearly doubled compared to the 120V setup to ensure the peak voltage does not exceed the ADC's V_ref limit.
  • 3-Phase Industrial: The conversion shifts from a single-channel RMS calculation to a 3-channel simultaneous sampling requirement. You must use a microcontroller with at least three dedicated, simultaneous-sampling ADC pins. The software must then calculate the 120-degree phase shift between the three waveforms to determine true 3-phase power, making single-channel internal ADCs entirely inadequate for this task.

Frequently Asked Questions

How do I wire an analogue to digital converter circuit for a 4-20mA industrial sensor?

Microcontrollers read voltage, not current. To interface a 4-20mA current loop, you must use a precision shunt resistor to convert the current into a voltage. For a 5V ADC system, a standard 250-ohm resistor yields a 1V to 5V signal. However, if you are using a modern 3.3V ESP32 or Raspberry Pi Pico, a 250-ohm resistor will over-voltage the pin at 20mA (5V). Instead, use a 150-ohm precision shunt resistor to yield a safe 0.6V to 3.0V signal, keeping you safely within the 3.3V V_ref limit while maximizing resolution.

Why is my ESP32 analogue to digital converter circuit reading non-linear values?

The internal SAR ADC on older ESP32-WROOM modules (specifically ADC1 and ADC2) is notoriously non-linear at the extreme top (above 3.1V) and bottom (below 0.15V) of the measurement range. If your sensor outputs 0-3.3V, you will notice "stair-stepping" or stuck values at the extremes. To fix this, either design a voltage divider to scale your maximum sensor output down to 3.0V, or bypass the internal ADC entirely and use an external I2C ADC module like the Texas Instruments ADS1115, which provides true 16-bit linearity and a programmable gain amplifier.

What is the maximum sampling rate required for an audio analogue to digital converter circuit?

For standard audio capture, you must sample at a minimum of 44.1 kHz to satisfy the Nyquist-Shannon theorem for the upper limit of human hearing (20 kHz). However, you should not use a microcontroller's general-purpose ADC pins for this. Audio requires high-speed, continuous, jitter-free sampling. Instead, use a dedicated I2S interface ADC chip (like the PCM1808 or INMP441 MEMS microphone), which handles the analog-to-digital conversion internally and streams the digital bits directly into the microcontroller's I2S peripheral via DMA, bypassing the CPU entirely.