vortigont / pzem-edl Goto Github PK
View Code? Open in Web Editor NEWAn event-driven library for ESP32 implementing PZEM-004T v3.0 / PZEM-003 / PZEM-017 Modbus-RTU proto
License: GNU General Public License v3.0
An event-driven library for ESP32 implementing PZEM-004T v3.0 / PZEM-003 / PZEM-017 Modbus-RTU proto
License: GNU General Public License v3.0
I can’t even run the example because the LList.h is missing, even Google can’t find it =((
Hi @vortigont, thanks for the nice Lib!
Im not a specialist in Programming, so I need to aks some silly questions.
I Use 3x PZEM and they work great with your example code.
pz004::rx_msg_prettyp(m); Gives me the Whole list of Values of the Boards wich is great!
What I need to do is only get Voltages / Currents / Power etc. and write them in custom variables.
I tried this from the main.cpp to get the current from one Sensor:
void mycallback(uint8_t id, const RX_msg* m){
auto *m = (const pz004::metrics*)meters->getMetrics(PZEM_ID_2)
Serial.printf("PZEM '%s' current as float: %.3f (Amps)\n", meters->getDescr(PZEM_ID_2), m->asFloat(meter_t::cur));
But it wont compile and gives me errors.
I also dont need floats, so raw Integer values would be enough for me.
how do I access the single values within the callback (Raw values & Floats)?
Thanks in advance!
@vortigont , after updating to new version of this library, I get an error while compiling "In file included from espem/espem.h:12:0,
from espem/interface.cpp:1:
.pio/libdeps/espem/pzem-edl/src/timeseries.hpp:32:26: fatal error: esp32/spiram.h: No such file or directory
compilation terminated.
In file included from espem/espem.h:12:0,
from espem/espem.cpp:9:
.pio/libdeps/espem/pzem-edl/src/timeseries.hpp:32:26: fatal error: esp32/spiram.h: No such file or directory
compilation terminated.
*** [.pio\build\espem\src\interface.cpp.o] Error 1
*** [.pio\build\espem\src\espem.cpp.o] Error 1
In file included from espem/espem.h:12:0,
from espem/main.cpp:11:
.pio/libdeps/espem/pzem-edl/src/timeseries.hpp:32:26: fatal error: esp32/spiram.h: No such file or directory
compilation terminated.
*** [.pio\build\espem\src\main.cpp.o] Error 1
============================================================ [FAILED] Took 8.03 seconds ============================================================
Environment Status Duration
espem FAILED 00:00:08.027
====================================================== 1 failed, 0 succeeded in 00:00:08.027 ====================================================== "
and an error in the main.cpp also as shown in the screen shot below
Swears like this -
In file included from C:\Users\User\Documents\Arduino\libraries\pzem-edl-main\examples\03_MultiplePZEM004\src\main.h:14:0,
from C:\Users\User\Documents\Arduino\libraries\pzem-edl-main\examples\03_MultiplePZEM004\src\main.cpp:14:
C:\Users\User\Documents\Arduino\libraries\pzem-edl-main\src/pzem_edl.hpp:18:19: fatal error: LList.h: No such file or directory
compilation terminated.
exit status 1
Compilation error for board ESP32 Dev Module.
What to do?
I've setup my PZEMs as per the CLI instructions and run the sample. Only change is that my GPIO pins are 16 and 17. So changed
#define RX_PIN 16 // custom RX pin number
#define TX_PIN 17 // custom TX pin number
Upon running the example crashes with:
PZEM multiple instance example
Added port id:10
Added PZEM id:42 addr:10, port id:1
Added PZEM id:43 addr:11, port id:1
Added PZEM id:44 addr:12, port id:1
abort() was called at PC 0x400ebf8b on core 1
ELF file SHA256: 0000000000000000
Backtrace: 0x40084f18:0x3ffb1e50 0x4008518d:0x3ffb1e70 0x400ebf8b:0x3ffb1e90 0x400ebfd2:0x3ffb1eb0 0x400ec0eb:0x3ffb1ed0 0x400eec13:0x3ffb1ef0 0x400d12a6:0x3ffb1f10 0x400d4492:0x3ffb1fb0 0x40086dfd:0x
--- exit ---
3ffb1fd0
#0 0x40084f18:0x3ffb1e50 in invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:715
#1 0x4008518d:0x3ffb1e70 in abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:715
#2 0x400ebf8b:0x3ffb1e90 in __cxxabiv1::__terminate(void (*)()) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc:112
#3 0x400ebfd2:0x3ffb1eb0 in std::terminate() at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc:112
#4 0x400ec0eb:0x3ffb1ed0 in __cxa_pure_virtual at ??:?
#5 0x400eec13:0x3ffb1ef0 in PZPool::updateMetrics() at .pio/libdeps/example/pzem-edl/src/pzem_edl.cpp:303
#6 0x400d12a6:0x3ffb1f10 in setup() at src/main.cpp:110
#7 0x400d4492:0x3ffb1fb0 in loopTask(void*) at /Users/nevilledastur/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:18
#8 0x40086dfd:0x3ffb1fd0 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
Hi @vortigont,
It´s Me again. I had success with the Signale Values, now I tried to add some stuff to loop() and it is not working.
this kind of Programing is new to me, can you give a newbie a example on how to execute my "own" code? with your Library?
Sorry for these kind of questions, but i would love to use ur Library for my projekt.
Thanks in advance.
Trying to get your code to compile.
msgq.hpp:14:10: fatal error: driver/uart.h: No such file or directory
Line 14 in 9750b66
What am I missing library-wise?
I can't find a way to reset the power meters back to zero. I.e. a Energy counter reset
From https://github.com/mandulaj/PZEM-004T-v30/blob/master/src/PZEM004Tv30.cpp
/*!
* PZEM004Tv30::resetEnergy
*
* Reset the Energy counter on the device
*
* @return success
*/
bool PZEM004Tv30::resetEnergy(){
uint8_t buffer[] = {0x00, CMD_REST, 0x00, 0x00};
uint8_t reply[5];
buffer[0] = _addr;
setCRC(buffer, 4);
_serial->write(buffer, 4);
uint16_t length = receive(reply, 5);
if(length == 0 || length == 5){
return false;
}
return true;
}
{"age":245,"U":200.1,"I":10.79,"P":2104,"W":16976,"hz":50.0,"pF":0.97}
Вчера значение когда подключил esp значение показало 52квч, хотя на прошивке тасмола было 378 квч, сегодня же значение пошло считать заново, при этом достало примерно до 65квч и сбросилось, мое предположение что это проблема может быть в переменной unsigned int у которой значения 0… 65 535
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.