diy solar

diy solar

My 6k$ budget DIY Scaleable Off-Grid 15 kwh 48v LiFePo4 hybrid build with remote control and supervision function

Messier11

New Member
Joined
Dec 26, 2021
Messages
234
Location
Sweden
v2.
Introduction

Hi everyone!

I have always spent the summers and part of the winter out in the archipelago it the most northern part of the Bothnian Bay in Sweden (Finland is only a slap shot to the East). During summer time, we get sun 24 hours a day and, conversely, during parts of December and January we get no sun at all, as shown in the below pictures taken at midnight a summer day and at noon on new years eve.
1658922856344.png

We have previously only had a one panel system, but I always nurtured a dream to get electricity to this place. Sure, there can be a charm in being without it for a month here and there, but living conditions are harsh enough as it is up there.

Disclaimer / Important Message
Before I continue, I want to be overly clear that I am not an electrician. Not an engineer in any way. I am a business lawyer that is somewhat handy and that has worked extra as a carpenter and stuff like that, but I have very little experience wiring cables. My system has not really been reviewed by anyone knowledgeable. I have noticed how I made some wiring that potentially could have been dangerous and of course fixed those issues, but there is definitely no guarantee that any part of my build is not faulty and hence dangerous. Do not do anything I have done, at least if you cannot verify yourself that is 100% correct.

Step 1 -- Choosing Gear and drawing a Blueprint vs. my Budget (app. 6,000 USD)
Choosing the Battery, and drawing the Blueprint
My first step was to build a blueprint and choosing the necessary gear. I had (barely) a 6k USD budget this, and depending on the alternatives I looked at, I was first looking at dividing my build over 2 years, mainly to first get the inverter and cells and then add batteries from Pylontech next summer. But especially due to the inspiration I got from Andy's Off-Grid Garage and the safety I could feel in ordering cells from China due to the references at this place, I decided to go with a DIY 48v Powerwall Option.

After the battery was in place, I just built the blueprint from that. At first, I really fumbling in the dark. Its funny how a certain thing that just feels like a 100% given today, was a complete mystery just a few months ago. Take an aspect like how the cable from the Solar Charge Controller/MPPT (hereinafter "SCC") can go into a T-junction with one end going into the battery and the other to the inverter was never something I would have figured out myself.

I made my blueprint in PowerPoint and after I to a larger extent had everything in place, I realized that I was just guessing every step of the way on which size of breakers, fuses, cables and what not that I needed -- I created a separate document in which I made the calculations myself. That was actually a really easy part of everything, since the math itself is 100% "googable". The parameters comes from the gear, how many amps can the SCC put out? Then you just need to google how to calculate the size of the cable which can handle that load. Then it was the same with fuses/MCBs.

This is my blue-print and how it looked right up until my ordering of the gear started. I actually just ruined my laptop which it was saved on, so its not updated, but like 95% correct. I have not implemented the 48v to 12v function, but instead got a 12v charger on AC out 2 and the old 12v system is kept alive.
1658923504152.png
1658923524256.png
1658924613176.png
1658924559106.png


Victron vs. Others
One choice I had to make was to go with Victron or Growatt or another solution (some US alternatives does not seem to really be available in Europe, I see you guys talk about some options that I never see for sale here). My Victron Multiplus II 48/5,000 Hybrid Inverter (it can invert DC to AC and charge the battery with DC from for example an AC petrol generator, hereinafter "MP2") cost about 1,750 USD and my 150/60 SCC cost around 600 USD. I could probably have saved up towards 50% with other alternatives. I went with Victron. I do not know if that was a wise decision. But I can say this, everything have worked. I have this old battered petrol inverter providing an awful quality AC output, but after adjusting the settings, it works. Everything connects. When you want to do something, sure enough there is a built in function for it.

I am very "China" friendly when ordering gear, often its as high quality as the products built and sold in Europe, and in fact, products built and sold in Europe/the US can be very over priced and under-developed. In this case I am sure there are very good alternatives from China, but I have no objections against the Victron gear. Its quality as far as I can tell.

