PZEM004T Energy Monitor - RTurala/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's functionality before connecting the PZEM-004T to it's 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 Red
  • Rx Yellow
  • Tx Green
  • Gnd Grey

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 AC try 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 will use Hardware Serial. If the user wants to use another GPIOs for communication, Tasmota will emulate the serial interfase using software serial feature. This feature don't work using core 2.3.0 due to insuficient iRAM. To use software serial feature, please compile using core 2.4.2 or greater.