PZEM-004T v3.0 and NodeMCU / Wemos Mini running on Blynk - How To procedure

Hi Pete

Thanks for the clarification however i do have it connected as you have noted.

Phil

Please tell me where you need to add what would work?

You need to add this.
According to the next post by 4eyes it worked for him

OK. I realized this when I found your post above. Thanks.

    void pzemdata(){

    result = node.readInputRegisters(0x0000, 10);
    
    if (result == node.ku8MBSuccess)  
    {
    voltage_usage      = (node.getResponseBuffer(0x00) / 10.0f);
//    current_usage      = (node.getResponseBuffer(0x01) / 1000.000f);
//    current_usage_h      = (node.getResponseBuffer(0x02) / 10000.000f);
    current_usage_l_h      = ((node.getResponseBuffer(0x01) + (node.getResponseBuffer(0x02)*65532)) / 1000.000f);
//    active_power       = (node.getResponseBuffer(0x03) / 10.0f);
//    active_power_h       = (node.getResponseBuffer(0x04) / 100.0f);
    active_power_l_h       = ((node.getResponseBuffer(0x03) + (node.getResponseBuffer(0x04)*65532)) / 10.0f);
//    active_energy      = (node.getResponseBuffer(0x05) / 1000.0f);
//    active_energy_h      = (node.getResponseBuffer(0x06) / 10000.0f);
    active_energy_l_h      = ((node.getResponseBuffer(0x05) + (node.getResponseBuffer(0x06)*65532)) / 1000.0f);
    frequency          = (node.getResponseBuffer(0x07) / 10.0f);
    power_factor       = (node.getResponseBuffer(0x08) / 100.0f);
    over_power_alarm   = (node.getResponseBuffer(0x09));
    }

  Serial.print("VOLTAGE:           ");   Serial.println(voltage_usage);   // V
  Serial.print("CURRENT_USAGE:     ");   Serial.println(current_usage_l_h, 3);  //  A
  Serial.print("ACTIVE_POWER:      ");   Serial.println(active_power_l_h);   //  W
  Serial.print("ACTIVE_ENERGY:     ");   Serial.println(active_energy_l_h, 3);  // kWh
  Serial.print("FREQUENCY:         ");   Serial.println(frequency);    // Hz
  Serial.print("POWER_FACTOR:      ");   Serial.println(power_factor);
  Serial.print("OVER_POWER_ALARM:  ");   Serial.println(over_power_alarm, 0);
  Serial.println("====================================================");
}

How to reset Energy counter with ModbusMaster? I couldn’t find any.

Read this:

Pete.

Thanks a lot! It works!

1 Like


The reset occurred again. Please tell me what could be the problem?

Code.

Hello everyone , please I just baught pzem-004t V3 and when I interface it with esp8266 it doesn’t work.Just RX on pzem blinks and TX is not . Pleaase any help !!!

how did u solve this ? i got the same problem

1 Like


hy pete , i was follow your instruction to make sure both file are in the same folder location , but "settingPZEM.h still can read on arduino

My guess is that the file you’ve created is actually called settingPZEM.h.ino

The best way to create these additional files is to use the drop-down arrow in the top right…

image

and choose “New Tab” and give it the desired name and paste your code into it.

Pete.


hy pete ,i got the error message again about D5,D6 ,as we can see in the picture , can you help me again pete for solve this problem

You probably chose “generic ESP8266” as your board type in the IDE when you compiled the sketch.

Generic ESP8266 doesn’t support the “D” number designations for pins, so choose a more appropriate board type.

Pete.


hey pete ,what shoul i do ? if i get this error message ?

Totally delete your Blynk for Chinese library.

Pete.


hy pete i was deleted the chines blynk as your instruction ,and then what should i do ?

Copy the full compiler output text (not a screenshot) and post it, with triple backticks at the beginning and end of the text, so that it displays correctly.

Triple backticks look like this:
```

Pete.

[Unformatted compiler output deleted by moderator]