BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

PROBLEM ESP 32 + PZEM 004t V3.0 +Blynk

The picture above is an error when using esp32 with pzem V3.0. There is cannot connecting to PZEM Module V3.0 the program always looping again to connecting blynk server after “connecting to PZEM” in serial monitor

whereas before using pzem v 1.0 there were no problems like that

There ia my code to connect esp32 + pzem 004t V1.0 with blynk. And its work

#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = " Auth Token Blynk ";
char ssid[] = "SSID Wifi ";
char pass[] = "Password WiFi";

#include <HardwareSerial.h>
#include <PZEM004T.h>
#define HardwareSerial Serial2(2);     //  hwserial UART2 at pins IO-16 (RX2) and IO-17 (TX2)
PZEM004T pzem(&amp;Serial2);
IPAddress ip(192,168,1,1);
float v;
float i;
float p;
float e;

void setup() {
   Serial.begin(115200);
   while (true) {
      Serial.println("Connecting to PZEM...");
      if(pzem.setAddress(ip))
        break;
      delay(1000);
   Blynk.begin(auth, ssid, pass);
   }
}

void bacaPZEM(){
   //PZEM
  v = pzem.voltage(ip);
  if (v &lt; 0.0) v = 0.0;
   Serial.print(v);Serial.print("V; ");

  i = pzem.current(ip);
   if(i &gt;= 0.0){ Serial.print(i);Serial.print("A; "); }

  p = pzem.power(ip);
   if(p &gt;= 0.0){ Serial.print(p);Serial.print("W; "); }

  e = pzem.energy(ip);
   if(e &gt;= 0.0){ Serial.print(e);Serial.print("Wh; "); }

  Serial.println();
  delay(3000);
}

void sendtoblynk(){
  Blynk.virtualWrite(V0, v);
  Blynk.virtualWrite(V1, i);
  Blynk.virtualWrite(V2, p);
  Blynk.virtualWrite(V3, e);
}

void loop() {
  bacaPZEM();
  delay(1000);
  sendtoblynk();
  Blynk.run();
}

But now i just bought pzem module version V3.0 and there are can to compiling and uploading to my esp 32. But there are no respond in serial monitor AND my esp 32 cannot connecting pzem, so it cannot connect to my blynk server. I think there are different configuration between PZEM V1.0 and PZEM V3.0. Maybe different in HardwareSerial or maybe SoftwareSerial.

I found library PZEM004Tv30 and modify to my code. But there still show error in my serial monitor. I do know what must i do to fix this. Please somebody help me to fix that.

Please edit your post and add triple backticks at the beginning and end of code, so that it displays correctly.
Triple backticks look like this:
```

It’s also far better to copy and paste serial monitor data, also enclosed within triple backticks, than posting a photo.

Pete.

Thank you. I done to edit my post. Please help me to fix this

check out my post here for a full instruction on how to setup PZEM-004T V3 on Blynk