Skip to content

dynamo1c/energy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”Œ ESP32 + PZEM-016 Energy Meter Reader

This project reads electrical parameters (voltage, current, power, energy, frequency, power factor) from the PZEM-016 Modbus energy meter using an ESP32 over RS-485.

πŸ“Ÿ Hardware Used

  • ESP32 Development Board
  • PZEM-016 Energy Meter
  • RS-485 to TTL converter (e.g., MAX485)
  • Jumper wires
  • Power supply for the ESP32 and PZEM

πŸ”— Wiring

ESP32 Pin MAX485 Pin Description
GPIO 16 RO UART RX (Receive)
GPIO 17 DI UART TX (Transmit)
GPIO 4 DE & RE Data Direction Control (HIGH = TX, LOW = RX)
GND GND Common Ground
3.3V/5V VCC Power (as per module rating)

PZEM-016 is connected to the RS-485 A/B terminals of the MAX485 module.

βš™οΈ Features

  • Sends Modbus RTU query 0x01 0x04 0x00 0x00 0x00 0x0A 0x70 0x0D to the meter.
  • Receives and decodes 25-byte Modbus response.
  • Parses and displays:
    • Voltage (V)
    • Current (A)
    • Active Power (W)
    • Energy (Wh)
    • Frequency (Hz)
    • Power Factor

πŸ› οΈ How It Works

  • The ESP32 sends the query every 5 seconds via UART2.
  • The MAX485 handles the RS-485 communication protocol.
  • The DE/RE pin toggles transmit/receive mode.
  • The incoming Modbus response is parsed and displayed over the serial monitor.

πŸš€ Getting Started

  1. Connect the hardware as per wiring table.
  2. Upload the main.ino sketch using Arduino IDE or PlatformIO.
  3. Open the Serial Monitor at 115200 baud.
  4. Readings will appear every 5 seconds.

πŸ“ Notes

  • Default Modbus address is 0x01.
  • Communication baud rate is 9600.
  • PZEM-016 requires external AC input to function.
  • Be sure DE and RE pins are controlled together.

πŸ“„ License

This project is open-source under the MIT License.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages