Louisvdw / dbus-serialbattery

Battery Monitor driver for serial battery in VenusOS GX systems
MIT License
522 stars 164 forks source link

Handle multiple battery modules #8

Closed Louisvdw closed 6 months ago

Louisvdw commented 3 years ago

Handle multiple battery modules

rocky00717 commented 3 years ago

Any updates on this?

Louisvdw commented 3 years ago

I'm waiting for my second BMS to arrive. Seem that the factory has run out of RS485 chips.

xerootg commented 3 years ago

Do you have ideas about what it would take to make this happen? I have two batteries, both ble (nordic) central mode uart, that I'd like to use with your library, but seems like even before jumping into ble code, multiple battery support should happen.

Louisvdw commented 3 years ago

@xerootg you will first need to get the driver to talk to your one battery, so I would suggest starting with that. There is a battery_template.py file that you can copy as a base for your BMS. Be sure to submit a pull request when you are done. If you need help just should out in the forum. Once you have your BMS talking to the driver all features will be availble, including this one for multiple battery modules.

liufuyang commented 3 years ago

Interesting. I am also waiting for my BMS to arrive and I have 2 battery packs. Perhaps I can help testing as well. But these "driver" thing is definitely new to me. Maybe some of you have some good source I can take a quick look somewhere? I also purchased a QUCC BMS I think this will support that well. Looks like the US sanction on China really taking some effects as the chips are now feels really in low supply... The QUCC BMS is not shipped yet as the seller says the RS485 will arrive for them in a few days then he can ship everything to me together.

sideburnie commented 3 years ago

following

dakoal commented 2 years ago

Hi. What if 2 TTL-USB Adapters are connected? Not RS485 and two dalys at one Adapter but 2 dalys on two adapters?

ttyUSB0 and ttyUSB1

I can try to build this today. you can still ssh to my cerbo.

Louisvdw commented 2 years ago

What if 2 TTL-USB Adapters are connected? Not RS485 and two dalys at one Adapter but 2 dalys on two adapters?

You have the same issue with 2x TTL links or 1x RS485 linked to2 BMS. The one battery will override the data from the next. I already have 2 TTL linked BMS connected on my setup so that should work. You can see the data in Remote Console and the alarms from any one will show in VRM, but only the first BMS data is used and display.

Hhalewijn commented 2 years ago

I have 2 BMS connected. A third one will be connected next week. The two show up in remote console but as stated before, only one can be selected for advanced reporting. I hope this will be added. Please keep me updated on this.

coca7 commented 2 years ago

I have three JBD BMS's in my system. I have the first one connected using the driver to see how it works with my system.

coca7 commented 2 years ago

Reading through the comments I noticed that of the people who have tried connecting multiple batteries, I don't think anyone has connected more than two. I connected my three today and two of the three are visible along with my smartShunt. IMG_3A3E3E57845C-1

Hhalewijn commented 2 years ago

Hi Coca7, I've three up and running. It is as Louis says, the number does not matter, it is the behaviour of Victron that does not allow to have more than one BMS that can be selected. I think we would like to have some kind of virtual device that can be selected for Battery Monitoring and that aggregates the information from the individual devices. image

coca7 commented 2 years ago

Thanks @Hhalewijn I knew what Louis said. I just wanted to log the behavior if no one had observed it yet.

damonblumenstein commented 2 years ago

@Louisvdw do you have an ETA on this and can it be done over BT with the CerboGX so you don't need to run USB-UART adapters eliminating the ability to use the XiaXang app?

Louisvdw commented 2 years ago

Bluetooth is not is the near term plan, but there is an ticket for it https://github.com/Louisvdw/dbus-serialbattery/issues/13 The multi bank should be the next feature completed as I am currently working on it and the V2.80 firmware issue.

centro-max commented 2 years ago

@Louisvdw can you foresee when you will get the update for the multi-bms problem with the victron version 2.8X?

your work is fantastic, compliments!

If you need a tester, i connected 2 daly-bms to my raspberrypi

herrep commented 2 years ago

@Louisvdw Great work!

At present, I have not set up my Victron inverter/charger + BMS so far, I am gathering information for the correct setup where I will have at least two battery banks in parallel.

What I understand from the screenshots posted above is that only very basic monitoring is possible when connecting more than one BMS via RS485 to the Venus OS based hardware. In this case, all connected BMS are shown and its associated SOC, present voltage and present current. But the detailed analysis will show only one BMS.

Is my understanding correct or did I miss something?

Louisvdw commented 2 years ago

Hi @herrep All the same details are available for each connected BMS when you look at it inside the Remote Console. (and venusOS not V2.80 or higher). But as a Battery Monitor only the values from one BMS is used in the GX and published to VRM. That is what this ticket is looking to solve.

pedrorampolla commented 2 years ago

