Good day everyone,
Can someone please guide me how to setup my project? I followed the procedure described in PZEM-004T v3.0 and NodeMCU / Wemos Mini running on Blynk - How To procedure by creating new project, copied the codes as in first step.
void setup(){
Serial.begin(115200); Serial.println("Start serial"); pzem.begin(9600); Serial.println("Start PZEM serial");
node.begin(1, pzem); Serial.println("Start PZEM"); // 1 = ID MODBUS
WiFi.mode(WIFI_STA);
#if defined(USE_LOCAL_SERVER)
WiFi.begin(ssid, pass);
Blynk.config(AUTH, server, port);
#else
Blynk.begin(AUTH, ssid, pass);
#endif
while (Blynk.connect() == false) {}
ArduinoOTA.setHostname(OTA_HOSTNAME);
ArduinoOTA.begin();
// timerTask1 = timer.setInterval(1000, updateBlynk);
}
void updateBlynk() {
Blynk.virtualWrite(vPIN_VOLTAGE, U_PR);
Blynk.virtualWrite(vPIN_CURRENT_USAGE, I_PR);
Blynk.virtualWrite(vPIN_ACTIVE_POWER, P_PR);
Blynk.virtualWrite(vPIN_ACTIVE_ENERGY, PPR);
Blynk.virtualWrite(vPIN_FREQUENCY, PR_F);
Blynk.virtualWrite(vPIN_POWER_FACTOR, PR_PF);
Blynk.virtualWrite(vPIN_OVER_POWER_ALARM, PR_alarm);
}
void loop(){
Blynk.run();
//ArduinoOTA.handle();
//timer.run();
result = node.readInputRegisters(0x0000, 10);
if (result == node.ku8MBSuccess) {
U_PR = (node.getResponseBuffer(0x00)/10.0f);
I_PR = (node.getResponseBuffer(0x01)/1000.000f);
P_PR = (node.getResponseBuffer(0x03)/10.0f);
PPR = (node.getResponseBuffer(0x05)/1000.0f);
PR_F = (node.getResponseBuffer(0x07)/10.0f);
P
Then followed the second step and copied the codes and saved them as settingsPZEM.h in same folder but it gives me error
Arduino: 1.8.9 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
PZEM:6:26: error: settingsPZEM.h: No such file or directory
#include "settingsPZEM.h"
^
compilation terminated.
exit status 1
settingsPZEM.h: No such file or directory
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences
Tools I am using are Nodemcu ESP8266, PZEM004T V03 with level shifter as shown in the schematic. Also if someone can verify my connection between esp and pzem are ok as per the codes.
I know i am asking for too much but being beginner will help me a lot.
Thanks in advance