Hardware Matrix

Is ZMPT101B AC Voltage Transformer Module Compatible with Home Assistant (ESPHome)?

Verdict Badge
VERDICT: [ COMPATIBLE (MANUAL CONFIG REQUIRED) ]
Protocol: Analog ADC / 3.3V
Bridge Needed: NO
⚡ DANGER: MAINS VOLTAGE PRESENT

This installation carries line voltage capable of causing severe electric shock, injury, or fire. Disconnect power at the breaker before wiring, verify with a non-contact voltage tester, and consult a qualified electrician if you are not confident working with mains circuits. Do not rely on this page as your only reference — confirm terminal assignments against the manufacturer's own documentation.

Electrical Specifications

Always confirm pin assignments against the manufacturer datasheet before wiring.

📖 Source: ZMPT101B transformer datasheet
Power Input5–30V DC module supply; 80–250V AC measured input
GPIO Logic VoltageAnalog output centred on VCC/2 DC offset (LM358)
Current Profile2mA rated input/output current
Ingress ProtectionNone — exposed board, enclosure required

Compatibility Overview

Active single-phase AC voltage transformer module measuring grid AC voltage from 100V to 250V AC.

Wiring ZMPT101B AC Voltage Transformer Module to ESP32

Module pin ESP32 Note
L / N input terminal mains, fused The two-way screw terminal. Everything between it and the transformer sits at mains voltage on an uncovered board. Wire it with the circuit isolated and enclose it before switching on.
VCC 5V Sold as a 5–30V module. Its output sits at half the supply, so from 5V the waveform is centred on 2.5V.
GND GND
OUT GPIO34 ADC1 and input-only; ADC2 pins cannot be read while Wi-Fi is running. From a 5V supply, go through a divider of two equal resistors (10kΩ each) so the peaks stay inside the range the ESP32 ADC reads, then calibrate.

Host pins are the ones the configuration on this page uses. Move a pin here and change it in the YAML — they are documented together so they cannot disagree.

Technical Specification Matrix

Feature / Attribute Specification / Status
Hardware Protocol Analog ADC / 3.3V
Bridge Required NO
Border Router Needed None
Hardware Capabilities & Peripherals
Mains Voltage (V RMS)

Note: these entities come from the ESPHome configuration you flash — each one needs its matching component in that YAML before it appears.

Pairing Complexity Intermediate
Factory Reset Instruction Hold BOOT button for 3s.

Wire, Flash, Adopt, Check

1

Wire it up

Follow the wiring table above. The ESP32 pins there are the ones the configuration uses, so if you move one, change it in both places.

2

Flash the configuration

Create a new device in the ESPHome dashboard (the Home Assistant add-on) and paste the configuration below into it, or save it as emb_esp32_current_zmpt101b.yaml and run esphome run emb_esp32_current_zmpt101b.yaml. The first flash goes over USB. If it is not detected, hold BOOT button for 3s to put it in download mode. Every update after that is over the air.

3

Adopt it in Home Assistant

Settings → Devices & Services. A node on the same network shows up as a discovered ESPHome device within a minute of joining Wi-Fi; choose Configure and enter the API encryption key from your secrets.yaml. If discovery does not find it, add the ESPHome integration by hand with the node's IP address.

4

Check it works

Once calibrated, Mains Voltage agrees with a multimeter at the same socket, and with the input disconnected it falls to near zero at the next update. A value that does not change when the mains is disconnected is OUT on the wrong pin or not connected. A reading that matched at calibration but reads low when the mains runs high is the waveform clipping at the ADC.

ESPHome Configuration

Starting configuration for ZMPT101B AC Voltage Transformer Module on ESP32. Untested on hardware — verify wiring and pins against your own board.

# ESPHome configuration for ZMPT101B AC Voltage Transformer Module
# Host: ESP32. Pin numbers below are host-side defaults — any free
# GPIO will do, and you should change them to match your own wiring.

