reaper7 / SDM_Energy_Meter

reading SDM72 SDM120 SDM220 SDM230 SDM630 modbus energy meters from arduino (esp8266, esp32, avr)
247 stars 97 forks source link

Problem with fork for ABB B23 - Modbus register assignement problem #69

Closed PyroRider closed 1 year ago

PyroRider commented 2 years ago

Hi, I've used an ESP8266 NodeMCU and an RS485 to TTL converter to read out the values of my ABB B23 112-100 energy meter and write the values into a DB (using get requests and unpacking them through a php script) Now the problem is if I read the register 0x5B00 which should be the voltage of L1, I receive the value of L2, reading U_P2 gives the value of L3 and so on. I tried reading the register by the address, by using the assigned name from the library, but everything results in the value of the next register. Reading 0x5AFF (2 registers before 0x5B00) I only get a long random number. Did anyone every stumble across the same or a similar problem and has a solution for it?

PyroRider commented 1 year ago

Edit: I used the wrong register last time, using 0x5AFE and then shifting the other i.e. voltage registers down by 2 (U2 -> 0x5B00 instead of 0x5B02...) it works. Now comes the big question, who caused the problem in this case? ABB for giving out wrong register informations or if ABB is right, the writer of the code?

PyroRider commented 1 year ago

The problem always sits in front of the screen, when calling the readVal() function it is strictly necessary to put the register AND the length as parameters, otherwise the code reads whatever it wants and creates the said behaviour. An example for the ABB B23 fork: float F = ABB_B23.readVal(ABB_F, 1); -> ABB_F is the library name for the register storing the grid-frequency, 1 means that the value is stored in 1 register unlike most other values which are stored in 2 or even 4 registers