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!

Monitoring

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.

Decoding

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.

Storing

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.

https://github.com/dpoulson/ginlong-mqtt

So far I’m pretty certain that I’ve got the following stats correct:

  • Temperature
  • 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…

18650 Power Wall

The next step in my solar power quest is to get a decent amount of storage. To that end, I’m attempting to make my own 18650 power wall using all the recycled cells I’ve been harvesting.

Power Wall Design

I’ve been watching a lot of DIY power wall projects, including HBPowerwall and Jehu Garcia. Unlike my batteries for R2 which will be charged and discharged with me present, a power wall needs to be left unattended for extended periods of time usually. Mine will be in the garage and I’ll only be physically present when working on projects in there. This means that I need to add some extra safety features into it such as fuses.

Fuses and holders

4 x 18650 Holder

4 x 18650 Holder

A lot of people have been soldering fuse wire directly to the 18650 cells, but this is something I want to avoid. Firstly, this runs the risk of ruining the cell. Secondly, I’d like to easily be able to swap out failed fuses and cells. One person I’ve been watching on YouTube is Adam Welch who had a nice idea on how to solve both these issues. I’m extending on his idea by using fuse holders and standard 5x20mm fuses. Along with this I will be using some standard PCB mount 4 x 18650 holders.

The holders will allow for quick swapping of any dead cells, not that I’m expecting that to happen too often but I am using recycled cells with unknown service life.

PCB Design

To make this a bit more professional I’ll tie all this together with some custom PCBs that I’m currently getting made. The PCBs will join two holder trays together and mount the fuses to them.

Bottom side of 18650 Power wall PCB

Bottom side of PCB

Top side of 18650 Power Wall PCB

Top side of PCB

There will also be an edge connector designed into the PCB. The final idea will be for modular shelves that can be added into the main battery as I build them by making a backplane that they plug into. The backplane will have rows of sockets, and also house the BMS system that I want to add to further protect the battery and cells. It also gave me a chance to try out KiCAD rather than Eagle CAD that I had been using for projects up to this point.

Aims

Whilst this approach won’t be anywhere near as energy dense as something like the HBPowerwall project has accomplished, it should allow me to have a nice small scale, safe, installation.

No way I’ll ever do something like this tied to the grid, but it should be enough for lighting and charging my tool battery packs at least. With only 100W of solar panels at the moment, a single bank of cells will give me a little more energy storage than the two SLA ones. Adding a second will hopefully take this up to about 400Wh of storage. More than enough for my needs.

Still messing with the monitoring of the solar, seems to be working ok so far. However, there is currently no load on the charge controller which means it enters float charge and doesn’t show the actual amount of energy I could produce. I’m going to start wiring in a load of some form to get better stats.

 

 

Pretty Solar Graphs

The first step on my solar progress is to get some graphs done, to get an idea of how much energy I can get from my solar panels on an average day. From this I can work out what I can conceivably run from my setup.

Background

Previously, I installed a simple solar setup for testing. This is using an EPEver Tracer1210A solar charge controller, from Tracer. It wasn’t the cheapest, but it had a lot of good reviews (watch out for cheap copied). The other benefit was the fact it had a serial output that talked modbus, or rs485. Intended for official devices, they do provide the protocol to allow third parties to read the system details.

After doing some searching, I discovered Jamin on github who had done some coding and circuit design to get the current details from the charge controller and push the results out to a service called Blynk.

My Project

Overview

This project gave me the starting point for what I wanted to do. My idea was to do this:

Controller -> RS485 -> NodeMCU -> MQTT -> OpenHAB -> InfluxDB -> Grafana

A little bit convoluted, I could probably have pushed straight to a database for logging, and do the graphs in grafana. I decided that pushing via MQTT would allow me to integrate the logging into my OpenHAB system, which would give me the capability to trigger home automation actions depending on the statistics from the charge controller. For example, it makes it very easy to use OpenHAB to send an email if the battery level gets low, and not only that it could turn off some of the load running off the battery as it gets to different levels.