Any updates on this? I have 3 JBD BMS and even renaming them as separate instances would be awesome. Willing to test. Using Firmware 2.73 and v0.10 so I can see them all in the device list.

Louisvdw commented 2 years ago

There is a new 0.11beta4 release that should solve many of the issues the driver had on the newer v2.80 and higher firmware. You should be able to see all the BMS in the device details list like on the V2.73 firmware. If I can get a bit more feedback from more people if this solves the issues in 2.80 I can release it as the next version.

Those issues have been holding back this feature as you can't have multiple banks if you cannot see them.

centro-max commented 2 years ago

OS 2.87 now shows 2 Daly-BMS with 011beta4 - that is fine!

BUT

the fill level, the total voltage and the current [A] are read out correctly, only the minimum and maximum cell voltage in the detail page is incorrect. Each cell has 3,4V in this moment.

2-87-beta4-0 2-87-beta4-1 2-87-beta4-2

pedrorampolla commented 2 years ago

Updated to 2.87 and installed beta .11b4. Now only one JBD BMS shows up at a time. 7D3C90DB-0ECE-426A-8E2D-780B1155F1F5

Louisvdw commented 2 years ago

Now only one JBD BMS shows up at a time.

What install method did you use to upgrade the driver? And did you reboot afterwards?

pedrorampolla commented 2 years ago

Blind install with a USB drive. and then a reboot.

Louisvdw commented 2 years ago

Blind install with a USB drive. and then a reboot.

I did a change in how the auto install calls the installer in the new v0.12 release. Try and see if that solves your auto install only showing 1 BMS. It might also help to install a new venus firmware - this resets and force the driver to reinstall.

coca7 commented 2 years ago

After installing v.12 on my Cerbo GX (v2.87) I can see all three BMS's and the smart shunt.

BMS
arnoc-intuvision commented 2 years ago

Hi @coca7, I would like to know if all 3 your LLT/JBD BMS's are connected to one /dev/ttyUSBx port ? Or is each BMS connected to its own serial port ?

I've added a driver to integrate with Polarium Gen5 batteries, and I can see the first BMS in the Cerbo GX Web UI, but I would like to have multiple Polarium BMS's connected in cascade (RS485), Modbus ID 1, 2, 3, x etc, and have them all show up on the Cerbo GX Web UI as well as in the VRM Portal.

image

coca7 commented 2 years ago

@arnoc-intuvision They are on different ports. On my physical gx device one is plugged directly the other two are plugged in through a hub.

Louisvdw commented 2 years ago

You need a seperate serial connection for each BMS. The connection works the same for RS485, RS232 or TTL and of these only RS485 have the option to do multiple devices on the same data lines.

arnoc-intuvision commented 2 years ago

Hi @Louisvdw , Yes, I'm using a USB-to-RS485 cable to connect with the Polarium BMS(s). Each battery has 2 ports, A & B, I'm connecting the Cerbo GX device to BMS-1's port A, then port B of BMS-1 connects to port A of BMS-2. So the first BMS will have slave id 1, and the second BMS slave id 2 and so on. It would be great if I only have to use 1 x USB-to-Serial (RS485) cable and read at least 5 x BMS batteries connected in a serial cascading manner.

Louisvdw commented 2 years ago

Currently that will not work. You need to use a USB-RS485 converter for each BMS. So if you have 3 BMS then you will need 3 USB ports, one to plug in each of the BMS.

Edit: I have created a issue to look at this is future.

KRUP85 commented 2 years ago

I have a question about CCCM. If multiple BMS are used (three for example) will this feature work? Will the current (charge/discharge) be limited when any BMS reaches a limit value? I plan to probably also use SMARTChunt, but only as a display of total values.

Thanks

Louisvdw commented 2 years ago

That is one of the more involved pieces of the multi bank change. At the moment CCCM will only follow the bank that is published, but when multi banks are supported it will have to look at all the banks, so there will be some changes

XBeg9 commented 2 years ago

I am curious if I have 2 serial batteries in my GX listed without no issues (using 2 JBDs BMS with separate USB-serial connections), but the question is which one to select as the main battery, you can do either one, but not both at the same time, looks like there is a need for the shunt in this case?

Marv2190 commented 2 years ago

This is the issue about. The driver "needs" to collect all BMS data (of any number of devices), aggregate them and publish it into the venus-os as one device.

herrep commented 2 years ago

I try to summarize the current behavior of the v0.12 driver when having multiple battery modules with a BMS for each battery module:

  1. The BMS information for each battery module is displayed separately.
  2. Only the BMS information of the first battery module will be used for DVCC related controlling.
  3. Therefore, the DVCC limitations calculated for the other battery banks will be ignored as only the limitations of the first BMS will become active for all battery modules.

Is my understanding correct?

himse1f commented 2 years ago

