All Projects → olehs → Pzem004t

olehs / Pzem004t

Licence: mit
Arduino communication library for Peacefair PZEM-004T Energy monitor

Projects that are alternatives of or similar to Pzem004t

Arduino Applemidi Library
Send and receive MIDI messages over Ethernet (rtpMIDI or AppleMIDI)
Stars: ✭ 177 (+7.27%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Dsckeybusinterface
An Arduino/esp8266/esp32 library to directly interface with DSC security systems.
Stars: ✭ 202 (+22.42%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Espmqttclient
Wifi and MQTT handling for ESP8266 and ESP32
Stars: ✭ 169 (+2.42%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Tft espi
Arduino and PlatformIO IDE compatible TFT library optimised for the STM32, ESP8266 and ESP32 that supports different driver chips
Stars: ✭ 1,215 (+636.36%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Guislice
GUIslice drag & drop embedded GUI in C for touchscreen TFT on Arduino, Raspberry Pi, ARM, ESP8266 / ESP32 / M5stack using Adafruit-GFX / TFT_eSPI / UTFT / SDL
Stars: ✭ 534 (+223.64%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Aunit
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test. Used with AUniter or EpoxyDuino for continuous builds.
Stars: ✭ 73 (-55.76%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Easybutton
Arduino library for debouncing momentary contact switches, detect press, release, long press and sequences with event definitions and callbacks.
Stars: ✭ 187 (+13.33%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Arduinowebsockets
A library for writing modern websockets applications with Arduino (ESP8266 and ESP32)
Stars: ✭ 213 (+29.09%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Espui
A simple web user interface library for ESP32 and ESP8266
Stars: ✭ 330 (+100%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Ssd1306
Driver for SSD1306, SSD1331, SSD1351, IL9163, ILI9341, ST7735, PCD8544, Nokia 5110 displays running on Arduino/ESP32/Linux (Rasperry) platforms
Stars: ✭ 303 (+83.64%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Arduinojson
📟 JSON library for Arduino and embedded C++. Simple and efficient.
Stars: ✭ 5,456 (+3206.67%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Arduino Homekit Esp8266
Native Apple HomeKit accessory implementation for the ESP8266 Arduino core.
Stars: ✭ 545 (+230.3%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Irremoteesp8266
Infrared remote library for ESP8266/ESP32: send and receive infrared signals with multiple protocols. Based on: https://github.com/shirriff/Arduino-IRremote/
Stars: ✭ 1,964 (+1090.3%)
Mutual labels:  arduino, esp32, arduino-library, esp8266
Tinygsm
A small Arduino library for GSM modules, that just works
Stars: ✭ 1,186 (+618.79%)
Mutual labels:  arduino, esp32, esp8266
Wifiespnow
ESP-NOW Arduino library for ESP8266 and ESP32
Stars: ✭ 90 (-45.45%)
Mutual labels:  esp32, arduino-library, esp8266
Pagebuilder
An arduino library to create html string in the sketch for ESP8266/ESP32 WebServer.
Stars: ✭ 104 (-36.97%)
Mutual labels:  esp32, arduino-library, esp8266
App Release
An IoT Solution,this is the android release app | download ios app in app store
Stars: ✭ 104 (-36.97%)
Mutual labels:  arduino, esp32, esp8266
Esp8266 Oled Ssd1306
Driver for the SSD1306 and SH1106 based 128x64, 128x32, 64x48 pixel OLED display running on ESP8266/ESP32
Stars: ✭ 1,590 (+863.64%)
Mutual labels:  arduino, esp32, esp8266
Arduinoosc
OSC subscriber / publisher for Arduino
Stars: ✭ 106 (-35.76%)
Mutual labels:  arduino, esp32, esp8266
Button2
Arduino Library to simplify working with buttons. It allows you to use callback functions to track single, double, triple and long clicks. It also takes care of debouncing.
Stars: ✭ 109 (-33.94%)
Mutual labels:  arduino, arduino-library, esp8266

PZEM004T

Arduino communication library for Peacefair PZEM-004T Energy monitor

Serial communication
This module is equipped with TTL serial data communication interface, you can read and set the relevant parameters via the serial port; but if you want to communicate with a device which has USB or RS232 (such as computer), you need to be equipped with different TTL pin board (USB communication needs to be equipped with TTL to USB pin board; RS232 communication needs to be equipped with TTL to RS232 pin board), the specific connection type as shown in Figure 2. In the below table are the communication protocols of this module:

No Function Head Data1- Data5 Sum
1a Voltage Req B0 C0 A8 01 01 00 (Computer sends a request to read the voltage value) 1A
1b Voltage Resp A0 00 E6 02 00 00 (Meter reply the voltage value is 230.2V) 88
2a Current Req B1 C0 A8 01 01 00 (Computer sends a request to read the current value) 1B
2b Current Resp A1 00 11 20 00 00 (Meter reply the current value is 17.32A) D2
3a Active power Req B2 C0 A8 01 01 00 (Computer sends a request to read the active power value) 1C
3b Active power Resp A2 08 98 00 00 00 (Meter reply the active power value is 2200w) 42
4a Read energy Req B3 C0 A8 01 01 00 (Computer sends a request to read the energy value) 1D
4b Read energy Resp A3 01 86 9f 00 00 (Meter reply the energy value is 99999wh) C9
5a Set the module address Req B4 C0 A8 01 01 00 (Computer sends a request to set the address, the address is 192.168.1.1) 1E
5b Set the module address resp A4 00 00 00 00 00 (Meter reply the address was successfully set) A4
6a Set the power alarm threshold Req B5 C0 A8 01 01 14 (computer sends a request to set a power alarm threshold) 33
6b Set the power alarm threshold Resp A5 00 00 00 00 00 (Meter reply the power alarm threshold was successfully set) A5

Illustration of the communication protocol example:

  1. Set the communication address: 192.168.1.1
    Send command: B4 C0 A8 01 01 00 1E
    Reply data: A4 00 00 00 00 00 A4
    Note: The above example illustrate that setting the communication address as 192.168.1.1 (the user can set their own address based on their preferences and needs).

Sending commands and replying data automatically are as shown above, the data are expressed in hexadecimal; the last byte of the sending and replying data are 1E and A4, belong to cumulative sum. At sending commands: B4 + C0 + A8 + 01 + 01 + 00 = 21E (use the hexadecimal addition), the cumulative sum data is 21E, take the last two bytes 1E to be used the cumulative sum data in sending commands; data in reply: A4 + 00 + 00 + 00 + 00 + 00 = A4 (use the hexadecimal addition),the cumulative sum data is A4,which is the cumulative sum data in reply.
The explanation of the cumulative sum is now finished, the following parameter examples are the same as this, there is no explanation any more.

  1. Set the power alarm threshold:20 KW
    Send command: B5 C0 A8 01 01 14 33
    Reply data: A5 00 00 00 00 00 A5
    Note: 14 in the sending command is the alarm value (14 is a hexadecimal data representation, which converted to decimal is 20). What you should note is the power alarm value of this module is based on KW units, which means the minimum alarm value is 1KW, the maximum value is 22KW.

  2. Read the current voltage
    Send command: B0 C0 A8 01 01 00 1A
    Reply data: A0 00 E6 02 00 00 88
    Note: Reply voltage data is D1D2D3 = 00 E6 02, 00 E6 represent the integer-bit of the voltage, 02 represent the decimal of the voltage, the decimal is one digit, converts 00 E6 to decimal is 230; converts 02 to decimal is 2, so the current voltage value is 230.2V.

  3. Read the current current
    Send command: B1 C0 A8 01 01 00 1B
    Reply data: A1 00 11 20 00 00 D2
    Note: Reply current data is D2D3 = 11 20, 11 represent the integer-bit of the current, 20 represent the decimal of the current, the current decimal is two digits, converts 11 to decimal is 17; converts 20 to decimal is 32, so the current current value is 17.32 A.

  4. Read the current power
    Send command: B2 C0 A8 01 01 00 1C
    Reply data: A2 08 98 00 00 00 42
    Note: Reply power data is D1D2 = 08 98, converts 08 98 to decimal is 2200, so the current voltage value is 2200W.

  5. Read the energy
    Send command: B3 C0 A8 01 01 00 1D
    Reply data: A3 01 86 9F 00 00 C9
    Note: Reply energy data is D1D2D3 = 01 86 9F, converts 01 86 9F to decimal is 99999, so the accumulated power is 99999Wh.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].