Arduino B.Tech/Diploma Beginner

DIY AC Energy Meter using PZEM-004T & Arduino

Interfacing Arduino with PZEM-004T Multifunction AC Meter to make Energy Meter like Voltage, Current, Power, Energy, Power Factor & Frequency

  • Suitable forB.Tech/Diploma Arduino students
  • Build time1-2 weeks
  • LevelBeginner
  • Available atAjvika Labs, Kakinada

About this project

Overview
In this project, we will interface
PZEM-004T
(a compact AC power monitoring module) with
Arduino
to build a single phase AC Energy Meter. PZEM-004T Current and Voltage reader is a module that can measure
current
voltage
active power (W)
, energy (kWh), frequency, and power factor. The module
uses Modbus-RTU
, a standard protocol for industrial communication.
Microcontrollers
such as Arduino can read PZEM-004T data via
serial
interfaces.
Earlier, we build the following energy meter projects:
GSM-Based Prepaid Energy Meter
IoT DC Energy Meter using INA226 & ESP32
IoT AC Energy Meter with ESP32 & Blynk
Energy Meter using ESP32 & HMI Display
While the
projects
mentioned above are excellent for learning
energy monitoring
concepts and well-suited for hobbyist applications, their accuracy is limited due to the use of basic components like the
ZMPT101B voltage sensor
and
SCT-013 current sensor
. These modules are not precision instruments, and their measurements may exhibit noticeable deviations.
Hence we need a
precise Energy Meter
that can measure all parameters correctly. The
PZEM-004T
is used for the same applications. In this energy meter project, we will establish a serial communication between PZEM-004T & Arduino, and read the data such as
Voltage, Current, Power, Energy, Power Facto
r &
Frequency
. All these data can be displayed on
16×2 LCD
Display. Further you can make the IoT version of this project using the
PZEM-004T and ESP32
microcontroller.
Bill of Materials
We need the following components to build this energy meter project. You can purchase all the components from the given links.
S.N.
Components Name
Quantity
Purchase Link

Arduino Nano Board

Amazon
AliExpress

PZEM-004T AC Meter Module

Amazon
AliExpress

16x2 LCD Display

Amazon
AliExpress

Connecting Wires

Amazon
AliExpress

Breadboard

