Dual Leaf batteries with ZV

Topics relating to the ZombieVerter VCU
Post Reply
User avatar
GregFordyce
Posts: 46
Joined: Sun May 23, 2021 5:58 pm
Has thanked: 43 times
Been thanked: 28 times

Dual Leaf batteries with ZV

Post by GregFordyce »

I am going to use 2 Leaf batteries in my van project, a 24kWh and a 30kWh. Both batteries will be connected in parallel at the contactor box. Each battery will still have it's own service disconnect plug. What I would like to do is to have the 30kWh on CAN1 and the 24kWh on CAN2. So far my software engineer (my son, just finished his 2nd year of a computer science degree and on summer holidays :) ) has added a BMS menu item "LeafDualBMS" and copied the leafbms.cpp to leafdualbms.cpp. It's been compiled, loaded to the ZV and everything seems to work. The ZV can talk to the Leaf BMS, it charges on AC and we have motor/wheel spin.
params.json
(2.13 KiB) Downloaded 48 times
.https://github.com/mtmjnb/Stm32-vcu/tree/leafduelbms

What we need to do is set BattCur and power to the sum of both batteries.

The parameters BMS_ChargeLim, BMS_MaxInput and BMS_MaxOutput will be 75% of the sum of both batteries, unless there is a difference of more than 75% between the 2 batteries, in which case set the parameter to the lowest value of either battery. If any of the batteries reports a 0 limit then the parameter would be set to 0. Hopefully that makes sense.

So onto the next step. how would we go about getting the ZV to talk to 2 Leaf BMSs on CAN1 and CAN2?

Code: Select all

void LeafDualBMS::SetCanInterface(CanHardware* can) {
    can->RegisterUserMessage(0x1DB);//Leaf BMS message 10ms
    can->RegisterUserMessage(0x1DC);//Leaf BMS message 10ms
    can->RegisterUserMessage(0x55B);//Leaf BMS message 100ms
    can->RegisterUserMessage(0x5BC);//Leaf BMS message 100ms (500ms on ZE0)
    //can->RegisterUserMessage(0x5C0);//Leaf BMS message 500ms
    //can->RegisterUserMessage(0x59E);//Leaf BMS message 500ms (Only on AZE0)
    can->RegisterUserMessage(0x1C2);//Leaf BMS message 10ms (ZE1)
    can->RegisterUserMessage(0x1ED);//Leaf BMS message 10ms (ZE1, only on 62kWh)
}
My understanding is that these messages keep the Leaf BMS alive and would need to be sent on both CAN1 and CAN2. Are there any examples in the code that would show how this is done? Maybe it's as simple as duplicating the above code with (CanHardware* can) being changed to (CanHardware* 0) and (CanHardware* 1)?

Would the same idea work for the next section? This

Code: Select all

