Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use PZEM004t: Examples, Pinouts, and Specs

Image of PZEM004tDesign with PZEM004t in Cirkit Designer

Introduction

The PZEM004t is a digital power meter designed for measuring key electrical parameters in AC circuits, including voltage, current, power, energy, and frequency. It is widely used in applications requiring real-time monitoring and data logging, such as home automation, industrial equipment monitoring, and energy management systems. The module features a built-in display for standalone operation and supports UART communication, making it easy to interface with microcontrollers like Arduino or Raspberry Pi for advanced data analysis.

Explore Projects Built with PZEM004t

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of ESP32-Controlled AC Lighting System with Power Monitoring: A project utilizing PZEM004t in a practical application
ESP32-Controlled AC Lighting System with Power Monitoring

This circuit features an ESP32 microcontroller interfaced with a PZEM004T power monitoring module and a 4-channel relay module controlling multiple AC LED bulbs. The ESP32 uses GPIO pins to control the relays, which in turn switch the LED bulbs on and off. The PZEM004T is connected to the ESP32 for communication and to a current sensor for monitoring power consumption of the connected load through the relay contacts.

Open Project in Cirkit Designer
Image of ESP32-Based Smart Power Monitoring and Control System with Wi-Fi Connectivity: A project utilizing PZEM004t in a practical application
ESP32-Based Smart Power Monitoring and Control System with Wi-Fi Connectivity

This circuit is a smart power monitoring and control system using an ESP32 microcontroller. It features multiple sensors and components, including PZEM-004T AC modules for voltage and current measurement, DS18B20 temperature sensors, an LCD for display, and solid-state relays for controlling power outlets. The system is integrated with Blynk for remote monitoring and control, and includes pushbuttons for local interaction.

Open Project in Cirkit Designer

Technical Specifications

The PZEM004t is a versatile and compact module with the following key specifications:

Parameter Value
Voltage Range 80V - 260V AC
Current Range 0A - 100A (with external current transformer)
Power Range 0W - 22kW
Energy Range 0kWh - 9999kWh
Frequency Range 45Hz - 65Hz
Communication Protocol UART (9600 baud rate)
Power Supply Self-powered from AC input
Accuracy ±0.5%

Pin Configuration

The PZEM004t module has a 4-pin interface for UART communication and power connections. The pinout is as follows:

Pin Name Description
1 VCC Power supply for UART interface (3.3V or 5V)
2 GND Ground connection
3 RX UART Receive pin (connect to TX of microcontroller)
4 TX UART Transmit pin (connect to RX of microcontroller)

Usage Instructions

Connecting the PZEM004t

  1. Power Supply: The PZEM004t is self-powered from the AC input, so no external power supply is needed for its operation. However, the UART interface requires a 3.3V or 5V power source, which can be provided by the microcontroller.
  2. Wiring:
    • Connect the AC live and neutral wires to the input terminals of the PZEM004t.
    • Pass the load's live wire through the external current transformer (CT) provided with the module.
    • Connect the UART pins (VCC, GND, RX, TX) to the corresponding pins on the microcontroller.

Interfacing with Arduino UNO

The PZEM004t can be easily interfaced with an Arduino UNO using the SoftwareSerial library. Below is an example code to read data from the module:

#include <SoftwareSerial.h>

// Define RX and TX pins for SoftwareSerial
SoftwareSerial pzemSerial(10, 11); // RX = pin 10, TX = pin 11

// Include the PZEM004t library
#include <PZEM004Tv30.h>

// Initialize the PZEM004t object
PZEM004Tv30 pzem(&pzemSerial);

void setup() {
  Serial.begin(9600); // Start the serial monitor
  pzemSerial.begin(9600); // Start communication with PZEM004t
  Serial.println("PZEM004t Power Meter Example");
}

void loop() {
  // Read voltage
  float voltage = pzem.voltage();
  if (!isnan(voltage)) {
    Serial.print("Voltage: ");
    Serial.print(voltage);
    Serial.println(" V");
  } else {
    Serial.println("Error reading voltage!");
  }

  // Read current
  float current = pzem.current();
  if (!isnan(current)) {
    Serial.print("Current: ");
    Serial.print(current);
    Serial.println(" A");
  } else {
    Serial.println("Error reading current!");
  }

  // Read power
  float power = pzem.power();
  if (!isnan(power)) {
    Serial.print("Power: ");
    Serial.print(power);
    Serial.println(" W");
  } else {
    Serial.println("Error reading power!");
  }

  // Read energy
  float energy = pzem.energy();
  if (!isnan(energy)) {
    Serial.print("Energy: ");
    Serial.print(energy);
    Serial.println(" kWh");
  } else {
    Serial.println("Error reading energy!");
  }

  // Wait for 1 second before the next reading
  delay(1000);
}

Important Considerations

Troubleshooting and FAQs

Common Issues

  1. No Data Output:

    • Ensure the UART connections (RX, TX, VCC, GND) are correct.
    • Verify that the baud rate is set to 9600 in the code.
    • Check if the current transformer is properly connected.
  2. Incorrect Readings:

    • Ensure the load's live wire passes through the current transformer.
    • Verify that the AC input voltage is within the specified range (80V - 260V AC).
  3. Module Not Powering On:

    • Check the AC input connections for proper wiring.
    • Ensure the AC voltage is within the operating range.

FAQs

Q: Can the PZEM004t measure DC circuits?
A: No, the PZEM004t is designed specifically for AC circuits and cannot measure DC voltage or current.

Q: Can I use the PZEM004t with a Raspberry Pi?
A: Yes, the PZEM004t can be interfaced with a Raspberry Pi using its UART pins. Ensure proper voltage level shifting if required.

Q: How do I reset the energy reading to zero?
A: The PZEM004t library provides a function to reset the energy reading. Refer to the library documentation for details.

Q: What is the maximum distance for UART communication?
A: The maximum distance depends on the quality of the wiring and the environment, but it is generally recommended to keep the distance under 10 meters for reliable communication.