Amazon
AliExpress
Fig: Components & Tools Required
PZEM-004T Multifunction AC Digital Meter
The
PZEM-004T
is a compact,
single-phase AC power
monitoring module designed to measure electrical parameters such as
voltage
(80–260V),
current
(up to 100A via external CT), active
power
energy
consumption (kWh),
frequency
, and
power factor
Fig: PZEM-004T V3.0
It communicates via
Modbus-RTU protocol
over TTL serial (), making it easy to interface with microcontrollers like
Arduino
or
ESP32
. With built-in galvanic isolation and a
non-invasive current transformer
, it prioritizes safety. It is widely used in IoT applications, smart metering, and home automation projects.
PZEM-004T V3.0 Feature
Voltage:
80–260V, 0.1V resolution, 0.5% accuracy
Current:
0–10A (10A model), 0–100A (100A model), 0.001A resolution, 0.5% accuracy
Active Power:
0–2.3kW (10A model), 0–23kW (100A model), 0.1W resolution, 0.5% accuracy
Power Factor:
0.00–1.00, 0.01 resolution, 1% accuracy
Frequency:
45–65Hz, 0.1Hz resolution, 0.5% accuracy
Active Energy:
0–9999.99kWh, 1Wh resolution, 0.5% accuracy, resettable via software
Over Power Alarm:
Settable threshold, triggers alarm on exceedance
Communication:
RS485 (UART to RS485), 9600 baud, 8N1
Open CT & Close CT
Both
Close CT
and
Open CT
are 100A current transformers (Class 1.5 accuracy) compatible with the PZEM-004T module.
Fig: PZEM-004T Open CT & Close CT
The
Closed Current Transformer (CT) version
of the PZEM-004T comes with a built-in, non-detachable CT, ensuring accurate and stable measurements. It is ideal for fixed installations where the sensor remains permanently connected to the measured circuit.
The
Open Current Transformer (CT) version
features a detachable clamp-type CT, allowing easy installation without disconnecting wires. This is useful for retrofitting or temporary monitoring applications where quick and flexible deployment is required.
Pinout of PZEM-004T V3.0
The
PZEM-004T
is an energy monitoring module that communicates via
UART (RS485)
and has the following pin configuration:
1. Power & Measurement Pins:
L (Live) & N (Neutral):
Connect to AC mains for voltage measurement and module power.
CT+ & CT-:
Connect to the current transformer (CT) for current measurement.
2. Communication Pins (TTL Serial or RS485):
5V:
Power supply for the module (external 5V required).
GND:
Ground reference for communication.
TX (Transmit):
Sends data to the microcontroller.
RX (Receive):
Receives data from the microcontroller.
Module TTL Interface Note:
This module’s TTL interface is
passive
and requires an external
5V power supply
. All four pins (5V, RX, TX, GND) must be connected for proper communication. Operating temperature range:
-20°C to +60°C
Communication Protocol of PZEM-004T V3.0
1. Physical Layer Protocol
Uses
UART to RS485
communication interface
Baud rate:
9600
8 data bits
1 stop bit
no parity
2. Application Layer Protocol
Uses
Modbus-RTU
protocol
Supported function codes:
0x03
(Read Holding Register)
0x04
(Read Input Register)
0x06
(Write Single Register)
0x41
(Calibration – internal use only, requires password 0x3721)
0x42
(Reset Energy)
3. Addressing
Slave address range:
0x01 – 0xF7
0x00
: Broadcast address (slave does not reply)
0xF8
: General address (for single-slave environments and calibration)
4. Reading Measurement Results
Master command format (8 bytes):
Slave Address + 0x04 + Register Address (High + Low) + No. of Registers (High + Low) + CRC (High + Low)
Correct Reply:
Slave Address + 0x04 + No. of Bytes + Register Data + CRC
Error Reply:
Slave Address + 0x84 + Error Code + CRC
0x01
: Illegal function
0x02
: Illegal address
0x03
: Illegal data
0x04
: Slave error
5. Register Mapping
Register Address
Description
Resolution
0x0000
Voltage
0.1V
0x0001-0x0002
Current (Low & High)
0.001A
0x0003-0x0004
Power (Low & High)
0.1W
0x0005-0x0006
Energy (Low & High)
1Wh
0x0007
Frequency
0.1Hz
0x0008
Power factor
0.01
0x0009
Alarm status (0xFFFF = Alarm, 0x0000 = No Alarm)
For example, to read
10 registers from slave address 0x01
, the master sends:
0x01 + 0x04 + 0x00 + 0x00 + 0x00 + 0x0A + CRC
Indicator Lights of PZEM-004T V3.0
The module has multiple LEDs to indicate power, pulse, and communication status:
Fig: Indicator Lights of PZEM-004T V3.0
Power Indicator Light:
Shows that the module is powered and operational.
Pulse Indicator Light:
It b
links based on active energy measurement. The h
igher blinking rate indicates higher power consumption.
TX Communication Light:
Blinks when the module transmits data via RS485.
RX Communication Light:
Blinks when the module receives data from the master device (e.g., Arduino, ESP32).
Refer to
PZEM-004T Datasheet
for more information.
Interfacing PZEM-004T Energy Meter Module with Arduino
Now let us interface the PZEM-004T Energy Meter Module with Arduino. The interfacing process is easy and requires some hardware connection and Arduino C++ Code.
Circuit Diagram & Connection
The following is the connection diagram which looks very simple.
Fig: Interfacing PZEM-004T Energy Meter Module with Arduino
Connect the PZEM-004T’s
5V
and
GND
to Arduino’s 5V and GND for power. Link
TX
(PZEM) →
RX
(Arduino pin 10) and
RX
(PZEM) →
TX
(Arduino pin 11) for serial communication.
Fig: PZEM-004T Arduino Connection
Connect the circuit on breadboard as per circuit diagram above.
Wire the
live (L)
and
neutral (N)
of your AC supply (120V/220V) to the PZEM’s
AC input terminals
(labeled “L” and “N”).
Fig: Current Transformer Connection
For Open CT (split-core): Clamp the CT around the live wire of the AC circuit you want to monitor (do NOT clamp neutral).
For Close CT (solid-core): Disconnect the circuit, thread the live wire through the CT’s core, and reconnect.
Caution
:
Isolate AC input (120/220V) wiring from Arduino circuits for safety.
Source Code/Program
Lets write an
Arduino C++ Code
to establish a
Serial Communication
between Arduino & PZEM-004T Energy Meter Module.
Before moving to the coding part, first install the
PZEM-004T Arduino Library
. The library is well written and does the
E

Technologies used

ESP32ArduinoBlynkBLEGSMLCDINA226PZEM-004TUARTADCC++

Hardware components

  • ESP32
  • Arduino
  • INA226
  • PZEM-004T

Software & tools

  • Blynk

What you get

  • Working project / hardware kit, tested before delivery
  • Complete source code with explanation
  • Project demo and guidance for your viva
  • Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed. Payment is in two parts: • 50% advance to start the project • Remaining 50% before delivery Note: • Documentation and PPT are not included by default • If you need documentation/PPT, it can be arranged for extra time and cost We'll confirm the exact timeline and cost with you after reviewing your requirements.