diy solar

diy solar

Automation of relays without DIY : any available frameworks?

BrickedKeyboard

New Member
Joined
May 2, 2021
Messages
61
So there are a bunch of system level things a full off grid system would need that end up all being a decision to switch a relay.

Main 48v Battery voltage under threshold? Generator start relay. Generator already started? Starter relay off.

Main 48v Battery over threshold? Relay to diversion load. (Example electric water heater or EV charger)

Too cold in battery shed? Homekit command to IR blaster to start mini split or heater.

Anyways I have done this kind of work professionally for years and know how difficult it actually is to make it work "all the time every time" especially with homebrewed electronics like using a Pi or Arduino and breadboards.

Anything available commercially that isn't crazy expensive? Homekit remote plugs and IR blasters let you do most of the relay switching, but how do you sense voltage? Besides implementing the homekit api on a web server running on a pi with a custom script to read the RS485 SOC from your batteries, or a voltage divider circuit to map 0-60v to 0-3.3v and then...
 
I know you said 'commercial', but those are usually always crazy expensive (based on all my old research)...

I can share a couple of my non-commercial solutions in case they seem interesting...


My favorite by far is MyPi as it comes with Android and iOS apps, installs on Raspberry Pi (server / client architecture)

iOS:
Android:

More info on setup:

It was very easy to set up.

I've personally built 2 of these. The same app can connect to either Raspberry Pi device. One of mine is an 8 relay module, and the other one is a 3 relay module.

The relay modules look similar to this:

1641919326294.png

On the 8 relay module I built, I just use the relays directly. But on the 3 relay module, I use the little relays to trigger big large industrial contactors to manage switching large loads, like I could turn on and off football stadium lights if I wanted.

I found a pic showing my 8 relay system. Will have to go back to the storage unit to find my 3 relay box and take a picture of that one with the 3 big contactors in it.

1641919821442.png

But you can also add code into there for doing more automation if you want. I just like the app ability to be able to click devices from your smartphone (over wifi, or globally via vpn to home network).




As far as your last question / comment on sensing voltage.

I built another Raspberry Pi based voltage sensing device, based on an ADC (analog-to-digital-converter) tophat i installed on it. Added voltage dividers to get right voltage range.

Something like this:

I think the ADC tophat I had used was called ADCPi or something, but I used their python sample code and modified it, added a bunch of extra code to check my voltage on my AC power at home, and if the power would go out, it would send me a gmail saying 'Your power is down', and when the power came back on it would send me another gmail saying 'your power is back on'...

I had all my home stuff running on battery backups and Comcast internet would still work even when the power was off at the house, so this worked to send me status updates.

I just used voltage divider circuits to bring it down to 0-5v range that the ADC board operated in, and calibrated it. <3v meant the power was out, >3v meant the power was on (for the purposes of my code, I didn't need any more granularity than that).
 
Last edited:
I like the versatility of the Raspberry Pi in this regard. Probably what I will try next, is this...

Ever since I found out that my MPP Solar and BMS can not natively talk to each other, I later figured out here on the forum about the Raspberry Pi solar system management software called 'Solar Assistant'. Where I can install Solar Assistant onto a Raspberry Pi and it can communicate via RS485, Canbus, RS232, etc, to the inverters, and to the BMSs, etc...

So I am wondering if I put on other relay control code and relay modules as well (like noted above), and I can use various data from Solar Assistant as well, to help control other additional automation if needed.

Because it would be even simpler to integrate the systems together if they are on the same physical computer device. I've also heard of home automation stuff using MQTT protocol and whatnot. Wondering if Solar Assistant could have any integration with other programs like Home Assistant, if they use MQTT as well...


Imagine if you can sense battery SoC or something, and it starts getting below a certain threshold, and have it start shutting off lights in rooms that have no motion, and adding in your own custom kinds of power-saving actions. Or anything really...
 
Last edited:
Thank you fellows. The closest I have found is people have written python servers you run on a pi to talk to growatts inverters. If I don't have to write the server this is the cleanest way to do it. The inverter can tell you the battery voltage, estimated SOC, if the solar is out - all the information you need to make decisions.

Then growatts itself emits 2 relay signals, one for battery above full voltage and one for battery almost empty you can use to wire to automation also.
 
Thank you fellows. The closest I have found is people have written python servers you run on a pi to talk to growatts inverters. If I don't have to write the server this is the cleanest way to do it. The inverter can tell you the battery voltage, estimated SOC, if the solar is out - all the information you need to make decisions.

Then growatts itself emits 2 relay signals, one for battery above full voltage and one for battery almost empty you can use to wire to automation also.

Well have a look at Solar Assistant:

They already built a whole solution for communicating with various inverter brands and BMS communication protocols. Several people here say it works much better than many of the factory inverter management / graphing capabilities.

If we pull data from here, we can do anything we want with it, using the Raspberry Pi as the control source. Or you can have it send commands to other Raspberry Pi's on your network to do pretty much anything on your property.

I can't even scratch the surface of what is possible yet. I just purchased Solar Assistant the other day and haven't even installed it yet. But based on things I've read, I see a potential to bridge the world of Solar Assistant and Home Assistant, or even making custom triggers...

I need to learn more about how they both work first to see what is possible. It also sounds like the dev team for Solar Assistant (aka Pierre) is very receptive to their customers and happy to consider feature requests.

I guess we'll see what comes of it anyways... :geek:
 
Imagine if you can sense battery SoC or something, and it starts getting below a certain threshold, and have it start shutting off lights in rooms that have no motion, and adding in your own custom kinds of power-saving actions. Or anything really...
That is a cool idea though it would be rather complex to implement. I was thinking simpler ideas. One is just have a 48v DC heating element in a hot water heater that only gets power if the battery bank is full. This already is pretty common. A mixing valve would be installed after the heater so you can keep it at 140-150 farenheit to maximize how much heat is actually stored. You need the second heating element on the water heater to be wired to the main AC power and set to a much lower temperature for this to work though. (Or use a heat pump if you have room)
 
That is a cool idea though it would be rather complex to implement. I was thinking simpler ideas. One is just have a 48v DC heating element in a hot water heater that only gets power if the battery bank is full. This already is pretty common. A mixing valve would be installed after the heater so you can keep it at 140-150 farenheit to maximize how much heat is actually stored. You need the second heating element on the water heater to be wired to the main AC power and set to a much lower temperature for this to work though. (Or use a heat pump if you have room)

Yeah, that's where I wonder if that Home Assistant can help (which also can install on Raspberry Pi hardware):


If we can just get something like that to be able to pull SoC from Solar Assistant, then you could make macros in Home Assistant to perform tasks.
 
Oh, here it looks like they've already addressed integration right here:


They have to run on 2 separate Raspberry Pi hardwares, and communicate via network.

Reading more on it now.
 
Back
Top