Circuit

The circuit is pretty much a direct copy of what Jamin used, only adapted for a NodeMCU rather than a ESP8266 Mini Dev board.

Bad photo of current system.

Prototype of circuit. Ordered a 5110 LCD to add to it, and will neaten it all up then.

I did look into powering this from the 5V on the serial output of the charge controller, but according to the documentation this can only put out about 50mA of power, which probably won’t be enough to cover the usage by the NodeMCU.

Code

The initial code can be found on my github repository here:

https://github.com/dpoulson/EPSolar

Still a work in progress, but it does the basics so far. Future improvements will allow writing of certain settings, maybe a simple webserver for point in time readings, or an LCD screen.

Logging

So the circuit will transmit the readings over wifi to my central MQTT server, running mosquitto. MQTT is just a simple messaging system when you can subscribe to, or publish to, certain queues.

Readings from the charge controller will be published to set queues on the server, which OpenHAB will be subscribed to, with the following items file:

Number EPSolar_Temp "Temperature [%.2f °C]" { mqtt="<[mymosquitto:EPSolar/1/ctemp:state:default" }

Number EPSolar_BattVolt "Battery Voltage [%.2f V]" { mqtt="<[mymosquitto:EPSolar/1/bvoltage:state:default" }
Number EPSolar_BattRemain "Battery Remaining [%.2f %]" { mqtt="<[mymosquitto:EPSolar/1/bremaining:state:default" }
Number EPSolar_BattTemp "Battery Temp [%.2f °C]" { mqtt="<[mymosquitto:EPSolar/1/btemp:state:default" }

Number EPSolar_LoadPower "Load Power [%.2f W]" { mqtt="<[mymosquitto:EPSolar/1/lpower:state:default" }
Number EPSolar_LoadCurrent "Load Current [%.2f A]" { mqtt="<[mymosquitto:EPSolar/1/lcurrent:state:default" }

Number EPSolar_PVVolt "PV Voltage [%.2f V]" { mqtt="<[mymosquitto:EPSolar/1/pvvoltage:state:default" }
Number EPSolar_PVCurrent "PV Current [%.2f A]" { mqtt="<[mymosquitto:EPSolar/1/pvcurrent:state:default" }
Number EPSolar_PVPower "PV Power [%.2f W]" { mqtt="<[mymosquitto:EPSolar/1/pvpower:state:default" }

Number EPSolar_ChargeCurrent "Battery Charge Current [%.2f A]" { mqtt="<[mymosquitto:EPSolar/1/battChargeCurrent:state:default" }

Number EPSolar_PVVoltMax "PV Voltage MAX (today) [%.2f V]" { mqtt="<[mymosquitto:EPSolar/1/stats_today_pv_volt_max:state:default" }
Number EPSolar_PVVoltMin "PV Voltage MIN (today) [%.2f V]" { mqtt="<[mymosquitto:EPSolar/1/stats_today_pv_volt_min:state:default" }

My OpenHAB system is configured to store persistence data into an InfluxDB server, which is a common setup amongst the OpenHAB community and is well documented. This InfluxDB stores historic data on items in OpenHAB, which is searchable by Grafana. Grafana gives a nice interface to produce all the pretty solar graphs you might want.

Solar Graphs

Using Grafana to get some pretty solar graphs

Pretty Solar Graphs

This makes it really easy to see just what is happening, including the charging states as it you can see the switch from bulk to float charge on the battery voltage. This should allow me to make sure the charging is correct for the Lithium Ion batteries I want to eventually connect.

A bit of Solar

I got a message a few weeks back to see if I was still looking for old laptop batteries for 18650 harvesting, and of course I said yes. The next day, I got one or two batteries dropped off at my house:

A few crates. There were a couple of other ones too.

A few crates. There were a couple of other ones too.

