Various aspects of home brew inverters


Author Message
poida

Guru

Joined: 02/02/2017
Location: Australia
Posts: 1415
Posted: 05:10am 06 Nov 2018      

Part 25: How I log, process and view the data from my solar power system

I have enjoyed home brew solar power since about 2015 or earlier. I can’t recall when I first set it up
since it’s come to the stage where “we’ve always had it working here”
Along the way I have further developed my programming skills and added new languages to my skill set.
This system uses html, php, javascript and C.

Anyway, some basic facts:
48V battery, 400Ah.
one 3kW array, of 250W panels. Wried in 4 parallel x 3 in series, facing North.
another array, 3kW of 250W panels, 6 parallel x 2 in series, facing East.
An MPPT controller, taking the North facing array. This gets up to 100V input, DC-Dc converting to
suit the 48V battery.
A PWM controller, taking the East facing array, This gets up to 60V and 20A and is nowhere the 3kW
rated.
A Raspberry Pi computer, running things. Powered by a DC-DC converter connected to 48V battery.
An Arduino Nano, connected to the Pi, powered by the Pi.
A change over relay (Latronics ACTS40) which powers part of the house, using either inverter supplied AC or street power. This changes over automatically depending on the availability of inverter power. 1/2 of the house is connected to this circuit via an RCB, and it's properly earthed, wired with 1.5mm2 3 core under the house, leading to numerous GPOs.
Thermistor temperature sensors, attached to battery terminals.
A DC current sensor, +/- 60A or more range.

The mppt controller is a Morningstar 60A ppt. It comes with internet connectivity.
I request the device’s operating parameters every 2 minutes.
From an http request such as
“http://172.16.0.54/MBCSV.cgi?ID=1&F=4&AHI=0&ALO=27&RHI=0&RLO=36”
I obtain the battery voltage, charging target voltage, charge current, array current, array voltage
heat sink temp, battery temp, charge state, ppt sweep max power, sweep open voltage and more
from the device.

The PWM controller is a Morningstar 60A Tristar. No internet connection alas.
But it has a serial port. Via a RS-232 to usb cable, into the Raspberry Pi I can send and receive
Modus data. And so I obtain the Tristar’s battery temp, voltage, charge current, heat sink temp.

The Arduino nano is used to obtain the current draw by the inverter, and convert to an integer.
It also counts pulses obtained from the infrared sensor located on top of the 1 watt.hour pulse LED
of the house’s smart meter. This gives me street energy consumption.

So the Raspberry Pi knows all, every 2 minutes.
It comes with sufficient storage for a database. I use and recommend mysql as the database.
Every 2 minutes a new record is inserted into the table named “datah”

The table is organised thusly:
mysql> describe datah;
+--------------+------------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+-------------------+-----------------------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| bv | double(6,2) | YES | | NULL | |
| tv | double(6,2) | YES | | NULL | |
| ts | timestamp | NO | MUL | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| cc | double(6,2) | YES | | NULL | |
| av | double(6,2) | YES | | NULL | |
| ac | double(6,2) | YES | | NULL | |
| op | double(6,2) | YES | | NULL | |
| svmp | double(6,2) | YES | | NULL | |
| swoc | double(6,2) | YES | | NULL | |
| swpm | double(6,2) | YES | | NULL | |
| bt | int(2) unsigned | YES | | NULL | |
| hst | int(2) unsigned | YES | | NULL | |
| chargestate | int(2) unsigned | YES | | NULL | |
| ledstate | int(2) unsigned | YES | | NULL | |
| ddate | datetime | YES | MUL | NULL | |
| dtime | datetime | YES | | NULL | |
| loadamps | double(6,2) | YES | | NULL | |
| streetpower | double(6,2) | YES | | 0.00 | |
| meterwhr | int(2) | YES | | NULL | |
| inverterctl | int(1) | YES | | NULL | |
| lvcomp | int(2) | YES | | NULL | |
| tscc | double(6,2) | YES | | NULL | |
| tshst | int(2) | YES | | NULL | |
| loadampspeak | double(6,2) | YES | | NULL | |
| tsbv | double(6,2) | YES | | NULL | |
+--------------+------------------+------+-----+-------------------+-----------------------------+

I can extract records from this table satisfying various criteria.
e.g. to get all the records, sorted by time for the day 2 Nov 2018 the query would be
“select * from data where ddate = 20181103000000 order by id”

Right now we can see how today’s situation is going. It’s rather cloudy so things are very up and down.




I welcome all to have a play with this.
http://poidapie.chickenkiller.com/mppt/c19d.php

I control the inverter myself, some inverters have low voltage cut off controls and more.
I do it via digital output of a Raspberry Pi pin, onto isolated, then driving a mosfet to pull down anything up to 60V to ground
as a control output. MY home made inverters only need a low current 12V signal to be pulled to ground. The Powerjack LF inverter
needs to have a battery voltage level signal pulled to ground. That’s why the mosfet is utilised.

Every 2 minutes I insert a new row of data, check the battery voltage against limits and drive the inverter control as needed.

The Raspberry Pi has a web server running, and this serves up requested pages.
I have progressively developed the web page that generates the above image over the past few years, on and off.

Programming the Arduino nano is done via the Linux console on the Raspberry Pi
using Platformio. I can reprogram the nano remotely from work if I like.
It's all very flexible with remote administration.

We only have ADSL here at home and that places limits on how fast I send data out of the house.
This has been a welcome challenge for my programming, to drive efficient coding that works over slow connections.
I do IT for a living so network setup is easy. I have the Raspberry Pi web server available to the internet, contactable by anyone, anywhere.
Should the advertising of my webserver become a problem I can easily limit access
to certain locations such as my workplace and home. Control of this is absolutely no problem at all.

2018-11-06_143433_untitled_folder.zip

Simple mathematics is all that is needed.
Given DC voltage and DC current we can get DC power just from multiplying.
To get energy, you total up the power times 2/60 (giving watt.hours) over the required time interval when samples occur every 2 minutes.

Here is the energy consumption of the house from 2016 to date:
Some energy comes from the street, some from the inverter.



And the daily energy consumption:



There were 4 weeks when I did not have a working inverter.
Talk about anxiety or what...

I attach all the various programs and web resources needed to make my system work and am happy to answer any questions anyone here wants to ask.
Edited by poida 2018-11-07
wronger than a phone book full of wrong phone numbers