Component guide · Advanced · 3 min read
PZEM-004T AC Energy Meter Module with ESP32
By Geekobot Learning Team · Updated 24 Oct 2026
On this page
The PZEM-004T is a mains energy meter module that measures AC voltage, current, power, energy, frequency and power factor. It connects to 230 V for voltage sensing, uses a current transformer clamped around one wire (100 A version), and sends readings over an isolated TTL serial link using Modbus. An ESP32 can read it and send data to Home Assistant. Only people competent with mains wiring should install it.
Key specs at a glance
- Voltage
- About 80 to 260 V AC
- Current
- 0 to 10 A (internal shunt) or 0 to 100 A (split-core CT)
- Measures
- V, A, W, kWh, Hz, power factor
- Interface
- TTL UART, Modbus-RTU, 9600 baud
- Isolation
- Serial side optically isolated from mains
- Software
- PZEM004Tv30 Arduino library; ESPHome pzemac
Wiring
live and neutral to the voltage terminals through a fuse; the CT clamps around the live wire only (not both wires) of the circuit you measure. Everything must be in an enclosure.
5 V, GND, TX and RX to a UART on your board (crossed over). Version 3.0 modules talk Modbus; many work with 3.3 V boards, but check your module's version and add level shifting if readings fail.
Several PZEMs can share one serial bus if each is given a different Modbus address first.
Reading it
With the PZEM004Tv30 library on an ESP32: create PZEM004Tv30 pzem(Serial2, 16, 17); then read pzem.voltage(), pzem.current(), pzem.power(), pzem.energy() and pzem.pf(). NaN means no response: check wiring and that the mains side is powered, since the module needs mains voltage to answer. In ESPHome, the pzemac sensor publishes all values to Home Assistant over MQTT or the API.
Safety
Mains voltage is lethal. Switch off at the breaker before working, use a fused connection and proper enclosure, never touch the module or CT terminals while live, and keep low-voltage wiring separate. In many places, work on fixed household wiring must be done by a licensed electrician. A plug-in smart plug with energy metering is a safer alternative for single appliances.
Try it: Energy cost calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Clamping the CT around both live and neutral (reads zero).
- Leaving mains terminals exposed.
- No fuse on the voltage sensing wires.
- Expecting readings with mains disconnected.
- Using two modules on one bus without changing addresses.
Frequently asked questions
Why does my PZEM-004T return NaN?
It is not responding. Check TX/RX crossover, power, the baud rate and that mains is connected to the voltage input.
Can the PZEM-004T measure DC?
No. Use the PZEM-017 or an INA226 for DC.
Does it work with ESP32 and Home Assistant?
Yes, with the Arduino library or ESPHome's pzemac component.
Where do I clamp the current transformer?
Around the live wire only of the circuit you want to measure.
Is it accurate?
Typically within about 0.5 to 1% for voltage and power under normal conditions; check the module's datasheet.
Parts for this guide
- ₹569View
Calculators
Terms in this guide
Keep learning
Sources
- Peacefair PZEM-004T V3.0 user manual
- PZEM004Tv30 library documentation
- ESPHome PZEM AC component documentation
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

