Overview

The PZEM-004T (specifically Version 3.0) is a single-phase AC electrical energy monitoring module manufactured by Peacefair. Designed for safe, non-invasive AC power measurement, it pairs an onboard SD2004/V9881 metering IC with a Current Transformer (CT) coil—either a closed-core or open/split-core transformer—to calculate six electrical parameters: voltage, current, active power, total energy consumption, grid frequency, and power factor.

The module features internal optocouplers that provide galvanic isolation between high-voltage mains AC (80V80\text{V} to 260V260\text{V}) and the low-voltage 5 V TTL UART communication lines. It uses a standard Modbus-RTU serial protocol over UART (9,600 bps), making it widely deployed in ESPHome, Home Assistant, and Arduino whole-house energy monitor builds.

Quick reference

Mains AC voltage range80 V to 260 V AC (50 Hz / 60 Hz)
Max AC current100 A (with 100A external CT coil) or 10 A (internal shunt)
Active power range0 W to 23,000 W (23 kW23\text{ kW})
Energy accumulator0 kWh to 99,999 kWh
InterfaceOptocoupled 5 V TTL UART (9,600 bps, Modbus-RTU)
Measurement accuracyClass 1.0 (±1.0%\pm 1.0\%)
Safety isolationOptocoupler isolation between mains AC and UART header

Terminals & Connection Blocks

High-Voltage Mains Terminals (Screw Terminal Block)

PinSignalDescription
NAC NeutralConnect to mains Neutral wire (80V80\text{V} to 260V260\text{V} AC)
LAC LiveConnect to mains Live wire
CT1Current Transformer (+)Connect to external CT transformer lead 1
CT2Current Transformer (-)Connect to external CT transformer lead 2

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

PinNameTypeDescription
1VCCPowerSupply input for UART optocoupler (+5.0 V DC)
2RXDigital InputUART Receive data pin (connect to MCU TX)
3TXDigital OutputUART Transmit data pin (connect to MCU RX)
4GNDPowerLow-voltage ground reference (0 V)

Specifications

ParameterSymbolMinTypMaxUnitConditions
AC Voltage RangeVACV_{AC}80.0120 / 230260.0V RMS45 Hz–65 Hz
AC Current RangeIACI_{AC}0.01100.0A RMS100A CT transformer
Active Power RangePactiveP_{active}0.023000WResolution 0.1 W
Power Factor RangePFPF0.001.00Resolution 0.01
Grid Frequencyfgridf_{grid}45.050.0 / 60.065.0HzResolution 0.1 Hz
UART Baud RateBaudBaud9600bps8 data bits, 1 stop, no parity
Isolation VoltageVisoV_{iso}2000V ACOptocoupler rating

Modbus-RTU Protocol Overview

The PZEM-004T v3.0 uses Modbus-RTU over 9,600 baud serial. Default Modbus slave address is 0x01 (programmable from 0x01 to 0xF8).

  • Read Input Registers: Send 0x01 0x04 0x00 0x00 0x00 0x0A [CRC16].
  • Response Payload (10 Registers / 20 Bytes):
    • Voltage (2 bytes, /10Volts/10 \to \text{Volts})
    • Current (4 bytes, /1000Amperes/1000 \to \text{Amperes})
    • Power (4 bytes, /10Watts/10 \to \text{Watts})
    • Energy (4 bytes, /1Watt-hours/1 \to \text{Watt-hours})
    • Frequency (2 bytes, /10Hz/10 \to \text{Hz})
    • Power Factor (2 bytes, /100PF/100 \to \text{PF})

Wiring

PZEM-004T PinESP32Arduino (SoftwareSerial)Notes
VCC5V5VPowers the TTL optocouplers
GNDGNDGNDSystem ground
TXGPIO 16 (RX2)Digital D10 (Software RX)5V logic output
RXGPIO 17 (TX2)Digital D11 (Software TX)5V logic input
Warning

High Voltage Safety Hazard:

  • The screw terminal block carries lethal 110V/230V mains AC voltage.
  • Pass only one current-carrying conductor (either Live OR Neutral) through the hole of the Current Transformer (CT) coil. Passing both Live and Neutral through the CT simultaneously cancels the magnetic fields, resulting in 0.00 A current reading.

Example

cpp
#include <PZEM004Tv30.h>

// SoftwareSerial or HardwareSerial (e.g. Serial2 on ESP32)
PZEM004Tv30 pzem(Serial2, 16, 17); // RX=16, TX=17

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

void loop() {
  float voltage = pzem.voltage();
  float current = pzem.current();
  float power   = pzem.power();
  float energy  = pzem.energy();
  float pf      = pzem.pf();

  if (!isnan(voltage)) {
    Serial.print("Voltage: "); Serial.print(voltage); Serial.println(" V");
    Serial.print("Current: "); Serial.print(current); Serial.println(" A");
    Serial.print("Power: ");   Serial.print(power);   Serial.println(" W");
    Serial.print("Energy: ");  Serial.print(energy);  Serial.println(" kWh");
    Serial.print("PF: ");      Serial.println(pf);
  } else {
    Serial.println("Error reading PZEM-004T!");
  }

  delay(2000);
}

Common mistakes

  • Looping both Live and Neutral through the CT coil: Net magnetic flux equals zero; current reads 0.00 A.
  • Conflating v1.0 and v3.0 modules: Legacy PZEM-004T v1.0 used a custom ASCII protocol at 9,600 baud. Version 3.0 uses Modbus-RTU commands. Modern software libraries (ESPHome pzemac) require v3.0.
  • Forgetting VCC supply to 4-pin header: The UART optocouplers are powered from the 4-pin header VCC/GND. Leaving VCC un-powered prevents serial data transmission.

Notes

  • Split-Core vs Solid-Core CT: Split-core CT models feature a snap-open hinge, allowing installation around existing house wiring without disconnecting mains power circuits.

Assets & downloads