Overview

The ZMPT101B module is an active single-phase AC voltage measurement sensor designed to safely step down high-voltage mains AC (100V100\text{V} to 250V250\text{V} RMS) into a low-voltage analog sine wave suitable for microcontroller ADC inputs.

The module incorporates a precision micro current-type voltage transformer (ZMPT101B, 1:1 ratio) that provides galvanic isolation up to 4000V4000\text{V} AC between the mains grid and low-voltage logic circuits. An onboard LM358 operational amplifier circuit adds a VCC2\frac{V_{CC}}{2} DC offset bias (2.5V2.5\text{V} at 5V supply) and amplification potentiometer adjustment, allowing microcontrollers to sample true AC waveforms and compute RMS voltage.

Quick reference

Module supply voltage (VCC)5.0 V DC nominal (4.5 V to 5.5 V)
AC input voltage range0 V to 250 V AC RMS (50 Hz / 60 Hz)
Galvanic isolation rating4000 V AC
Output signalAnalog AC sine wave centered at VCC2\frac{V_{CC}}{2} (2.5V2.5\text{V})
Transformer ratio1000 : 1000 (2 mA2\text{ mA} rated primary/secondary current)
Onboard adjustmentMulti-turn trimmer potentiometer for output gain calibration

Terminals

High-Voltage Mains Terminals (2-pin Screw Terminal)

PinSignalDescription
LAC LiveConnect to mains Live wire (100V100\text{V} to 250V250\text{V} AC)
NAC NeutralConnect to mains Neutral wire

Low-Voltage Control Header (4-pin 0.1" Header)

PinNameTypeDescription
1VCCPowerSupply input (+5.0 V DC)
2OUT / OUT1Analog OutputAnalog AC output voltage centered at 2.5 V
3NC / OUT2UnusedDuplicate ground or unconnected pin
4GNDPowerSystem ground (0 V)

Specifications

ParameterSymbolMinTypMaxUnitConditions
Supply VoltageVCCV_{CC}4.55.05.5VDC
AC Input Voltage RangeVin_ACV_{in\_AC}0230250V RMS50 Hz / 60 Hz mains
Rated Primary CurrentIpriI_{pri}2.02.0mAThrough internal limiting resistor
Rated Secondary CurrentIsecI_{sec}2.02.0mATransformer output
Dielectric StrengthVisoV_{iso}4000V ACIsolation barrier
DC Offset VoltageVoffsetV_{offset}2.42.52.6VVCC=5.0 VV_{CC} = 5.0\text{ V}
Phase Errorϕ\phi20\le 20minAt 50 Hz50\text{ Hz} (2 mA2\text{ mA})
Operating TemperatureToprT_{opr}-4070°CAmbient

Sampling & RMS Calculation

The OUT pin produces an analog sine wave oscillating around 2.5V2.5\text{V}. To calculate true Root-Mean-Square (VRMSV_{RMS}) voltage:

  1. High-Frequency Sampling: Sample the OUT analog pin over 1–2 complete mains cycles (20 ms20\text{ ms} for 50 Hz, 16.6 ms16.6\text{ ms} for 60 Hz), taking at least 100–200 ADC readings.
  2. DC Bias Subtraction: Subtract the DC mid-rail offset (ADCzero512ADC_{zero} \approx 512 for 10-bit ADC at 5V) from each reading: v[i]=ADC[i]ADCzerov[i] = ADC[i] - ADC_{zero}.
  3. Square & Average: Compute the mean of squared samples: Vmean_sq=1Nv[i]2V_{mean\_sq} = \frac{1}{N} \sum v[i]^2.
  4. Scale Factor: Multiply Vmean_sq\sqrt{V_{mean\_sq}} by the calibrated gain constant (KcalK_{cal}):

VRMS=Kcal×1Ni=1N(ADC[i]ADCzero)2V_{RMS} = K_{cal} \times \sqrt{ \frac{1}{N} \sum_{i=1}^{N} \left( ADC[i] - ADC_{zero} \right)^2 }

Wiring

ZMPT101B PinArduino (5V ADC)ESP32 (3.3V ADC)Notes
VCC5V5V (or 3.3V)Powers LM358 op-amp
GNDGNDGNDSystem ground
OUTAnalog Pin A0VP / GPIO36 (ADC1)Use voltage divider on 3.3V ADCs
Warning

High Voltage Safety & ESP32 ADC Warning:

  • The blue screw terminal block connects directly to 230V AC mains. Ensure proper insulating enclosure protection.
  • At 5V supply, peak-to-peak output voltage on OUT can swing from 0.5V0.5\text{V} to 4.5V4.5\text{V}. When connecting to a 3.3V ADC (such as ESP32), adjust the onboard trimmer potentiometer down so peak output voltage does not exceed 3.3V3.3\text{V}, or power the module from 3.3V.

Example

cpp
const int sensorPin = A0;
const float calibrationFactor = 0.525; // Adjust based on multimeter reading

void setup() {
  Serial.begin(9600);
}

void loop() {
  long sumSquare = 0;
  int sampleCount = 0;
  unsigned long startTime = millis();

  // Sample over 200 ms (10 full 50 Hz AC cycles)
  while (millis() - startTime < 200) {
    int raw = analogRead(sensorPin);
    int zeroCentered = raw - 512; // Subtract 2.5V DC offset
    sumSquare += (long)zeroCentered * zeroCentered;
    sampleCount++;
  }

  float meanSquare = (float)sumSquare / sampleCount;
  float rmsADC = sqrt(meanSquare);
  float voltageRMS = rmsADC * calibrationFactor;

  Serial.print("Sampled: "); Serial.print(sampleCount);
  Serial.print(" | AC Voltage: "); Serial.print(voltageRMS); Serial.println(" V RMS");

  delay(1000);
}

Common mistakes

  • Single-sample analogRead(): Taking a single instantaneous sample of an AC sine wave yields random values between 0V and 250V depending on where in the 50 Hz cycle the ADC triggers. Always compute RMS over complete periods.
  • Forgetting potentiometer gain calibration: Fresh ZMPT101B modules ship with uncalibrated potentiometer positions. Use a multimeter to measure mains AC voltage and adjust the blue trimmer resistor until your code matches the multimeter reading.

Notes

  • ZMPT101B vs Resistor Dividers: ZMPT101B provides 4000V4000\text{V} magnetic isolation; direct resistor voltage dividers connect mains AC directly to microcontroller ground, creating severe shock and equipment hazards.

Assets & downloads