Saturday, May 13, 2023

MODBUS communication with Solis 4G-US inverters

Solis single-phase inverters have a circular RS485 connector supporting MODBUS communication.  The connectors can be difficult to find for sale outside China, so using a wifi data logger stick is a more straightforward way of communicating with the inverters.  IGEN Tech is the OEM for the Solis wifi data loggers, which IGEN also sells under the SOLARMAN brand.  While the same circular connector is used by many other inverter manufacturers such as Solax, RENAC, and KSTAR, the logger firmware is customized to read and report the MODBUS registers for a particular manufacturer.

The LSW-3 series of wifi loggers allow external programs to perform MODBUS queries via a TCP connection port 8899.  I believe this is a variant of the MODBUS/TCP protocol that is assigned TCP port 502.

To perform MODBUS queries, I used pysolarmanv5.  To connect to the logger pysolarmanv5 requires the logger serial number and IP address.  Initially I read the serial number off the label of the logger, and looked up the IP address from the admin page of my router.  Later I noticed solarman_scan.py, which sends a broadcast UDP packet which the data logger replies to.  I sometimes had to run it more than once before the logger responded to the scan packet.

The Solis 4G-US series inverters are Sunspec MODBUS certified, and have the well-known 32-bit ‘SunS’ identifier (0x53756e53) at address 40001.  This means it should be possible to read the registers by decoding the SunSpec information models and inverter device IDs.  SunSpec shares some example code, however I haven't been able to figure it all out.

I couldn't figure out the Solis registers using SunSpec, but I was able to find the register documentation from Ginlong.  The AC output power and DC input power are 32-bit registers at address 3005 using MODBUS function code 4 (input registers).  I wrote a python program to read the output and input power and calculate the efficiency.  It also reads the inverter temperature, and outputs the data every 5 minutes.  I also wrote a small AWK program to calculate the weighted average of multiple samples.  The code can be found in my github repo.

Over multiple days of output in the spring of 2023 including sunny and cloudy days, I observed an overall efficiency of 94% for a Solis 1P4K-4G-US.  For a Solis 1P6K-4G-US I observed an average efficiency of 95%.  This compares to respective advertised CEC weighted efficiencies of 97.5% and 97.0%.