Maximum All in One V490
Hello Staurt,
what is the maximum of All in one V490 on one Controller. I have a LTO Storage and i need 40 pcs from this on one Controller can we make this or what can we do for realisation?
Best Regards and many Thanks Michael.G
What is the cell voltage and total pack voltage range you use?
Hello Stuart, my LTO pack have per cell 2,1 to 2,6v and its work good. Its round about 48v pack and this is What i used 40 Peace from the all in one v490 own creation. In Maximum there are 40x 12 cells= 480 cells
i Hope it Workshop or i Need 2 Controllers but Bothe Must Connect on one can Bus.
Best Regarda Michael.G
Hi Michael. Connecting two controllers to the same CANBUS isn't going to work, there are just too many cells for the DIYBMS system to handle in 1 controller.
Hello Stuart, I think it also but how can I do this. It is possible that we can connect 2 or more controllers over the rs485 for calculation and push it on the can bus out. Or I must create a can bus hub what calculate all controllers and sent it on one can bus out. Thanks and best Regards Michael.G
Hello Stuart I am again, can you say me what can bus adress do you programming in your code and can you say where is the pos in script for changing. I will also test on my Deye hybrid I mean I saw a multi bms list so that I can install mor bms on can bus.
thanks
Hi Michael. Connecting two controllers to the same CANBUS isn't going to work, there are just too many cells for the DIYBMS system to handle in 1 controller.
Hello Stuart, see my next question? Best Regards Michael
Hello Stuart I am again, can you say me what can bus adress do you programming in your code and can you say where is the pos in script for changing. I will also test on my Deye hybrid I mean I saw a multi bms list so that I can install mor bms on can bus.
All the code for the can bus is in the file named canbus.cpp.
You still won't be able to put multiple controller on the canbus, it just doesn't work like that.
Hy Stuart, ok I understand. In this case I make a can Bus hob and use 2 controller on one victron. I have create a controller withe 3 can bus and one rs485 and display for later Funktion. See [picture](
)
Hello Stuart I am again, can you say me what can bus adress do you programming in your code and can you say where is the pos in script for changing. I will also test on my Deye hybrid I mean I saw a multi bms list so that I can install mor bms on can bus.
All the code for the can bus is in the file named canbus.cpp.
You still won't be able to put multiple controller on the canbus, it just doesn't work like that.
Hallo Michael dein Code mäste das so ungefähr ausschauen bitte bedenke das das nur ein Beispiel ist
/*
( _ (_ )( / )( _ ( / )/ __)
)() ))( \ / ) _ < ) ( __
(/() (__) (/(//_)(/
(c) 2021-2023 Stuart Pittaway
Dieser Code kommuniziert mit VICTRON CERBO GX über CAN-Bus @ 500kbps mit 11-Bit-Adressen. Er unterstützt die Victron CAN-Bus BMS Nachrichten.
DEMO Zusätzliche Erweiterungen by Trajilovic Goran
- Master-Slave-Erkennung über CAN-Bus
- Master aggregiert Daten von Slaves und sendet sie an Victron */
#define USE_ESP_IDF_LOG 1 static constexpr const char *const TAG = "diybms-victron";
#include "victron_canbus.h"
// ==================== Master-Slave Konfiguration ==================== #define MAX_SLAVES 10 #define MASTER_ID 1 // Kleinste ID wird Master bool isMaster = false; unsigned long lastMasterHeartbeat = 0;
struct SlaveData { uint16_t voltage; int16_t current; int16_t temperature; };
SlaveData slaveNodes[MAX_SLAVES]; bool slaveOnline[MAX_SLAVES] = {false};
// ==================== Slave sendet Daten an Master ==================== void send_slave_data() { SlaveData data; data.voltage = rules.lowestBankVoltage / 100; data.current = mysettings.dischargecurrent; data.temperature = rules.highestExternalTemp;
uint16_t can_id = 0x200 + mysettings.slave_id;
send_canbus_message(can_id, (uint8_t *)&data, sizeof(SlaveData));
}
// ==================== Master verarbeitet Slave-Daten ==================== void process_slave_data(uint32_t can_id, uint8_t *data, uint8_t length) { if (can_id >= 0x200 && can_id < 0x200 + MAX_SLAVES) { uint8_t slaveId = can_id - 0x200; memcpy(&slaveNodes[slaveId], data, sizeof(SlaveData)); slaveOnline[slaveId] = true; } }
// ==================== Master sendet Daten an Victron ==================== void send_aggregated_data_to_victron() { struct VictronData { int16_t voltage; int16_t current; int16_t temperature; };
VictronData vData = {0, 0, 0};
uint8_t activeSlaves = 0;
for (uint8_t i = 0; i < MAX_SLAVES; i++)
{
if (slaveOnline[i])
{
vData.voltage += slaveNodes[i].voltage;
vData.current += slaveNodes[i].current;
vData.temperature += slaveNodes[i].temperature;
activeSlaves++;
slaveOnline[i] = false;
}
}
if (activeSlaves > 0)
{
vData.voltage /= activeSlaves;
vData.current /= activeSlaves;
vData.temperature /= activeSlaves;
}
send_canbus_message(0x351, (uint8_t *)&vData, sizeof(VictronData));
}
// ==================== Master-Heartbeat senden ==================== void send_heartbeat() { uint8_t data[2] = {MASTER_ID, isMaster ? 1 : 0}; send_canbus_message(0x100, data, sizeof(data)); }
// ==================== Prüfen, ob Master noch aktiv ist ==================== void check_master_status() { if (millis() - lastMasterHeartbeat > 5000) { isMaster = true; } }
void process_master_heartbeat(uint32_t can_id, uint8_t *data, uint8_t length) { if (can_id == 0x100) { if (data[0] < MASTER_ID) { isMaster = false; } if (data[1] == 1) { lastMasterHeartbeat = millis(); } } }
// ==================== Victron CAN-Bus Kommunikation ==================== // Alle ursprünglichen Funktionen bleiben erhalten:
void victron_message_355() { struct data355 { uint16_t stateofchargevalue; uint16_t stateofhealthvalue; };
if (_controller_state == ControllerState::Running && mysettings.currentMonitoringEnabled)
{
data355 data;
data.stateofchargevalue = rules.StateOfChargeWithRulesApplied(&mysettings, currentMonitor.stateofcharge);
data.stateofhealthvalue = (uint16_t)(trunc(mysettings.soh_percent));
send_canbus_message(0x355, (uint8_t *)&data, sizeof(data355));
}
}
void victron_message_356() { struct data356 { int16_t voltage; int16_t current; int16_t temperature; };
data356 data;
data.voltage = rules.highestBankVoltage / 10;
if (mysettings.currentMonitoringEnabled && currentMonitor.validReadings)
{
data.voltage = currentMonitor.modbus.voltage * 100.0;
}
data.current = 0;
if (mysettings.currentMonitoringEnabled && currentMonitor.validReadings)
{
data.current = currentMonitor.modbus.current * 10;
}
data.temperature = (rules.moduleHasExternalTempSensor) ? (int16_t)rules.highestExternalTemp * (int16_t)10 : 0;
send_canbus_message(0x356, (uint8_t *)&data, sizeof(data356));
}
void victron_message_373() { struct data373 { uint16_t mincellvoltage; uint16_t maxcellvoltage; uint16_t lowestcelltemperature; uint16_t highestcelltemperature; };
data373 data;
data.lowestcelltemperature = 273 + rules.lowestExternalTemp;
data.highestcelltemperature = 273 + rules.highestExternalTemp;
data.maxcellvoltage = rules.highestCellVoltage;
data.mincellvoltage = rules.lowestCellVoltage;
send_canbus_message(0x373, (uint8_t *)&data, sizeof(data373));
}
void victron_message_35a() { struct data35a { uint8_t byte0; uint8_t byte1; uint8_t byte2; uint8_t byte3; uint8_t byte4; uint8_t byte5; uint8_t byte6; uint8_t byte7; };
data35a data;
memset(&data, 0, sizeof(data35a));
if (_controller_state == ControllerState::Running)
{
data.byte0 |= ((rules.ruleOutcome(Rule::BankOverVoltage) | rules.ruleOutcome(Rule::CurrentMonitorOverVoltage)) ? 0x04 : 0x08);
data.byte0 |= ((rules.ruleOutcome(Rule::BankUnderVoltage) | rules.ruleOutcome(Rule::CurrentMonitorUnderVoltage)) ? 0x10 : 0x20);
if (rules.moduleHasExternalTempSensor)
{
data.byte0 |= (rules.ruleOutcome(Rule::ModuleOverTemperatureExternal) ? 0x40 : 0x80);
}
}
send_canbus_message(0x35a, (uint8_t *)&data, sizeof(data35a));
}
// ==================== Haupt-Loop ==================== void loop() { check_master_status();
if (!isMaster)
{
send_slave_data();
}
if (isMaster)
{
send_aggregated_data_to_victron();
}
send_heartbeat();
delay(5000);
}
Hy many thanks for this code. I will test it next week and I will give you a feedback. I have also create a can bus hub that I can connect two master on one bms inverter and it's works great but better is that the controller can master slave for bigger systems. Best regards Michael Gärtner