PZEM004T Energy Monitor - FengtianGu/Sonoff-Tasmota GitHub Wiki

Parts needed

  • Sonoff Basic
  • PZEM-004T
  • Resistor 1k
  • Enclosure
  • Power cable

Preparation

Install Tasmota on the Sonoff Basic and confirm it is functional before connecting the PZEM-004T to its serial interface.

Hardware connections

As the PZEM-004T expects 5V serial data and the Sonoff Basic only provides up to 3V3 the expected optocoupler input power of the PZEM-004T has to be reduced. This can be accomplished by soldering a 1k resistor between the joints shown below.

Connect the serial interface of the Sonoff Basic with the serial interface of the PZEM-004T. See pictures regarding used colors and connections.

  • 3V3/5V Red
  • Rx Yellow
  • Tx Green
  • Gnd Grey

(Image taken from https://www.instructables.com/id/Use-Homie-Firmware-to-Drive-Sonoff-Switch-Module-E/ Thanks @amayii0)

As the PZEM004T is functioning better on 5V, it can be obtained from the Voltage regulator as shown in this image.

Cut the power cable in two and connect the input wires to both Sonoff Basic and PZEM-004T. Route one of the power output wires through the PZEM-004T core and connect the output wires to the Sonoff Basic output.

As most parts are connected to high voltage AC it is recommended to fit the hardware in a solid enclosure.

Software configuration

Configure the GPIO's for hardware serial connection as shown below.

IMPORTANT: If using the connections as following, the communication works in all cores due to Tasmota using hardware serial. If the user wants to use another GPIOs for communication, Tasmota will emulate a serial interface using software serial. This feature does not work using core 2.3.0 due to insufficient RAM. To use the software serial feature, please compile using core 2.4.2 or greater.

Calibration

Per Theo - As the PZEM is a dedicated energy monitor, device calibration in TASMOTA is currently not supported.