Fuses, breakers, and connections/junctions
I was myself interested in getting links to the fuses, MCBs and junctions other used, but after a while I abandoned that completely. Especially when I started ordering stuff, and my first alternatives were out of stock or seemed very expensive. All you need to have are the specs, which I got from my above calculations, then you can just google like "MCB DC 500V 16A" or whatever.

As for the junctions, connection boxes, fuse holders and what not -- these things are the first thing you can save money on. Get a copper bar, 6 feets or whatever, drills and gear to make threads. A small piece of a copper bar with three holes in it is a T-junction. Some connections will be M10, others M8. Some busbars constructions can easily cost 100-150 USD, and can be made DIY for a 1/10 of that.

The Cells
My sells came from Jenny Wu and were in mint condition on the outside. I did not test them, nor did I balance them before hooking them up to the JK BMS.

Step 2 -- The Mounting of the Gear exkl. of Panels
The Gear except the Panels
I mounted everything on a temporary "wall", about 80x140CM, and then brought the entire wall with me. The wall is made of wood covered with a painted plaster board and covered by a frame on which I have mounted a door of acrylic glass. I used left over hinges from an IKEA wardrobe and have cut holes in the acrylic gear so that I can access what should be accessible fast as well as to provide ventilation for the SCC and MP2.
1658926424930.png

My (not so) Tidy Wiring
I tried to wire everything as tidy as possible, but after smaller adjustments had to be made and everything was added -- it got darn hard to make it look professional. I mention this because if I wouldn't have been careful from the start, thinking everything would be super organized, the end product would have been a complete mess instead of what I have now that is just a bit messy.

Crimping Gear, cable lugs etc
I used my own crimping gear for all smaller cables, but ordered pre made 35mm2 cables with M8 lugs. I regret that. The shortest pre-made cables I could get was 30 cm, sometimes 10 cm would have been better.

This shows the downside with not being able to choose your own length of the cables as well as how messy things have gotten at the end:
1658926932902.png

Step 3 -- The mounting of the Panels
My budget was wiped out by the gear I bought, so I had to mount the panels using 'leftovers'. We had some aluminium stuff lying around from a small loading dock, which I put on the roof and locked panels too.

This is how it ended up looking, not super pretty but hey, it didn't cost me a cent (below the roof, you can see my two old panels for the 12v car battery system, which have been up and running for like 20-30 years now...):
1658927210663.png
 
Last edited:
(2/3)
Step 4 -- Software configuration, monitoring and remote access (To-Be-Updated)
Raw software settings
Introduction
I will have to come back to update this section the coming days. But I will briefly outline what I have done down below as a starter.

The JK BMS -- Settings
The JK BMS is accessible from an app which connects to it with Bluetooth (really well). At first, you basically only have to change the amps of your battery cell and set them to LiFePo4 default.

The SCC -- Settings
Same as above and you should also enable the networking function (I will get back to that).

The Smart Shunt -- Settings
Same as for the SCC.

The MP2 -- Settings
The MP2 is not accessible via bluetooth. No changes have to be made to the settings when starting it IIRC. I didn't have the proper gear to connect to it at first.

Venus os on a Raspberry Pi 4 replacing the Cerbo device (v2)
JK BMS
Instead of getting a Cerbo device which could hook up the Victron gear to wifi, I installed Venus OS on a Raspberry Pi 4 ("RPI4"). It was super smooth. You need to get one TTL/USB adapter (example below) and a proper JST 2.0 pin 4 cable (and connect the two pieces) per each Victron device except the MP2.

Andy got a go video on how to set up Venus OS on a RPI4.

The MP2 is connected to the Pi via a very unnecessary VE.Bus to USB dongle, like this: https://www.amazon.se/Victron-Energy-Gränssnitt-MK3-USB-VE-Bus/dp/B06Y5WS3VZ/ref=asc_df_B06Y5WS3VZ/?tag=shpngadsglede-21&linkCode=df0&hvadid=476528209637&hvpos=&hvnetw=g&hvrand=9592994679506188597&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=1012267&hvtargid=pla-404514500303&psc=1

With thii device, I can connect to the VRM universe via a 4g Router from anywhere:
1658929058226.png


