Solar and stats
I finally got round to getting solar installed at the house. Due to the dormers, I ouldn’t really fit much on the main roof. I did manage to squeeze 1.5kW of panels onto the garage.
Red Electrical came and installed everything very quickly and neatly, very impressed with their work and support in deciding what equipment to go with.
The solar inverter that I went with is a Solis mini 1500 4g by Ginlong. Basically, a single MPPT grid tie inverter that will handle up to 1.5kW. The 4g just means its the fourth generation of their kit. Its a fairly cheap but decent chinese model, and has the option of a wired or wireless monitoring stick. This is where the fun starts!
Now, I like to gather stats about power usage (and just about anything else really), and I rather liked the idea of using data directly from the inverter rather than the more typical way of using clamp meters such as those from Open Energy Monitor, which I have used before. The idea being that data from the inverter will be more accurate than a passive monitoring system.
Of course, it wasn’t going to be that easy. The monitoring stick is designed to push data out to a remote server and you access the data via a portal. The portal isn’t actually that bad, it seems the system is used and rebranded by a number of manufacturers, but this wasn’t good enough for me. I wanted the data fed into my home automation system (OpenHAB), similar to how I’d set up my off grid system.
Thankfully, at least the monitoring stick does support sending to an alternate IP address and port. The problem is, the protocol is not documented anywhere and the manufacturer will not release it. I searched for quite a while under various names and brands and found a few people who had tried to do similar. The newest work in github was from graham0, but was two years old and for a different version of the firmware. However, it did give me a starting point.
So, pointing the secondary address of the monitoring stick to my desktop, I started examining the data being sent. There was a choice of a few protocols, but the one that seemed to give the best data was listed as SolarMAN-1.
What I was receiving was a 270 byte string. In HEX this was:
687941b08f4661718f466171810305030507e40100b3930000509ee9590100af 010000XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXa7008701060000000000030000 000300620900006209881348000000820000001e000000000000000300000000 00001d0403000000000000000000000010270000009000009000000000000000 000009e2069816
The XXXXXX part are the serial number of the inverter. I figured this out first as it was actually sent in plain ascii. Good start, at least I was getting something.
I worked on the assumption that the rest of the data was encoded similar to the previous protocols as worked out by graham0, I started looking for various 2 and 4 byte blocks. Temperature was quickly found as the first two bytes after the serial number. The rest of the data took a few days to crack. As I logged more of the rawdata to a file, I started pattern matching trends and data to the graphs that the main monitoring portal was producing.
In the end, I managed to write a program to take in the data and spit out usable stats. My next step will be to pipe this data into my MQTT server. Then OpenHAB can then access it much like my previous solar experiences. I have released the code on github, incase anyone else has a similar setup or wants to extend it. The raw data actually seems to support dual MPPT inverters, and theres a lot of data in there that I haven’t figured out yet.
So far I’m pretty certain that I’ve got the following stats correct:
- DC Volts (from panels)
- DC Current (from panels)
- AC voltage (grid supply)
- AC Current (how much is fed into the grid)
- AC Frequency (should be around 50Hz)
- kWh produced today
- kWh produced in total
I’ll continue work on it and see what other stats I can pull out, but from this I should be able to calculate most other things.
Is it worth it?
As its only a small solar install, the ROI is going to be quite long compared to the solar on the previous house (only have another year or so and they should be paid off). However, I do think solar is great thing to have. Now if only I could justify a powerwall…