diy solar

diy solar

Victron VenusOS driver for serial connected BMS - JBD / Daly / ANT / JKBMS / Heltec / Renogy / Tian / ECS

Hello Luis,

(This is a duplicate post from the community.victronenergy.com site ... my account is new, less than 2 months, so they require post approval from moderator... but for some reason they haven't reviewed/approved my first post over a month ago)

Thank you very much for creating this module and your continued work on it.

I have a Daly 12V250A BMS and running Venus OS on rPi3B+.

I first installed your code a couple months ago. For some reason I could not get it to work. Today pulled the lasted code and am pleased to find it now recognizes the Daly BMS.

I noticed that the displayed current is inverted on both the Remote Console and VRM so I changed line 77 of your file daly.py to be as follows:
Python:
self.current = -((current - self.CURRENT_ZERO_CONSTANT) / -10)

This restores the correct current flow direction. I had read elsewhere that Daly reverses their current flow so I'm guessing that the BMS I have is a newer model and they have corrected the current flow data since my Bluetooth app doesn't show reversed current flow as others have reported.

To further help others, I set a flag in file utils.py to indicate whether the BMS reports inverted current flow:
Python:
# battery Current limits
MAX_BATTERY_CURRENT = 120.0
MAX_BATTERY_DISCHARGE_CURRENT = 150.0
# BMS reports inverted current flow
INVERTED_CURRENT_FLOW = False

Then in file daly.py replaced line 77 with:
Python:
if INVERTED_CURRENT_FLOW is True:
    self.current = (current - self.CURRENT_ZERO_CONSTANT) / -10
else:
    self.current = -((current - self.CURRENT_ZERO_CONSTANT) / -10)

I hope this helps.
 
Hi @CaptKrisp
Thanks for the post. The V0.9.1 include a current swop option for the Daly BMS. You could also give that a test, as some users have indicated that they are struggling with it.

In utils.py line 24-25 you can make the invert flag -1 like so
# Invert Battery Current. Default non-inverted. Set to -1 to invert
INVERT_CURRENT_MEASUREMENT = -1

and then in Daly you will see at line 77 it looks like this (nothing to change here)
self.current = (current - self.CURRENT_ZERO_CONSTANT) / -10 * INVERT_CURRENT_MEASUREMENT
 
I've got a PC case fan here as well, but on the female connector, the pin holes are 2.5mm apart.

I just checked my BMS, pins are 1.25mm apart, so that won't fit.

I did find these, 3 or 4 pins available:
Received the 3-pin cables (JST 1.25mm), I can confirm these fit the tiny connectors on the JK BMS.
 
Hi @CaptKrisp
Thanks for the post. The V0.9.1 include a current swop option for the Daly BMS. You could also give that a test, as some users have indicated that they are struggling with it.

In utils.py line 24-25 you can make the invert flag -1 like so


and then in Daly you will see at line 77 it looks like this (nothing to change here)
Thanks @Louisvdw
Even though those files were updated 3 weeks ago the install/update script didn't pull them yesterday... but it did today!
 
I talked to JK BMS and got something of an answer. The official converter connects to the GPS port with its 4 pin connector, this port also (I think) shares the same output as the rs485 port.
On second thoughts.. the support team mentioned a "typographical error" and I wonder if they were referring to the fact that one port is labelled rs485 but actually isn't, they weren't very clear. Either way the GPS port is what JK use for communication.
As for what the white port connector is called, they just said "sorry, we only recommend using official converter".
Hi all
Just need some info, as i am a little confused
I have the jk bms and the rs485 module that comes as an extra
4 pin connector on 1 side that plugs into the bms then the module and 3 wires that come out of the module.
Do i then connect those 3 wires to a usb or do i remove the module and get just a rs485 cable to bms and usb to cerbo
 
I have the jk bms and the rs485 module that comes as an extra
4 pin connector on 1 side that plugs into the bms then the module and 3 wires that come out of the module.
Do i then connect those 3 wires to a usb or do i remove the module and get just a rs485 cable to bms and usb to cerbo
You need a USB-RS485 converter. Those wires connect into the converter that you plug into your cerbo's USB.
I use this model and you connect the Ground, A, B wires.
 
You need a USB-RS485 converter. Those wires connect into the converter that you plug into your cerbo's USB.
I use this model and you connect the Ground, A, B wires.
Thanks for the reply.
So i still use the converter that came with the jk bms.
I buy the converter you recommend, i then attach the 3 wires from the converter to the rs485-usb and then buy another cable from that converter to the cerbo.... correct
Cheers
 
Corrent yes.
You can get other models of the USB converter that come with USB connector that you plug into the cerbo directly (flash drive shape).
Also remember that the cerbo does have a bug where it does not install using the auto installer, so you will have to use the SSH method.
 
Is there a setting to stop the sinowealth driver from misreading my usb gps and throwing high/low voltage warning codes?

I have a multiplus and bvm712 connected with victron vebus cables to a venus pi. I have a ublox gps connected by a ch340 usb converter to the pi, as well. It works great!
I have installed the sinowealth driver but not wired up my bms.
Sometimes, it glitches, looses the connection to the multiplus, misidentifies/reads my usbgps as a bms, and throws high/low voltage warnings.

Is there something I can do to prevent this?
 
Hello All,

I created a small script to help with restoring my configs in utils.py and thought others might like to use it.
The script will download and install the latest release of serialbattery and if a configs file exists, in format of sed commands (default: serialbattery-configs.sed), the script will update the file utils.py with your specific system configs.

Attached is a zip file containing the files "install-update_serialbattery.sh" and "serialbattery-configs.sed" (as used in my system), and included here for convenience.

install-update_serialbattery.sh
Bash:
#!/bin/bash

echo "Installing or updating Serial Battery BMS support."
echo "[ from https://github.com/Louisvdw/dbus-serialbattery/wiki ]"
echo
curl -s https://api.github.com/repos/Louisvdw/dbus-serialbattery/releases/latest | grep "browser_download_url.*gz" | cut -d : -f 2,3 | tr -d \" | wget -O venus-data.tar.gz -qi - | tar -zxf venus-data.tar.gz -C /data

battCfgFile="/data/etc/dbus-serialbattery/utils.py"
sedCmdsFile="serialbattery-configs.sed"
echo
echo "In VenusOS, enable DVCC and leave all DVCC suboptions disabled (unless need to limit charge current)"
echo "Limits might be set at:"
echo "50A charge"
echo "60A discharge"
echo "Edit file $battCfgFile to change these limits (will likely be overwritten with updates)"
echo
echo "--- For 3.2V 302A LiFePO4 batteries, set the following parameters in $battCfgFile ---"
echo "# Cell min/max voltages - used with the cell count to get the min/max battery voltage"
echo "MIN_CELL_VOLTAGE = 2.5"
echo "MAX_CELL_VOLTAGE = 3.65"
echo "# battery Current limits"
echo "MAX_BATTERY_CURRENT = 120.0"
echo "MAX_BATTERY_DISCHARGE_CURRENT = 150.0"
echo
echo "--- For the Daly 12V 250A BMS, set the following parameters in $battCfgFile ---"
echo "# Invert Battery Current. Default non-inverted. Set to -1 to invert"
echo "INVERT_CURRENT_MEASUREMENT = -1"
echo
if [ -e $sedCmdsFile ]; then
    echo "-> Executing 'sed -i -f $sedCmdsFile $battCfgFile'"
    sed -i -f $sedCmdsFile $battCfgFile
    echo "--- Displaying known relevant lines in file $battCfgFile"
    echo "--- - Please verify that they are correct values"
    #grep 'MIN_CELL\|MAX_CELL\|MAX_BATTERY\|INVERT_CURRENT_MEASUREMENT' $battCfgFile
    for a in `/bin/sed 's/s\///' smart-bms-configs.sed | /usr/bin/awk -F= '{print $1}'`; do
        /bin/grep $a /data/etc/dbus-serialbattery/utils.py;
    done
else
    echo "Create the file $sedCmdsFile to auto replace the default values in file $battCfgFile"
    echo "The contents of the file $sedCmdsFile are 'sed' commands. One command per line."
    echo "   Example replace string command:"
    echo "   s/MIN_CELL_VOLTAGE = 3.1/MIN_CELL_VOLTAGE = 2.5/"
    echo
fi

serialbattery-configs.sed
Code:
s/MIN_CELL_VOLTAGE = 3.1/MIN_CELL_VOLTAGE = 2.5/
s/MAX_CELL_VOLTAGE = 3.45/MAX_CELL_VOLTAGE = 3.65/
s/MAX_BATTERY_CURRENT = 50.0/MAX_BATTERY_CURRENT = 120.0/
s/MAX_BATTERY_DISCHARGE_CURRENT = 60.0/MAX_BATTERY_DISCHARGE_CURRENT = 150.0/
s/INVERT_CURRENT_MEASUREMENT = 1/INVERT_CURRENT_MEASUREMENT = -1/

Enjoy.

Cap
 

Attachments

  • install-update_serialbattery.zip
    2.2 KB · Views: 10
Ah wait. the VeDirect cable isolated, so you will need to connect the power wire as well. You will have to unplug the bluetooth cable and use that port for the USB converter. Use the same pinout as what the bluetooth cable used. Black and Red is ground and power. The other 2 is Rx/Tx. I'll look for a picture for you.
Got it up and running. I used a isolated TTL convertor off Amazon in the end worked a treat. Just connected the tx rx and gnd.
 
Can anyone help with why my SOC is showing 0% with an alarm it has gone up to 2%. The battery is fully charged and was at 100% when i had it conencted to the bluetooth module.
1640017379136.png
 
The JBD start the SOC at 0% when you built the battery. Just ignore the low SOC for now and cycle the battery1 or 2 times and it will correct itself.
You can also try and change the SOC value inside the BMS using the BMS app, but depending on which app you use you might not have access to that. Easiest is just the cycle the battery.
 
Does someone have troubles with this driver an Venus v3.80~38?

I keep getting "The device is not available" and when I restart the Raspi I see the driver values again. After a few minutes, the device is unavailable again. It looks like the driver crashes and doesn't restart itself automatically.
 
There can be some small issues with the VenusOS 2.80 firmware. The log file will give you the details. Troubleshoot in the wiki
If it shows a repeated crash please log a bug with the logfile so that we can look at it.
Thank you for the Info.

My log (/data/log/dbus-serialbattery.ttyUSB0/current) shows:
@4000000061e6c78118715cc4 WARNING:SerialBattery:dbus-serialbattery v0.1
@4000000061e6c781189530a4 WARNING:SerialBattery:Testing LltJbd
@4000000061e6c7812a7cafa4 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000061e6c7812ab5a1c4 WARNING:SerialBattery:Testing Ant
@4000000061e6c78200d35784 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000061e6c78200e554fc ERROR:SerialBattery:>>> ERROR: Incorrect Data
@4000000061e6c78200ee74ec WARNING:SerialBattery:Testing Daly
@4000000061e6c78203ef7434 WARNING:SerialBattery:Connection established to Daly
@4000000061e6c78207a2a894 WARNING:SerialBattery:Battery connected to dbus from /dev/ttyUSB0
@4000000061e712f838ef571c ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000061e7131704c65fbc ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000061e7135b040f8b0c ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000061e7137302d37514 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000061e71383067b2c0c ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000061e713890c4eb414 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000061e713cb0e1e0d44 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000061e713e10cee2c4c ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000061e713f912373734 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000061e7142d1215d454 ERROR:SerialBattery:>>> ERROR: No reply - returning
...


It looks like the ttyUSB0 does not work from time to time...

tail -f /data/log/serial-starter/current shows:

@4000000061e6c77e24ca0994 find: /service/dbus-serialbattery/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service/service: Too many levels of symbolic links
@4000000061e6c77e2b80507c serstart starting
@4000000061e6c77e2d47aeb4 INFO: loading config file /etc/venus/serial-starter.conf
@4000000061e6c77f107f424c INFO: loading config file /data/conf/serial-starter.d
@4000000061e6c7803715e3fc INFO: Create daemontools service dbus-serialbattery.ttyUSB0
@4000000061e6c7820da0078c INFO: Create daemontools service vedirect-interface.ttyUSB1
@4000000061e6c78330fd86dc INFO: Create daemontools service vedirect-interface.ttyUSB2
@4000000061e6c78704c9c6d4 INFO: Start service dbus-serialbattery.ttyUSB0 once
@4000000061e6c78813c17114 INFO: Start service vedirect-interface.ttyUSB1
@4000000061e6c78a0011826c INFO: Start service vedirect-interface.ttyUSB2
 
Last edited:
Back
Top