Wow. Its going to take some time to crack them all open, harvest the cells, and test them all properly. Of course, I’ve got two batteries for R2 now that seem to be in a good shape and last long enough for pretty much any event. So the question is, what do I do with all the cells I’m going to have once I’ve finally gone through all these crates.

I’ve a few projects in mind that will utilise a couple of cells each, including a standby battery for R2’s brain, but a rough calculation shows that once I’m through all these crates I’ll have approx 1200 cells of varying states. So far, I’m through about half a crate and the vast majority seem to be in a good condition and over 2000mAh capacity. That means I’ve got nearly 8kWh of energy storage! Even if I assume half the cells are dead (so far only about 2% seem dead), thats still 4kWh.

The first thing that jumps out for this amount of storage is a form of power wall. Now, I’m not going to do anything grid tied, that is just too much hassle, but doing something off grid for the garage is definitely doable. If I can perhaps do enough to run the computer and other electronics, plus indoor and outdoor lighting, then I will consider it a success.

25W solar panel for testing

25W solar panel for testing

To start the project, I got hold of a few small solar cells, one 25W, and a couple of 50W ones. The 25W one will be used for experimentation and testing theories out, and the two 50W panels will be mounted on the wall of the garage for a more permanent solution. I also purchased an EPSolar MPPT charge controller, to go with a couple of spare 12V SLA batteries I had spare from initial testing of R2. I went for this model as it has a serial out port on it that will allow me to tie it into my OpenHAB home automation system and graph things like battery charge, solar power production, and any load on the system.

Fabricated a couple of brackets to mount the 100W combined solar panel

Fabricated a couple of brackets to mount the panel

Being able to graph those details will allow me to make an estimate of how much energy I can generate on a typical day, and from that calculate how much I can actually run off my system for a given amount of solar panels, and also work out just how many kWh of energy storage I need.

The charge controller however will only work with standard lead acid batteries, whilst I want to make use of the 18650 cells. To this end, I did a lot of reading and it seems that there are very few hobby level solar charge controllers that will work properly with lithium technologies. Some charge controllers can be made to work with them, but it is more of a bodge.

After much searching, I did find one chinese charge controller that said it worked with lithium batteries, and actually seemed to back that up in the details. One of the main things to look for is that it supports the typical CC/CV (constant current/constant voltage) charge methods that are required for all lithium cells. A few clicks, and it was on its way on a slow boat from china.

Solar charge controller mounted

Solar charge controller mounted

For now, I’ve got the EPSolar charge controller mounted on the wall of the garage, connected to the 100W of panels outside.

Next steps are to get some data logging from the serial port, probably using an ESP8266 based device, dumping the data into my MQTT server, which in turn will be monitored by OpenHAB to be dropped into an influxDB store for graphing with Grafana.

Along with this is the slow process of breaking open a lot of laptop batteries and harvesting the cells. Once I have enough for a decent sized test, I will be looking into various ways of mounting them and hopefully adding an individual fuse to each cell for safety. More research into BMS for making sure the battery is properly balanced is required too.

 

 

One Year of Solar

So, I’ve had my solar panels for a year now, and have just received my fourth cheque from British Gas for my Feed in Tariff and Export Tariff. So, in a year of having the panels, just those cheques alone have come to over £400, and that doesn’t take into account the money saved on my electric bills. British Gas have some nice tools for viewing usage, and from the following graph you can see just just how much my electric consumption went down compared to the previous year.

Screenshot - 050414 - 15:19:23

Summer months of course were extra good, especially July where I actually consumed next to nothing off the grid. Even the winter months show a little improvement. Rough calculations show my electric bills were approximately £300 less than the previous years.

So, what does this mean? Well, with the FiT money, Export Tariff money, and savings on my electric bill, I’m definitely on track for paying off the solar panels within the predicted 8 years. As electric prices go up, that figure may well improve somewhat too. I’m definitely glad I got them installed, I think it was a fantastic investment and certainly is going to be a better way of saving money in the long run.