The PZEM004t is a digital power meter designed for monitoring and measuring key electrical parameters in AC circuits. It provides real-time data on voltage, current, power, energy consumption, and frequency. This module is widely used in applications requiring precise energy monitoring, such as home automation, industrial equipment monitoring, and IoT-based energy management systems. Its built-in serial communication interface allows seamless integration with microcontrollers like Arduino, Raspberry Pi, and other embedded systems.
The PZEM004t is a compact and efficient 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 Interface | TTL Serial (3.3V/5V compatible) |
Baud Rate | 9600 bps |
Accuracy | ±0.5% |
Operating Temperature | -10°C to 60°C |
Dimensions | 70mm x 40mm x 20mm |
The PZEM004t module has a simple pinout for easy integration:
Pin Name | Description |
---|---|
VCC | Power supply input (5V DC) |
GND | Ground connection |
TX | Transmit pin for serial communication (connects to RX of microcontroller) |
RX | Receive pin for serial communication (connects to TX of microcontroller) |
AC IN+ | Live wire input for AC voltage measurement |
AC IN- | Neutral wire input for AC voltage measurement |
CT+ | Positive terminal for the current transformer (CT) |
CT- | Negative terminal for the current transformer (CT) |
Below is an example code to interface the PZEM004t with an Arduino UNO:
#include <PZEM004T.h> // Include the PZEM004T library
// Define the RX and TX pins for communication
#define RX_PIN 10
#define TX_PIN 11
// Create a PZEM004T object
PZEM004T pzem(RX_PIN, TX_PIN);
void setup() {
Serial.begin(9600); // Initialize serial communication for debugging
Serial.println("PZEM004t Power Meter Example");
}
void loop() {
// Read voltage
float voltage = pzem.voltage();
if (voltage < 0) {
Serial.println("Error reading voltage");
} else {
Serial.print("Voltage: ");
Serial.print(voltage);
Serial.println(" V");
}
// Read current
float current = pzem.current();
if (current < 0) {
Serial.println("Error reading current");
} else {
Serial.print("Current: ");
Serial.print(current);
Serial.println(" A");
}
// Read power
float power = pzem.power();
if (power < 0) {
Serial.println("Error reading power");
} else {
Serial.print("Power: ");
Serial.print(power);
Serial.println(" W");
}
// Read energy
float energy = pzem.energy();
if (energy < 0) {
Serial.println("Error reading energy");
} else {
Serial.print("Energy: ");
Serial.print(energy);
Serial.println(" kWh");
}
// Wait for 1 second before the next reading
delay(1000);
}
No Data Received from the Module:
Incorrect Readings:
Module Not Responding:
Q1: Can the PZEM004t measure DC circuits?
No, the PZEM004t is designed specifically for AC circuits and cannot measure DC voltage or current.
Q2: Can I use the PZEM004t with a 3.3V microcontroller?
Yes, the PZEM004t's serial communication interface is compatible with both 3.3V and 5V logic levels.
Q3: How do I reset the energy reading to zero?
The energy reading can be reset using a specific command sent via the serial interface. Refer to the module's datasheet or library documentation for details.
Q4: What is the maximum distance between the module and the current transformer?
The current transformer should be placed as close as possible to the module to ensure accurate readings. Long distances may introduce noise and reduce accuracy.