diy solar

diy solar

DIY Battery via Smart shunt to inverter integration (Solis etc)

Ah am really glad it's working.

Can everyone using this solution please drop in here what you're using, victron device and inverter, I can then make a list of compatible hardware on my github.
Solis RHI-3.6K-48ES-5G & Victron Smart Shunt - still building the whole setup atm :)IMG_20221015_193258_DRO.-50p.jpg
 
Using Solis RHI-3.6K-48ES-5G (hybrid) - works with both pylontech and generic (user-defined) battery types - now using the latter.

Was using Victron Smart-shunt; now modified code to run on ESP32 using 2 threads and interfaced directly with Overkill (JBD) BMS.
"Using 2 threads" = runs faster??
 
"Using 2 threads" = runs faster??
short answer, Doesn't run any faster.

Long answer.

The data from the victron is done via push, the esp32 has to receive this in real time, any delay and the data is lost. This data is sent every second, so the code uses a task (thread) that has the highest priority to handle this receiving of data.

The can bus data has to be sent every second, delays to this can trigger the can fail message on the inverter, this is in another task but lower priority.

So in effect there is 2 tasks (threads) running the important code to make sure it happens on time, then other processing is ran in between the tasks.

The original version I released didn't have a separate task for CAN bus data and this caused an issue, the one available now does include it.

More stuff will be coming in future releases.
 
Hi All,

I've taken some code that handles Victron's VE.Direct protocol (Smart Shunt) and added in CAN Bus / PylonTech protocol connections, this allows the State of Charge, Voltage, Amps etc all be sent to the inverter - any one that supports the PylonTech protocol.

I have it connected to a Solis and works perfectly.

Secondly as it has MQTT I implemented commands that can be sent to enable and disable charging, and force charging, this I did so if solar isn't going to be good the following day (using Forecast Solar), then Home Assistant turns on the force charge and the inverter will charge the batteries, please note as per protocol it turns off at 97% SOC.

Currently I have a daly BMS on a 200amp battery pack, and a JKBMS on a 320Amp pack, tied together through the Victron Smart Shunt and it all works perfectly.

Code is here: https://github.com/sijones/VE.DirectMQTTCANBUS


Do these pin mappings look correct @sijones2010 (snagged via your photos)?
 

Attachments

  • Pin_Mappings_ESP32_CANBUS_Adapter.jpg
    Pin_Mappings_ESP32_CANBUS_Adapter.jpg
    54.3 KB · Views: 34
Those are correct. The one you put a question mark by is the chip select. That is connected to D2, but is also configurable in the software - see config.h entry "#define CAN_CS_PIN D2 // CAN CS PIN"
 
Those are correct. The one you put a question mark by is the chip select. That is connected to D2, but is also configurable in the software - see config.h entry "#define CAN_CS_PIN D2 // CAN CS PIN"
Many thanks SeaGal
 
@SeaGal / @sijones2010

In:

change the following to 280000 for a 16S 280Ah setup?

#define initBattCapacity 475000
Yes that's fine.

Ps. On your previous post, I'd recommend not changing any pin allocation as am changing the way the configuration works in the future and updates to make it easier for everyone, so please stick to the pins unless you know what you're doing.
 
20220806_205931.jpg
Just checking - in this demo setup, am I correct in thinking that there was no need to have 5V injected to the shunt because that's only required when connecting the shunt to actual Victron equipment (which I won't be doing)?
 
Last edited:
Just checking - in this demo setup, am I correct in thinking that there was no need to have 5V injected to the shunt because that's only required when connecting teh shunt to actual Victron equipment (which I won't be doing)?
The 5v pin on the shunt is actually power out not in. The idea of it is to power an isolated interface. You don't need that as your only using ground and signal.
 
In the README.md, you mention:

"I use Home Assistant to automate off peak battery charging (using Force Charge) and can also enable and disable the charging and discharging."

...is that something you'd consider adding to the github repo (no worries if not - always worth asking! :))
 
In the README.md, you mention:

"I use Home Assistant to automate off peak battery charging (using Force Charge) and can also enable and disable the charging and discharging."

...is that something you'd consider adding to the github repo (no worries if not - always worth asking! :))
The configuration for the mqtt commands is in a file called homeassistant.yaml, but I think it's in the old format so I'll update it later today.

You'll need an mqtt server running or be using the home assistant add on mqtt server.

Feel free to ask what ever, am more than happy to share what I've done, just sometimes am quite busy so can be slow to reply.
 
I've updated the file to be the new way HomeAsssistant likes the MQTT configuration.

In case you don't know, you need the Mosquitto add on, and under configuration put:
- username: emon
password: emonmqtt

password "p" needs to be inline with the "u" of username.
 
The configuration for the mqtt commands is in a file called homeassistant.yaml, but I think it's in the old format so I'll update it later today.

You'll need an mqtt server running or be using the home assistant add on mqtt server.

Feel free to ask what ever, am more than happy to share what I've done, just sometimes am quite busy so can be slow to reply.
That's great, many thanks; just wondering if it'd be quickest for you to create a HAExamples folder in the github repo with some of the automation scripts?
 
@sijones2010 - on any of your implementations have you perhaps experience SOC drift in terms of what the BMS is reporting being different to what the shunt reports and in turn the inverter?