Using Home Assistant on a RPI to connect to the JK BMS via Modbus, and to monitor and automate the system (TBU)
To be able to monitor and control the JK BMS remotely, I have set up another RPI4 on which I have installed Home Assistant ("HA"). Installing HA is very easy, there are a ton of tutorials, just watch them. A RPI4 is basically a best described as a mini-computer. Its not much bigger than a credit card, costs like 80 bucks, have pretty awsome specs in terms of prestanda and connections, and everything is designed to be controllable remotely. I.e. you just set it up and access it from another computer.

I want to add this though, building the battery, putting everything together, that is more or less plug and play. HA is not. For a noob like myself, basically nothing works the first try. Then you stand there wondering what the heck to do. Anything and everything could be wrong, and you have no idea where to start to search. Or instructions and tutorials are just really hard to udnerstand. Like you see someone say that you can acheive something by just adding a line of code, but not where to add it. For them its like saying add this motor oil to the car, for most its a given where you put the motor oil in the car, no further explanation is needed. But at least for someone like me, it can be a bit frustrating since I have no idea which configuration file I should add that code to. But, everything is solveable. I have never "not" been able to do something with HA, automate or connect some device that I wanted to. Everything just seem to require a bit of tinkering, you need to google around, understand what some info right infront of you really mean, and then just sort it out.

After you have installed Home Assistant, you need to enable remote control. HA is totally free, but if you only connect it to the internet via a 4G Router, you actually have to pay a little sum to be able to access it remotely via a cloud solution (or set up a more advanced server yourself).

Once that is done, you can connect the JK BMS either by a cable or by Bluetooth to HA. To monitor the system and get readings, I would definitely recommend using ESPHome over a ESP32 mini controller with this project:

For that you need (a) a JST 1.25 pin 4 connector (links below), (b) an ESP32 mini controller, (c) soldering skills or the jumper wires linked below, and (d) a USB C to USB C cable.


After that, you:
(1) You wire it together like this:
1658948137528.png
(2) Connect the ESP32 to the RPI4 running HA using an USB C to USB C cable
(3) You install the addon ESPHome in HA through the add-on store
(4) You install edit the standard configuration of the ESP32 to include the content in this file: https://github.com/syssi/esphome-jk-bms/blob/main/esp32-example.yaml

Don't hesitate to ask if you want me to explain any aspect more in detail. But when I did this I ran into a classic example of how things are never plug 'n play in HA. The first time I just got a bunch of errors and warnings flying by on the screen in 180 mph while the browser page looped. I had no idea what went on. After a while I tried scrolling through the text flying by, and could see that I had some kind of over stack problem. A little googling showed that I could solve this by increasing the stack. I tried doing so, but couldn't get it to work. After some time I realized that it was just a simple Too little RAM like issue, and removed a bunch of data to be obtained from the JK (like 50%+ of it is 100% irrelevant, at least after a while). Then the install worked. So now I went about to connect it to the JK BMS. I got zero readings. What do you do then? I had no clue. No errors, nothing, just didn't get any info. A wise man (@upnorthandpersonal) told by to try and switch place of the TX and RX cable just in case, I thought well, I am sure I didn't mix up these cables, but sure, why not, perhaps I will get some error readings or can see if it reacts when I pull one cable and not the other, whatever, but -- boom -- it worked like a charm just changing place of my RX and TX cable. Could be that the blueprint at github linked to above has these things mixed up, I don't know.

By doing this, all data from the JK BMS shows up as sensors in Home Assistant:
1658949100435.png

