Archives July 2017

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.