is it possible to rename each BMS if we are running multiple? I would love to be able to change their names, if possible. I am running CergoGX v2.89 and the v0.12 release version. I love this driver, thank you!!!!!!!!! serial /dev/ttyUSB1 serial /dev/ttyUSB2 serial /dev/ttyUSB3 serial /dev/ttyUSB4 Capture

Louisvdw commented 2 years ago

There is a ticket open to do that https://github.com/Louisvdw/dbus-serialbattery/issues/100

merlep commented 2 years ago

After installing v.12 on my Cerbo GX (v2.87) I can see all three BMS's and the smart shunt. BMS With 3 JK's and one smart shunt can you force the smart shunt to be the unit that's displayed in the VRM? If so, is it also the one which the Venus considers the master ( in terms of certain ESS descisions based on SOC )

Louisvdw commented 2 years ago

@merlep Just manually set the SmartShunt as the Battery Monitor and it's SOC will be the system SOC. Just note that the CCCM feature works from the BMS SOC and not the system SOC.

merlep commented 2 years ago

Cool, can one disable the CCCM feature ? I do not need/want it to operate - main reason being is that 2 or my 3 JK's jump to 99% SOC as soon as charging resumes after sunrise even when SOC is actually 70% . Really annoying. The 2 are both 150A JK's , whilst the 200A JK works reasonably well ( no where near as good as the BMV 702 )

Louisvdw commented 2 years ago

Change CCCM_ENABLE in utils.py (around line 25/27)

corneel27 commented 1 year ago

I am very pleased with your driver. I used it for two JBD 16s connected with two usb - rs485 (with a hub) to a Multiplus gx. I found out that the max current limits are to low with two bms's. I cannot charge more than 25 A per battery pack. Also discharge is a factor 2 to low. I have manually changed (100 and 120A) these limits (in utils.py) and now its working good. I think this is an attention point to handle multiple modules.

Louisvdw commented 1 year ago

Yes that is part of what it will do. At the moment it thinks there is only one battery to charge, but they will accumulate.

jvaartjes commented 1 year ago

image

Here it works well with 3x Daly BMS and a BMV 712 Battery monitor. Only thing that would be nice is to somehow being able to rename the the BMSes in GX or in the driver itself. Like Daly BMS ttyUSB0, ttyUSB1 etc. that way I can label connectors and USB ports so I always know what Battery bank I am looking at

jvaartjes commented 1 year ago

image Nevermind, I figured it out. Here is the dirty fix for now. I will fork and find a nicer way to change and create pull request. But I don't have time now. Keep in mind that the order of ttyUSBx can change if you move USB connectors around, or if you update Venus OS (I run 2.91). If you make changes, it is wise to plug in one by one and check if your labels match what you see in the remote console. The original Daly USB cables come with a CH340 chip which does not have storage for a serial number.

Edit /data/etc/dbushelper.py

Search for ProductName and change the line to: self._dbusservice.add_path('/ProductName', 'Batt(' + self.battery.type + ' '+ self.battery.port +') v' + str(DRIVER_VERSION) + DRIVER_SUBVERSION)

merlep commented 1 year ago

image Nevermind, I figured it out. Here is the dirty fix for now. I will fork and find a nicer way to change and create pull request. But I don't have time now. Keep in mind that the order of ttyUSBx can change if you move USB connectors around, or if you update Venus OS (I run 2.91). If you make changes, it is wise to plug in one by one and check if your labels match what you see in the remote console. The original Daly USB cables come with a CH340 chip which does not have storage for a serial number.

Edit /data/etc/dbushelper.py

Search for ProductName and change the line to: self._dbusservice.add_path('/ProductName', 'Batt(' + self.battery.type + ' '+ self.battery.port +') v' + str(DRIVER_VERSION) + DRIVER_SUBVERSION)

Would you be able to provide a short .csv file from the VRM for your system. I'd like to see exactly what the smartshunt and 3 Dalys provide to VRM, thanks

jvaartjes commented 1 year ago

I am not sure how to export a CSV with hardware, just statistics. Feel free to message me if you have specific questions. My setup: 2x Multiplus 2 48/3000/35-32 1x Multiplus 2 GX 48/3000/35-32 (buildin GX) 1x BMV 712 Smart (Victron) 3x Daly BMS 16S 150A with USB Uart Serial connector (not RS485) 1x LogiLink UA0148 USB 2.0 HUB (which is powered but use without powersupply) 48x EVE LF280K (AliExpress) AC Coupled SolarEdge SE7K on Modbus TCP SunSpec 1x ET340 on Victron RS485 but I am not using at them moment, due to incorrect values 1x MQTT broker connected to the GX

pos-ei-don commented 1 year ago

How did you connect an external mqtt Broker to the gx?

jvaartjes commented 1 year ago

How did you connect an external mqtt Broker to the gx?

Add the following to your mosquitto.conf (replace the IP 192.168.0.1 with your GX ip) : connection victron-bridge address 192.168.0.1:1883 topic # both 0 victron/