@JustinSchoeman Congratulations good job.
I have Venus Victron installer on Raspberry pi with Original Display and I want to add for my 4S battery, in the future it will be 16S for my house.
I would like to send me information and pinout of the connections to my private email, I have tried to install in code in Arduino mega 2560, but it has not worked for me
I have an arduino mega with MCP2515 and I want to connect the serial port or rs485 to my arduino mega serial1 and send it via can bus to venus.
In a few days I will receive my BMS 4S UART port.
I have this conections, and can bus to Raspberry pi witj venus
my idea is to connect the BMS Daly to serial port 1
SPI Pins <=> Arduino Uno <=> Arduino Mega 2560
SCK <=> 13 <=> 52
MISO <=> 12 <=> 50
MOSI <=> 11 <=> 51
CS <=> 10 <=> 53
This demo VEcan work in mega2560, need add your code
#include <mcp_can.h>
#include <SPI.h>
//variables for VE can
uint16_t chargevoltage = 49100; //max charge voltage in mv
uint16_t chargecurrent = 30000; //max charge current in ma
uint16_t disvoltage = 42000; // max discharge voltage in mv
uint16_t discurrent = 30000; // max discharge current in ma
uint16_t SOH = 100; // SOH place holder
unsigned char mes[8] = {0, 0, 0, 0, 0, 0, 0, 0};
unsigned char bmsname[8] = {'S', 'I', 'M', 'P', '-', 'B', 'M', 'S'};
unsigned char bmsmanu[8] = {'T', 'O', 'M', ' ', 'D', 'E', ' ', 'B'};
MCP_CAN CAN(53); //set CS pin for can controlelr
int SOC =80;
float PackVoltage = 46.7;
float AvgTemperature = 20.5;
uint16_t currentact = 0;
void setup() {
Serial.begin(115200); //puerto CAN BUS
if (CAN.begin(MCP_ANY, CAN_250KBPS, MCP_8MHZ) == CAN_OK) Serial.print("El BUS CAN se ha iniciado correctamente!!\r\n");
else Serial.print("Error en el inicio del BUS CAN!!\r\n");
CAN.setMode(MCP_NORMAL);
}
void loop() {
// put your main code here, to run repeatedly:
VEcan();
delay(200);
}
void VEcan() //communication with Victron system over CAN
{
mes[0] = lowByte(chargevoltage / 100);
mes[1] = highByte(chargevoltage / 100);
mes[2] = lowByte(chargecurrent / 100);
mes[3] = highByte(chargecurrent / 100);
mes[4] = lowByte(discurrent / 100);
mes[5] = highByte(discurrent / 100);
mes[6] = lowByte(disvoltage / 100);
mes[7] = highByte(disvoltage / 100);
CAN.sendMsgBuf(0x351, 0, 8, mes);
Serial.println(" ");
for (int i = 0; i<8; i++)
{
Serial.print(mes[i]);
Serial.print(" , ");
}
mes[0] = lowByte(SOC);
mes[1] = highByte(SOC);
mes[2] = lowByte(SOH);
mes[3] = highByte(SOH);
mes[4] = lowByte(SOC * 10);
mes[5] = highByte(SOC * 10);
mes[6] = 0;
mes[7] = 0;
CAN.sendMsgBuf(0x355, 0, 8, mes);
Serial.println(" ");
for (int i = 0; i<8; i++)
{
Serial.print(mes[i]);
Serial.print(" , ");
}
mes[0] = lowByte(uint16_t(PackVoltage * 100));
mes[1] = highByte(uint16_t(PackVoltage * 100));
mes[2] = lowByte(uint16_t(currentact / 100));
mes[3] = highByte(uint16_t(currentact / 100));
mes[4] = lowByte(uint16_t(AvgTemperature * 10));
mes[5] = highByte(uint16_t(AvgTemperature * 10));
CAN.sendMsgBuf(0x356, 0, 8, mes);
Serial.println(" ");
for (int i = 0; i<8; i++)
{
Serial.print(mes[i]);
Serial.print(" , ");
}
mes[0] = 0;
mes[1] = 0;
mes[2] = 0;
mes[3] = 0;
mes[4] = 0;
mes[5] = 0;
mes[6] = 0;
mes[7] = 0;
CAN.sendMsgBuf(0x35A, 0, 8, mes);
Serial.println(" ");
for (int i = 0; i<8; i++)
{
Serial.print(mes[i]);
Serial.print(" , ");
}
delay(5);
CAN.sendMsgBuf(0x370, 0, 8, bmsname);
Serial.println(" ");
for (int i = 0; i<8; i++)
{
Serial.print(bmsname[i]);
Serial.print(" , ");
}
delay(5);
CAN.sendMsgBuf(0x35E, 0, 8, bmsmanu);
Serial.println(" ");
for (int i = 0; i<8; i++)
{
Serial.print(bmsmanu[i]);
Serial.print(" , ");
}
}