diy solar

diy solar

Daly2Sofar ESP32 based BMS to Inverter bridge, with added MQTT

loopyengineering_co

New Member
Joined
Mar 18, 2022
Messages
4
Hi guys.
I've made a thingie that allows you to use the Daly BMS with Sofar inverters (and others that use the SMA canbus protocol).
164516928-52ea70e6-35d5-4c46-9d18-d0e2efe84e6b.png


It talks to Daly via UART (where the Bluetooth dongle plugs in), translates the data and sends it via CANBUS to the inverter to keep it happy, and also connects to WiFi, subscribes to your MQTT broker and publishes all the data.

I know a lot of people use the Seplos BMS as it has native support for this, but the Dalys have their own advantages and this device also passes very fresh and very frequent data via WiFi (MQTT) to Home Assistant and suchlike.
164439575-7c585c8e-12b4-412a-9ef5-60dd962c2ea7.jpg


It's still beta, but it works.

Check it out and give me any feedback for improvement :)

 
Nice one :)

I must add this to my, increasingly long, "list of things to try", it would be nice for my Sofar HYD5000ES to talk to the Daly BMS.

So many things to do, so little time to do them whilst actually earning the $$$ to pay for them :whistle:
 
Nice one :)

I must add this to my, increasingly long, "list of things to try", it would be nice for my Sofar HYD5000ES to talk to the Daly BMS.

So many things to do, so little time to do them whilst actually earning the $$$ to pay for them :whistle:
I know the predicament very well. This was made in 2 hour increments in the middle of the night over 3 weeks ?.
Thanks for the link to the isolator, I ordered a few to try out
 
Hi guys.
I've made a thingie that allows you to use the Daly BMS with Sofar inverters (and others that use the SMA canbus protocol).
164516928-52ea70e6-35d5-4c46-9d18-d0e2efe84e6b.png


It talks to Daly via UART (where the Bluetooth dongle plugs in), translates the data and sends it via CANBUS to the inverter to keep it happy, and also connects to WiFi, subscribes to your MQTT broker and publishes all the data.

I know a lot of people use the Seplos BMS as it has native support for this, but the Dalys have their own advantages and this device also passes very fresh and very frequent data via WiFi (MQTT) to Home Assistant and suchlike.
164439575-7c585c8e-12b4-412a-9ef5-60dd962c2ea7.jpg


It's still beta, but it works.

Check it out and give me any feedback for improvement :)

I tried something similar (not as neat) but found the UART serial interface very slow compared to the Daly BMS interface. I found that I had to introduce timing delays to ensure I received the requested UART data and these delays compounded with each request. I was concerned about getting an alarm output quickly so that a WS500 alternator controller could shut down asap. (I know alarm timing would not be as important re solar) Do you see much latency in the UART connection for an alarm situation? Thanks
 
Last edited:
I tried something similar (not as neat) but found the UART serial interface very slow compared to the Daly BMS interface. I found that I had to introduce timing delays to ensure I received the requested UART data and these delays compounded with each request. I was concerned about getting an alarm output quickly so that a WS500 alternator controller could shut down asap. (I know alarm timing would not be as important re solar) Do you see much latency in the UART connection for an alarm situation? Thanks

Thanks for your input: I did actually have to slow down the polling rate to the BMS because there wasn't enough time to fully receive the data. I can't remember what the threshold was, but currently the data is being requested every 1s, and what is being requested toggles between 3 different request types so actually the same parameter is being requested every 3s.
I found this to be plenty fast for the Sofar inverter to be happy (I think it complains only after about 10s or so) and not too fast to overwhelm the MQTT network.
My code doesn't specifically process alarms from the Daly (not sure if this is possible?!), so for an alarm state this might be too slow. The BMS itself would intervene in most scenarios, disconnecting the cells, so I'm not sure there's much value in that?
I'm not familiar with the WS500 alternator controller but it looks super interesting. Can it control 48v alternators from the likes of Delco etc, via software?
 