I started off with all reporting 100% SOC and over the past few days it's drifted insanely where the BMS now reporting 91% SOC and the shunt/inverter reporting 100%. Seeing a downward trend as well, as in the drift appears to be getting progressively further apart.

I've verified all settings are as they should be for the Victron BMV.
 
@sijones2010 - on any of your implementations have you perhaps experience SOC drift in terms of what the BMS is reporting being different to what the shunt reports and in turn the inverter?

I started off with all reporting 100% SOC and over the past few days it's drifted insanely where the BMS now reporting 91% SOC and the shunt/inverter reporting 100%. Seeing a downward trend as well, as in the drift appears to be getting progressively further apart.

I've verified all settings are as they should be for the Victron BMV.
Yeah you do get drift, the BMS's and my Victron are all different, I trust the Victron with the SOC and it seems the most stable in my system, the Victron can be made to sync to 100% by tweaking the settings, it's difficult to get it to do this from solar though as it depends on voltage and charge current tailing off.
 
Hi All,

I've taken some code that handles Victron's VE.Direct protocol (Smart Shunt) and added in CAN Bus / PylonTech protocol connections, this allows the State of Charge, Voltage, Amps etc all be sent to the inverter - any one that supports the PylonTech protocol.

I have it connected to a Solis and works perfectly.

Secondly as it has MQTT I implemented commands that can be sent to enable and disable charging, and force charging, this I did so if solar isn't going to be good the following day (using Forecast Solar), then Home Assistant turns on the force charge and the inverter will charge the batteries, please note as per protocol it turns off at 97% SOC.

Currently I have a daly BMS on a 200amp battery pack, and a JKBMS on a 320Amp pack, tied together through the Victron Smart Shunt and it all works perfectly.

Code is here: https://github.com/sijones/VE.DirectMQTTCANBUS
Re the 48 to 5V converter - purchased & installed, but I'm not sure it's working:

I have it wired in parallel across the 16S cells; when I connect the positive lead (that goes from the main fuse) to the 16th cell's positive terminal, there's a spark - and measuring the current shows 7.7A, & a pd between the +ve terminal and the positive lead of around 51.8V, which seems to indicate that the 48 to 5V converter is a dead short; presumably that's not supposed to be the case?!
 

Attachments

  • Circuit Setup Battery Latest 241022.drawio.png
    Circuit Setup Battery Latest 241022.drawio.png
    121.6 KB · Views: 39
Pretty easy to wire up, live and neg to batteries, 5v out and neg to esp32 etc. Negative on the victron data plug is tied to negative of the battery so not a problem, don't use the 5v on the Victron as it doesn't provide enough power.

Looks like you might have had a dud, did you buy the one i linked to? the actual spec is upto 60v input so if it's 48v only then you could of blown it, all my dc-dc converters are rated to 60v as the batteries can potentially hit 58v.

If you haven't, and i can't see it in your diagram, you should have an inline fuse for the dc-dc convertor, think i use a 5amp (maybe 10amp) blade inline fuse is fine, you need to protect the wire and the unit from the high amperage that the batteries can deliver should a short circuit happen.
 
Pretty easy to wire up, live and neg to batteries, 5v out and neg to esp32 etc. Negative on the victron data plug is tied to negative of the battery so not a problem, don't use the 5v on the Victron as it doesn't provide enough power.

Looks like you might have had a dud, did you buy the one i linked to? the actual spec is upto 60v input so if it's 48v only then you could of blown it, all my dc-dc converters are rated to 60v as the batteries can potentially hit 58v.

If you haven't, and i can't see it in your diagram, you should have an inline fuse for the dc-dc convertor, think i use a 5amp (maybe 10amp) blade inline fuse is fine, you need to protect the wire and the unit from the high amperage that the batteries can deliver should a short circuit happen.

I got the GYVRM-K480505 model from Amazon ( https://amzn.to/3gFKCtT ) - but, the labelling on it is a bit contradictory in that it states:

12V/24V/36V/48V (6V-60V)

..so I'm wondering, as you say, if it's a dud, and only really works up to 48V in this case.

Anyhoo, I've ordered an alternative which takes up to 72V DC input & has dual 12V & 5V USB outputs, so let's see if that one plays nicely!
 
It's probably just a dud, they use the 12/24/36/48 so people associate it with battery voltages rather than the dc ranage. Fingers crossed the next one works for you.
 
It's probably just a dud, they use the 12/24/36/48 so people associate it with battery voltages rather than the dc ranage. Fingers crossed the next one works for you.
Arriving tomorrow so hopefully good news here soon :)
 
Arriving tomorrow so hopefully good news here soon :)
I'd suggest just wiring it to the batteries and then check the output before putting anything on it. I feed the 5v out to the Vin of the esp32, I don't use any other regulator inline, did once but blew the regulator and dc-dc convertor but that's a different story!
 
I'd suggest just wiring it to the batteries and then check the output before putting anything on it. I feed the 5v out to the Vin of the esp32, I don't use any other regulator inline, did once but blew the regulator and dc-dc convertor but that's a different story!
Yes, good plan :)
 

diy solar

diy solar
Back
Top