To be able to change the settings of the JK BMS, for example turn of discharging remotely, you need to access it over BLE. To do this, you just add this text to the settings of your ESP32. How do you find the mac_address of your JK BMS? This is one of those things that can drive you mad with Home Assistant. You can find a detailed instruction for how to install something, but it just says 'enter your JK BMS mac address' and not hwo you find it. Doing something else, I learned that the ble_tracker command means that all close by devices that communicates over BLE will be tracked in the log-file, where their mac_adress is stated. So just by entering something as the mac_address, run the device, checking the logs, you can find the devices mac_address.
substitutions:
name: jk-bms
device_description: "Monitor and control a JK-BMS via bluetooth"
external_components_source: github://syssi/esphome-jk-bms@main
mac_address: C8:47:8C:E1:E2:E1
# Defaults to "JK02". Please use "JK04" if you have some old JK-BMS version (f.e. JK-B2A16S hw 3.0, sw. 3.3.0)
protocol_version: JK02
ble_client:
- mac_address: ${mac_address}
id: client0
jk_bms_ble:
- ble_client_id: client0
protocol_version: ${protocol_version}
throttle: 5s
id: bms0
Then you can create switches in HA to change the values of for example the Battery Discharging from on to off, doing that is fairly easy. I have paused my ble-access and only use the hardware connection by entering a "#" sign before the BLE text.
 
Last edited:
VICTRON VRM
In addition, I have linked my Victrom VRM API to HA using this code in the configuration.yaml (the main configuration file for HA) file:
- name: victron
type: tcp
host: 192.168.1.102
port: 502
sensors:
- name: "Battery Power"
unit_of_measurement: W
slave: 100
address: 842
unique_id: battery_power_1

Then you can add as many sensors that you want from the Modbus-TCP register list at: https://www.victronenergy.se/support-and-downloads/technical-information#

They have some really cool sensors there, that for example can separate the power reads from AC OUT 1 from AC OUT 2.

GRAFANA and INFLUX DB
If you are a bit of a nerd like me, you can save every reading ever made in your HA (i.e. from Victron and the JK BMS) in a databas called InfluxDB and display that information in Grafana. This is my goto vid for making that work:

I haven't fined tuned these things, but roughly this is my Monitor Dashboard as it looks right now:
1658950542611.png
 
Venus os on a Raspberry Pi 4 replacing the Cerbo device (v2)
JK BMS
Instead of getting a Cerbo device which could hook up the Victron gear to wifi, I installed Venus OS on a Raspberry Pi 4 ("RPI4"). It was super smooth. You need to get one TTL/USB adapter (example below) and a proper JST 2.0 pin 4 cable (and connect the two pieces) per each Victron device except the MP2.

Andy got a go video on how to set up Venus OS on a RPI4.

The MP2 is connected to the Pi via a very unnecessary VE.Bus to USB dongle, like this: https://www.amazon.se/Victron-Energy-Gränssnitt-MK3-USB-VE-Bus/dp/B06Y5WS3VZ/ref=asc_df_B06Y5WS3VZ/?tag=shpngadsglede-21&linkCode=df0&hvadid=476528209637&hvpos=&hvnetw=g&hvrand=9592994679506188597&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=1012267&hvtargid=pla-404514500303&psc=1

With thii device, I can connect to the VRM universe via a 4g Router from anywhere:
View attachment 104291

Don't hesitate to ask if you want me to explain any aspect more in detail.
congratulations on what looks like a very advanced build.

I’m mulling following in your footsteps and there seem to not be that many who have used Venus OS on an RPi here in the Forum, so I am going to take you up on your offer.

My first question is to understand whether your RPi-based ‘Cerbo device’ is pretty much of a ‘black box’ or whether you can integrate your own control loops on it?

Did you go the route of RPi+VenusOS just to save money, to access a specific communication protocol not offered by an off-the-shelf Cerbo device, or for some other reason?

I found this on Victron’s website: https://www.victronenergy.com/live/ess:ess_mode_2_and_3

1.3 - Mode 3
Customer self implements their control loop and grid measurements, and uses the MultiPlus and/or Quattros as simple, remote controllable, bidirectional inverter/chargers that can be set to either charge or discharge an x amount of Watts.’

This is what I am interested to do. I want to implement my own control loop on an RPi-based or PLC-based Modbus controller that monitors import/export from grid mains wires as well as DC-coupled solar production and then instructs the MPII to either export a specific number of Watts or to absorb / import a specific number of Watts to charge the battery or power loads.

So my second question is whether you believe this type of integration would be possible on your RPi+Venus OS device or is would be better implemented on a separate controller that communicates with the ‘Cerbo device’ through Modbus-over-Ethernet?
 
Back
Top