I’m currently working on my EPEVER charge controller project, part of this project is to display a “energy generated by Solar”. I was able to get the value to display on Blynk or serial monitor BUT the value does not display correct number.
For example, the actual value from device shown 1.82 kWh but the output from serial monitor show 614
What did I do wrong?
Did I missed anything?
Below is the register value (full data sheet from HERE)
and here is the code that display wrong value for Consumed Energy Daily
I am reading floats via RS485 ModBus so it is similar, I suggest to try code like this:
{
union { uint16_t u[2]; unsigned long r; } meterdata;
meterdata.u[0] = node.getResponseBuffer(1); meterdata.u[1] = node.getResponseBuffer(0);
Serial.print(meterdata.f);
}
Note the data is stored according to your datasheet in Little-Endian format, so I think your code has the registers the wrong way around?
Also for some reason with my meter / library I have to request one address lower than desired - but if yours is working for some registers then that is unlikely to be the case.
This is probably due different Baud rate or using Serial.println as the Serial Print will be on the Same TX/RX pins unless you use the Software Serial to Debug