Thanks for your input: I did actually have to slow down the polling rate to the BMS because there wasn't enough time to fully receive the data. I can't remember what the threshold was, but currently the data is being requested every 1s, and what is being requested toggles between 3 different request types so actually the same parameter is being requested every 3s.
I found this to be plenty fast for the Sofar inverter to be happy (I think it complains only after about 10s or so) and not too fast to overwhelm the MQTT network.
My code doesn't specifically process alarms from the Daly (not sure if this is possible?!), so for an alarm state this might be too slow. The BMS itself would intervene in most scenarios, disconnecting the cells, so I'm not sure there's much value in that?
I'm not familiar with the WS500 alternator controller but it looks super interesting. Can it control 48v alternators from the likes of Delco etc, via software?
Thank you so much for your reply. Your findings are similar to mine, in that I had to slow down polling to the point where an alarm signal would be of little value. Hence I went with a Daly c/w CANBUS and did a Daly CANBUS to SMA/Victron CANBUS translation using a PI for now. This is for a solar array and engine alternator control on my sailboat. The alternator needs a 2 second warning that the BMS is in trouble so it can drop the field voltage to zero before the disconnect. Otherwise the alternator diodes could get fried. Thanks again for getting back to me. BTW the WS500 can control alternators up to 48 volts as long as they don’t have internal regulation.
 
Last edited:
Your Daly2Sofar project is very interesting, I have a JDB Bms and looking to send the data via CanBus to a Solis Hybrid inverter.
I have successfully taken the data from JDB Bms via the RS485 port using Arduino Nano and Oled display.
Have you tried other Bms types in your code, or know some one who has used this Bms instead of Daly?

Since my last post in Feb, I have built a JDB BMS bridge to Solis Hybrid inverter.
Using part of your code, but instead of the SMA protocol, I have successfully converted it to the Pylontect protocol.
Hardware: JDB BMS > RS485-UART converter > ESP32 Dev, > SN65HVD230, with OLED display.
Library: ESP32CAN.h
To test the CAN output I used a Nano and a MCP2515 module with Arduino-mcp2515.h library,
the Pylon output gives 5 messages every second. (setNormalMode, 500KBPS)

ID DLC DATA
359 7 0 0 0 0 0 51 41 : Protection & Alarms
351 6 26 2 CB 0 90 1 : Battery Voltage/Current Limits
355 4 43 0 63 0 : SoC/SoH
356 6 EE 14 6F 0 E 1 : Voltage/Current/Temp
35C 2 C0 0 : Request Flags
35E 8 50 59 4C 4F 4E 20 20 20 : Manufacture PYLON

Here's the problem, when I connect it to the Solis inveter it gives an Alarm Fault.
I tried setting the inverter to Pylon LV and User define both give an fault.

So tried to read the output from the inverter using the Nano - Nothing!
Should be ID 305 DLC 8 Data 0 0 0 0 0 0 0 0
However with same Nano but with the library mcp_can.h by Corjfowler it reads perfectly, Why?
Any help would be appreciated.
 
Last edited:
Hi

Has anyone got anywhere implementing an esp32 BMS to Solis inverter CAN interface.?? Ideally in Arduino. I'm aware of a semi commercial offering out there on github etc with binaries however ive been looking around for some source code examples as i want to be able to hack it around and put it on something like the Lilygo T-display S3 ot their 485 to CAN module. Ultimately i want to go JK bms to a Solis EH1 (Plyontech or SMA). Anyone know of any code for achieving that? Cheers Steve
 
Last edited:
Hi

Has anyone got anywhere implementing an esp32 BMS to Solis inverter CAN interface.?? Ideally in Arduino. I'm aware of a semi commercial offering out there on github etc with binaries however ive been looking around for some source code examples as i want to be able to hack it around and put it on something like the Lilygo T-display S3 ot their 485 to CAN module. Ultimately i want to go JK bms to a Solis EH1 (Plyontech or SMA). Anyone know of any code for achieving that? Cheers Steve
Sure...

I have done JBD to Solis...

Better to use vanilla SMA protocol and user-defined setting on the Solis, rather than PylonLV battery type. The guts of my JBD to Solis interface uses the code from Simon, found here...
but with the Victron VE bits removed and replaced to interface to the UART port of my (Overkill) JBD BMS, using this library..