void LeafDualBMS::DecodeCAN(int id, uint8_t * data) {
becomes this

Code: Select all

void LeafDualBMS::DecodeCAN(int 0, uint8_t * data) {
and this

Code: Select all

void LeafDualBMS::DecodeCAN(int 1, uint8_t * data) {
with all the code that follows duplicated?

Thanks in advance for any ideas on how to implement this. :D
Peugeot Expert LWB 2009
Zombieverter - Full 80kW Leaf stack
24kWh & 30kWh Leaf batteries in custom battery box under van
User avatar
tom91
Posts: 2962
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bicester, Oxfordshire
Has thanked: 328 times
Been thanked: 847 times

Re: Dual Leaf batteries with ZV

Post by tom91 »

Will not work with the way the OI library handles CAN. It currently cannot handle same ids on CAN busses, as far as I recall. I need to have a look over the code again to check this is right. I cannot find it.

No need to do any of this, just have a second initialisation of the LeafBMS. you can create multiple instances. You need to copy the assigning of BMS type to the right can in STM32_VCU.

Do not change any of the code in your "dual" copy, only make params for the second battery so it does not overwrite.

Bigger issue it the way the shared message management.

This is actually no small task, quite a lot of interactions in the code.
Creator of SimpBMS
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
User avatar
GregFordyce
Posts: 46
Joined: Sun May 23, 2021 5:58 pm
Has thanked: 43 times
Been thanked: 28 times

Re: Dual Leaf batteries with ZV

Post by GregFordyce »

tom91 wrote: Wed Jul 23, 2025 7:37 pm This is actually no small task, quite a lot of interactions in the code.
Thanks for the info. My second option is to use a 3 way CAN bridge between both batteries and the ZV. I already know what messages need to be sent between the ZV and the BMSs so the next step is finding suitable hardware for the CAN bridge.
Peugeot Expert LWB 2009
Zombieverter - Full 80kW Leaf stack
24kWh & 30kWh Leaf batteries in custom battery box under van
modellfan
Posts: 177
Joined: Tue Jul 12, 2022 11:20 am
Has thanked: 20 times
Been thanked: 61 times

Re: Dual Leaf batteries with ZV

Post by modellfan »

User avatar
GregFordyce
Posts: 46
Joined: Sun May 23, 2021 5:58 pm
Has thanked: 43 times
Been thanked: 28 times

Re: Dual Leaf batteries with ZV

Post by GregFordyce »

I've ordered one of these for my CAN bridge between the 2 Leaf batteries and the full Leaf stack.

https://www.skpang.co.uk/products/teens ... teensy-4-0

To start with I am going to get it to bridge one of the batteries to the ZV. If either battery reports a BMS_ChargeLim, BMS_MaxInput or BMS_MaxOutput of zero then that will be sent to the ZV. Once I've got the basic bridge working I will then tackle combining both batteries into a single output, but that will involve a bit of maths and the correct CRC for the messages.

My question is, will the Zombieverter still be able to control the Leaf stack even though current and power would be under reported if it's only getting the values from 1 battery?

Thanks in advance, Greg
Peugeot Expert LWB 2009
Zombieverter - Full 80kW Leaf stack
24kWh & 30kWh Leaf batteries in custom battery box under van
User avatar
tom91
Posts: 2962
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bicester, Oxfordshire
Has thanked: 328 times
Been thanked: 847 times

Re: Dual Leaf batteries with ZV

Post by tom91 »

GregFordyce wrote: Sun Aug 03, 2025 9:29 am My question is, will the Zombieverter still be able to control the Leaf stack even though current and power would be under reported if it's only getting the values from 1 battery?
Zombie needs from battery: Battery Voltage

Rest is only informational.

An important topic you have not mentioned is how will you ensure both batteries only get connected to the HV bus when they are at the same voltage?
Creator of SimpBMS
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
User avatar
GregFordyce
Posts: 46
Joined: Sun May 23, 2021 5:58 pm
Has thanked: 43 times
Been thanked: 28 times

Re: Dual Leaf batteries with ZV

Post by GregFordyce »

tom91 wrote: Sun Aug 03, 2025 12:47 pm how will you ensure both batteries only get connected to the HV bus when they are at the same voltage?
Good question and a timely reminder that I need to address this. Both batteries will share the same contactor box but I will retain the service disconnects for each battery. One battery is being used for testing, so I'll get the voltage from the ZV. The other battery is still in an accident damaged Leaf, I'll use Leaf spy to check it's voltage and charge the batteries as required to get them to the same voltage.
Peugeot Expert LWB 2009
Zombieverter - Full 80kW Leaf stack
24kWh & 30kWh Leaf batteries in custom battery box under van
Jacobsmess
Posts: 871
Joined: Thu Mar 02, 2023 1:30 pm
Location: Uk
Has thanked: 545 times
Been thanked: 153 times

Re: Dual Leaf batteries with ZV

Post by Jacobsmess »

I might be wrong but I think Tom means how will they switch in and out of parallel in normal day to day use rather than how do you plan on initially voltage matching (although this is still a consideration).
ZV will close the contractors at a target voltage. You'll need a way to ensure both packs are at this voltage and some way of controlling that.
User avatar
GregFordyce
Posts: 46
Joined: Sun May 23, 2021 5:58 pm
Has thanked: 43 times
Been thanked: 28 times

Re: Dual Leaf batteries with ZV

Post by GregFordyce »

Both batteries will be connected to one contactor box although each battery will retain it's own service disconnect plug. After the initial connection the parallel connection will mean they are always at the same voltage. Today I checked both batteries and they are within 4 volts of each other. Tomorrow I'll get them closer, within 1 or 2 volts.
Peugeot Expert LWB 2009
Zombieverter - Full 80kW Leaf stack
24kWh & 30kWh Leaf batteries in custom battery box under van
whereswally606
Posts: 51
Joined: Sun Nov 14, 2021 6:16 pm
Has thanked: 1 time
Been thanked: 3 times

Re: Dual Leaf batteries with ZV

Post by whereswally606 »

I have a muxsan leaf, I believe the Cambridge mitm does a check to verify that the two packs are within a small enough delta to prevent arcing and current surge. The big danger IMO is welded contactors and then a potential runaway event from this. There are a few folk doing this successfully in the post muxsan era using a 3 port can bridge. There is bigpie on here and Christoph on dala's discord. Hope this helps
Post Reply