Calculating Battery Charge

Hi.

I have a Sofar battery inverter and 2 x 2.4kWh Pylontech batteries attached. It uses the Solarman website for monitoring via an inbuilt IGEN Tech datalogger.

While the Sofar website advertises API access, in reality the IGEN Tech people have ignored my emails and been no help. So I bought an emonTx to monitor the inputs and outputs instead. That works great!

The only metric I’m really missing is the battery charge level.

Can anyone suggest a way of creating a feed that keeps track of the charge level by simply measuring how much energy goes in and out of the battery and adding or subtracting it from a running total?

Or any other ideas for communicating with the battery?

Thanks is advance.

Hi Colin, welcome to OEM.

I have had some passing experience with solarman and the igen hardware. It is essentially a dedicated modbus master hardwired to read and format fairly “universal” data and then post it to the solarman web portal 9and make it available locally via an api). The few encounters I’ve had have been with PV inverters and I’ve basically binned the igen hardware and communicated with the inverters directly. The “universal” solarman implementation (incl the igen hw) is claimed to be compatible with all (or at least most) inverters, chargers and some other hardware too, I believe this is due to it using the “sunspec” alliance protocols.

Certainly in the cases I’ve mentioned above I simply read the modbus registers directly using the sunspec alliance documentation albeit in all but one case, supplied by the inverter manufacturers.

I’m certainly no expert in the SunSpec alliance side of things but despite not being a gambling man, I might have a small wager on your battery inverter being sunspec “compatible” purely because the solarman’s IGEN can communicate with it.

From what I recall, there is some general info to be found in some universally accessible registers and in that info (model, serial no etc) there is also a register map reference (I can’t remember the official term) that identifies the correct template like register map (also probably not the right term) for the specific device in question, so once you read the general registers once, you then have the info to regularly poll the rest of the registers and know what info is being returned.

There are some manufacturer listed on the sunspec website as members etc but I suspect there are many devices that are “compatible” even if not fully compliant or manufactured by paid up members.

Ok, so I just did a quick web search on “sofar modbus” which turned up quite a few links, picking a couple at random I found this one

which had this pdf attached to it SOFARSOLAR ModBus-RTU Communication Protocol.pdf (270.2 KB)

and this one https://forums.whirlpool.net.au/archive/2685285 which mentions a node-red flow.

Obviously I have no idea if any of this applies to the model you have, but I think it should be totally possible to get all the info from your inverter via modbus if you are happy to do a bit of research and/or experiment a little. The hardest part of any modbus job is getting the register info, if your device is readable by solarman, chances are it’s sunspec and using one of a handful of register maps so even if you can’t get model specific data from the manufacturer, it should still be possible to do, just not so easily.

This Sofar PV inverter user manual even shows you the modbud id and rs485 activity indicators

is there anything in the user manual or spec for your device that suggests “modbus” or “rs485” ?

In case you ended up here via a search for Pylontech batteries and want to integrate the state of charge data into your home energy system, a project to do exactly that is now available at GitHub - irekzielinski/Pylontech-Battery-Monitoring: Adding WiFi monitoring to US2000B batteries.