It is a 24 volts model, so I am using a two 12V 100Ah batteries connected in series (lead-acid automotive batteries):
I hope it will work longer then the batteries for APC 1400VA UPS, which I had before (and had to buy and replace batteries very often).
The model is not a hybrid one, which I’d love to have but for my purposes it is working really great so far.
The inverter has an integrated USB connector, so there is a way to communicate with the device.
There is some creepy monitoring software called WatchPower, which is moreover written in Java:
There is even also a console version of the management software which can be run on Linux, but it also need Java (JRE) 😮
Monitoring the inverter with this software on Raspberry Pi would be painful, so it was a time to discover how to do it the proper way 😉
After plugging the USB to the Raspberry I’ve got in dmesg:
[ 523.116132] usb 1-2: new low-speed USB device number 2 using uhci_hcd [ 523.329148] usb 1-2: New USB device found, idVendor=0665, idProduct=5161 [ 523.329160] usb 1-2: New USB device strings: Mfr=3, Product=1, SerialNumber=0 [ 525.073328] hidraw: raw HID events driver (C) Jiri Kosina [ 525.111176] usbcore: registered new interface driver usbhid [ 525.111184] usbhid: USB HID core driver [ 525.213484] hid-generic 0003:0665:5161.0001: hiddev0,hidraw0: USB HID v1.11 Device [HID 0665:5161] on usb-0000:00:1d.0-2/input0
So it is a HID device visible in lsusb as:
Bus 001 Device 002: ID 0665:5161 Cypress Semiconductor USB to Serial
I sniffed with wireshark how the original program is talking to the device and I see that it is some pseudo-ASCII protocol.
The commands generally starts with Q letter, ie: QPI, QSID, QPIRI, QDI, QPIGS and the responses started with the ‘(‘ mark, and the results like this:
(230.1 49.9 230.1 49.9 0529 0483 020 393 27.03 000 100 0040 0000 000.0 00.00 00000 00010101 00 00 00000 110
At the end of the line is a two-byte CRC and new line character.
I’ve entered some of the command into Google to get some information about this protocol.
I have found great Australian and New Zealand forums with much information about the protocol and the hardware (maybe it’s more common at those markets). The most valuable for me was these two threads:
Based on this information I was able to integrate the support for the inverter in my Raspberry Pi.
There is no HID driver for the inverter, so I just used a generic device file: /dev/hidraw0.
In fact the most interesting commands for my constant monitoring was:
QPIGS – status (input, output voltages, currents, load, etc.)
QMOD – current mode (power-on, standby, line mode, battery mode, etc.)
So now instead of using the bloated Java software, I am just using simple and pure C code for monitoring the inverter on my RPi.
I created a sample demo project on github, so you can have a look or test how to query the inverter:
As usual I am providing some sample grafana plots, which I like very much in contrast to original software 😉