PZEM-004T v3 AC energy meter (UART) with ESP32
Supply 5 V
Bus GPIO
Measures voltage, current, power, energy, frequency, power factor
Pins and ESP32 wiring
| Pin | Role | ESP32 pin | Notes |
|---|---|---|---|
| 5V | Power | VIN | TTL side supply. Isolated from mains by optocouplers |
| RX | Input (the ESP32 drives it) | D25 | UART: the meter receives data here. Connect to an ESP32 TX pin (9600 baud, Modbus RTU) |
| TX | Output (the part drives it) | D26 | UART: the meter sends here. Idles at the 5 V supply: add a divider before the ESP32 RX pin |
| GND | Ground | GND | |
| L | Not wired to the ESP32 | — | MAINS 230 V! Only a qualified person connects this. Never to the ESP32 |
| N | Not wired to the ESP32 | — | MAINS 230 V! Only a qualified person connects this. Never to the ESP32 |
| CT+ | Not wired to the ESP32 | — | Current transformer lead (100 A version). The measured wire passes through the CT |
| CT- | Not wired to the ESP32 | — | Current transformer lead (100 A version) |
Suggested wiring for the 30-pin ESP32 DevKit, avoiding flash, input-only and strapping pins. BoardPilot checks it for you as you wire.
This module is sold for 5 V. Its outputs may be 5 V: use a level shifter or a voltage divider on ESP32 inputs.
Sources
- Peacefair PZEM-004T V3.0 user manual, Measures voltage 80 to 260 V, current, power, energy, frequency, power factor
- Peacefair PZEM-004T V3.0 user manual, TTL serial 9600 baud, Modbus-RTU; TTL side powered with 5 V
Try it in 3D in BoardPilot
Learn the basics
Lesson: UART, I2C and SPI Lesson: GPIO: pins in and out Lesson: Hardware basics for software developers UART (serial port) Baud rate GPIO Level shifter Logic level (HIGH and LOW)
Related parts
A02YYUW waterproof ultrasonic distance (UART)A3144 hall effect switchAM312 mini PIR motion sensorATGM336H GPS/BeiDou moduleBeitian BN-220 GPS moduleBenewake TF-Luna LiDAR (UART mode)
Part data: CC BY 4.0, free to reuse with credit to BoardPilot.