To convert a 120V RMS AC mains signal into digital counts using a 12-bit ADC (like the Microchip MCP3208) with a 3.3V reference and a 60:1 step-down potential transformer (PT), the positive peak yields 3,505 counts. The exact formula substituted with these values is: Count = ((120V × √2) / 60) / 3.3V × 4095. This calculation assumes a pure sine wave, a fixed 60:1 isolation transformer ratio, and a stable 3.3V ADC voltage reference. If you are building an energy monitor or smart breaker, this baseline number is your starting point for mapping raw ADC reads back to real-world AC voltage.

⚠️ MAINS VOLTAGE SAFETY WARNING: Never use a simple resistive voltage divider to step down AC mains for an ADC. A resistor failure will feed 120V/230V directly into your microcontroller, causing lethal shock and destroying your hardware. Always use an isolated Potential Transformer (PT) like the ZMPT101B or a dedicated isolated hall-effect voltage sensor. De-energize the panel, lock out the breaker, and verify dead with a CAT-III multimeter before wiring any front-end sensors.

The Core Conversion Formula & Neighboring Values

The application of an A/D converter in AC power monitoring relies on mapping the stepped-down analog peak voltage to the ADC's digital resolution. The universal formula for finding the peak digital count is:

Count = ( (V_RMS × √2) / PT_Ratio ) / V_Ref × (2^n - 1)

  • V_RMS: Nominal AC voltage (e.g., 120V)
  • √2 (1.414): Converts RMS to peak voltage (assumes a pure sine wave)
  • PT_Ratio: Step-down ratio of your isolation transformer
  • V_Ref: ADC reference voltage (e.g., 3.3V or 4.096V)
  • n: ADC bit-depth (e.g., 12 for MCP3208, 16 for ADS1115)

Below is the conversion table for a 12-bit ADC (3.3V ref, 60:1 PT) across a ±20% voltage range. Notice the critical failure point at 144V.

Mains RMS VoltagePeak Voltage (Primary)Stepped Peak (60:1)12-Bit ADC CountStatus
96V (-20%)135.7V2.26V2,807Safe
108V (-10%)152.7V2.54V3,155Safe
120V (Nominal)169.7V2.82V3,505Optimal
132V (+10%)186.6V3.11V3,856Safe
144V (+20%)203.6V3.39V4,095 (Clipped)ADC Saturation
Bench Insight: At 144V, the stepped-down peak (3.39V) exceeds the 3.3V reference. The ADC pins at its maximum count of 4,095. Your firmware will read 144V, 150V, and 160V all as exactly 144V. Always design your PT ratio to handle at least a +25% surge without clipping.

Shifting Baselines: 120V vs 230V vs 3-Phase Systems

The assumption that fixes the 3,505 count answer is a 120V nominal, single-phase, pure sine wave. When you change the grid standard or phase topology, the front-end hardware must shift to prevent saturation or aliasing.

120V (US/Japan) vs 230V (EU/UK/AU)

If you apply the exact same 60:1 PT to a 230V RMS European mains supply, the peak primary voltage is 325V. Stepped down by 60, that yields 5.41V. Feeding 5.41V into a 3.3V ADC reference will instantly clip the reading and potentially backfeed voltage into your microcontroller's GPIO, bricking the chip. The fix: For 230V applications, you must shift to a 100:1 or 120:1 PT ratio to keep the peak secondary voltage under 3.0V, leaving headroom for grid surges.

Single-Phase vs 3-Phase

Measuring 3-phase power (e.g., 208V or 400V Wye) requires capturing three distinct sine waves offset by 120°. If you use a single-channel ADC and multiplex between phases, the time delay between reading Phase A and Phase C introduces a phase-shift error, corrupting your Power Factor (PF) and real power (Watts) calculations. For 3-phase, you must shift to a simultaneous sampling ADC (like the TI ADS8688) or use three separate ADCs triggered by a shared hardware SYNC pin.

When This Conversion Becomes Mathematically Meaningless

There are two specific scenarios where converting peak ADC counts back to RMS voltage using the √2 multiplier yields completely invalid data:

  1. Unknown Power Factor & Harmonic Distortion: The √2 peak-to-RMS conversion assumes a perfect sine wave. If you are measuring the output of a TRIAC dimmer, a variable frequency drive (VFD), or a switched-mode power supply, the waveform is chopped or spiked. The peak voltage no longer correlates to the RMS heating value. In these cases, peak-counting is meaningless; you must sample at high speed and calculate True-RMS in firmware by squaring each sample, averaging them, and taking the square root.
  2. Nyquist Violation (Aliasing): If your ADC sampling rate is lower than twice the highest frequency component in your signal, the conversion is garbage. For 60Hz mains, the absolute minimum sampling rate is 120Hz. However, to accurately reconstruct the wave for True-RMS, you need a minimum of 32 to 64 samples per cycle (1,920Hz to 3,840Hz sampling rate). If you sample at 50Hz, you will capture a beat frequency that looks like a slowly drifting DC voltage.

Decision Path: Picking Your ADC and Front-End

Use this decision matrix to select the exact hardware for your AC measurement application.

Condition / RequirementHardware PathResulting Part Number
Basic 120V monitoring, slow logging (1 sample/sec), low budget. 12-bit SPI ADC + Standard PT module MCP3208 + ZMPT101B
High precision, I2C bus, needs programmable gain for 120V/230V auto-ranging. 16-bit I2C ADC with internal PGA + Isolated PT TI ADS1115 + ZMPT101B
True-RMS measurement of distorted waveforms, 3-phase, or revenue-grade metering. Dedicated Metrology IC (handles sampling, RMS, and PF internally) Analog Devices ADE9000
🏆 Default Pick for 90% of Makers: If you are building a home energy monitor on an ESP32 or Raspberry Pi, terminate your decision path at the TI ADS1115 paired with a ZMPT101B module. The ADS1115's 16-bit resolution (yielding ~28,000 counts for 120V peak) provides massive oversampling headroom, and its internal programmable gain amplifier (PGA) lets you switch ranges in software if you move from a 120V US bench to a 230V EU lab.

Frequently Asked Questions

Can I use the ESP32's internal 12-bit ADC for AC mains measurement?
Technically yes, but practically no. The ESP32's internal ADC (SAR architecture) is notoriously non-linear, has a noisy 3.3V rail, and lacks a sample-and-hold circuit fast enough for clean 60Hz AC zero-crossing detection. Always use an external precision ADC like the ADS1115 over I2C for mains voltage.

Why does my ADC read a small voltage when the mains breaker is OFF?
This is capacitive coupling (ghost voltage) from adjacent live wires in the conduit inducing a micro-amp current in your PT primary. Because the ZMPT101B has a high-impedance secondary, the ADC reads this phantom voltage. Place a 10kΩ bleeder resistor across the ADC input terminals to pull ghost voltages to ground.

Where can I find the exact timing and I2C registers for the ADS1115?
Always refer to the manufacturer's silicon datasheet rather than third-party blog posts. The Texas Instruments ADS1115 Datasheet details the configuration register bits for setting the PGA and data rate. For the MCP3208 SPI timing, consult the Microchip MCP3208 Product Page and its associated datasheet.