esphome:
  name: emb_esp32_current_zmpt101b
  friendly_name: "ZMPT101B AC Voltage Transformer Module"

esp32:
  board: esp32dev
  framework:
    type: esp-idf

logger:

api:
  encryption:
    key: !secret api_encryption_key

ota:
  - platform: esphome
    password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

# The ZMPT101B outputs a scaled copy of the mains waveform biased at
# half its supply. ct_clamp measures the RMS of an AC-coupled ADC input,
# which is exactly that. Calibrate: read the raw value with a known mains
# voltage on a meter, then replace the second pair below.
sensor:
  - platform: adc
    pin: GPIO34
    id: mains_raw
    attenuation: 12db
    update_interval: never

  - platform: ct_clamp
    sensor: mains_raw
    name: "Mains Voltage"
    sample_duration: 200ms
    update_interval: 10s
    unit_of_measurement: "V"
    accuracy_decimals: 1
    filters:
      - calibrate_linear:
          - 0.000 -> 0.0
          - 0.850 -> 230.0

Before you flash: the !secret values come from your secrets.yaml, and the GPIO numbers are host-side defaults rather than properties of this part — change them to match how you actually wired it.

What Appears in Home Assistant

Mains Voltage
sensor

RMS volts to one decimal, every 10 seconds, from 200ms of samples — ten whole cycles at 50Hz, twelve at 60Hz. It has V as its unit but no device_class; add device_class: voltage and state_class: measurement if you want long-term statistics.

mains_raw
not an entity

The adc sensor has an id and no name, so it stays internal. Its update_interval is never because ct_clamp pulls samples from it directly.

Known Problems and Fixes

The 230V in the config is a placeholder

calibrate_linear maps a raw RMS of 0.850 to 230V, but the real raw figure depends on the trimmer, the supply and any divider. Measure the mains at the same socket with a multimeter, remove the filters for one flash to see the raw value, and put that into the second pair. The 0 → 0 pair stays.

Set the trimmer once, then leave it

The blue trimmer scales the amplitude of the output, not its centre. Set it so the peaks stay inside the ADC range (with an oscilloscope, if you have one), calibrate, and do not touch it again: any turn changes the gain and the calibration with it. Use a plastic trimming tool and keep your hands away from the input end while the board is live.

Clipping reads low, silently

The ESP32 ADC stops tracking at about 3.1V even at the widest attenuation. Past that the tops of the sine wave flatten and the RMS comes out low while still looking plausible — a sag that is not really there. The divider on OUT is the cheap insurance.

Zero is not quite zero

With the mains off, ADC noise still has an RMS of its own, and the calibration scales it up into a small voltage. If a clean 0 matters for automations, add a lambda filter that returns 0 below a threshold such as 50V.

Volts and amps are not watts

ct_clamp returns one RMS value and nothing else. Pair this with a current clamp and you get volts and amps, but not real power or power factor, which need both waveforms sampled together. For energy, use a metering chip.

Treat the board as live

The transformer is rated for 4kV between its windings, which is what makes the output side safe to wire to an ESP32. The input terminal and the parts between it and the transformer have no cover. Put the module in an enclosure, fuse the feed, use mains-rated cable, and keep low-voltage wiring away from that end of the board.

🛠️ Hardware Correction & Field Contributions

Report a Pinout Error or Submit Tested Code Snippets

Found a pin mapping quirk or built a custom ESPHome YAML driver for ZMPT101B AC Voltage Transformer Module? Submit a pull request or report corrections to our index.

Frequently Asked Questions

Does ZMPT101B AC Voltage Transformer Module work without an internet connection?
100% local AC voltage sampling.
How is ZMPT101B AC Voltage Transformer Module powered and wired to the host board?
5V VCC; OUT=GPIO34 (ADC1) through a 10k/10k divider so the waveform peaks stay inside the ESP32 ADC range.
How does the host board reach Home Assistant (ESPHome)?
Wi-Fi 2.4GHz.

Alternatives

Guides for this part

Related Compatibility Matrix Guides