There is also this person's project, though I have no experience of using his code...

Obviously you'll need to do the Daly/JK specific UART interface bit.
 
Further thought...
485 to CAN module
Obviously for the Solis EH1P, you'll need CANBus for the BMS interface.

If you want to tinker with controlling / reading Solis RS485 meter or comms port, take a look at @peufeu's code here
Though that is Pi / python, not Arduino.
That whole thread will probably be of interest to you anyway :)
 
Further thought...

Obviously for the Solis EH1P, you'll need CANBus for the BMS interface.

If you want to tinker with controlling / reading Solis RS485 meter or comms port, take a look at @peufeu's code here
Though that is Pi / python, not Arduino.
That whole thread will probably be of interest to you anyway :)
Sure...

I have done JBD to Solis...

Better to use vanilla SMA protocol and user-defined setting on the Solis, rather than PylonLV battery type. The guts of my JBD to Solis interface uses the code from Simon, found here...
but with the Victron VE bits removed and replaced to interface to the UART port of my (Overkill) JBD BMS, using this library..

There is also this person's project, though I have no experience of using his code...

Obviously you'll need to do the Daly/JK specific UART interface bit.
Sure...

I have done JBD to Solis...

Better to use vanilla SMA protocol and user-defined setting on the Solis, rather than PylonLV battery type. The guts of my JBD to Solis interface uses the code from Simon, found here...
but with the Victron VE bits removed and replaced to interface to the UART port of my (Overkill) JBD BMS, using this library..

There is also this person's project, though I have no experience of using his code...

Obviously you'll need to do the Daly/JK specific UART interface bit.

Many thanks SeaGal for those pointers.
Given my pathetic coding speed this should keep me amused for months!. I already have some JKBMS interrogation code working using either the 485 UART interface on the BMS, or by using BLE (which actually seems pretty robust) . I like the Lilygo T-Display

Interesting you say 'better to use the SMA protocol', Simon and others seem to err towards Pylontech ...I am on a bit of a learning curve here so understanding the protocol and potential Inverter functionality differences from different protocols (if any) is something I need to dig into more (I'm interested in being able to reduce the inverter current at higher SOCs when the Delta V for max to min cell voltages starts creeping up - that seems attractive to improve balancing and is something Simon has mentioned).

I've seen some articles suggesting the MCP2515 CAN interface requires a 16Mhz Xtal but in Simons photos it looks like an 8MHz is used - again I need to dig more!.

I'm collecting my Solis EH1 next week and have more LiFePO4 cells on a slow boat from China. Once I get something working I will post details.
Cheers, Steve
 
Many thanks SeaGal for those pointers.
YW.

Given my pathetic coding speed this should keep me amused for months!.
A software engineer's work is never done. I am still tweaking mine after 15 months, adding new functionality etc. ?‍?

Interesting you say 'better to use the SMA protocol', Simon and others seem to err towards Pylontech
Not really - guess you missed this comment...
The pylontech protocol full enabled doesn't seem to work on my inverter anymore since it had a firmware update from Solis, turn the protocol off in the code, and use user-defined on the inverter works fine.
Also the 'force charge' setting in pylon never worked properly with the Solis and using Pylon with Solis was less tolerant of CAN message timings variances.

I need to dig into more (I'm interested in being able to reduce the inverter current at higher SOCs when the Delta V for max to min cell voltages starts creeping up - that seems attractive to improve balancing and is something Simon has mentioned).
And, to a degree, that logic is already in his code. I've taken the "reduce charge as SOC goes above 90%" to a finer degree of control in my software. This is because interfacting directly to the BMS gave me access to individual cell voltages and temperature. Hence, I implemented a charge rate that is not only dependent on SOC, but also max cell voltage and temperature - detailed a bit more in my posting below...


I've seen some articles suggesting the MCP2515 CAN interface requires a 16Mhz Xtal but in Simons photos it looks like an 8MHz is used - again I need to dig more!.
8MHz version is working well for me. This one...

I'm collecting my Solis EH1 next week and have more LiFePO4 cells on a slow boat from China. Once I get something working I will post details.
:) (y)
 
Back
Top