arminjo / jk-bmstopylontechcan Goto Github PK
View Code? Open in Web Editor NEWConverts the JK-BMS RS485 data to Pylontech CAN data
License: GNU General Public License v3.0
Converts the JK-BMS RS485 data to Pylontech CAN data
License: GNU General Public License v3.0
Hi Armin,
Today I tried a test with Arduino Uno R3 (ATMega328) at my parent's home and have the inverter connected successfully with the JK-BMS. However, Battery Capacity shown by Inverter was only 50Ah while the real value (read by Serial log was 210Ah - this is the correct number). Other values were correct such as: SOC, voltage...etc, only the total capacity of the battery was wrong!
I doubt the CAN converter module (code) have a bit of problem on calculating. Can you please be so kind to help checking this with thanks.
Yours very faithfully,
Dang Dinh Ngoc
===============QUOTE SERIAL LOG========================
C:\Users\Admin\Desktop\JK-BMSToPylontechCAN-main\JK-BMSToPylontechCAN-main\JK-BMSToPylontechCAN\JK-BMSToPylontechCAN.ino
Version 2.2.2 from Oct 19 2023
No I2C LCD connected at address 0x27
Serial to JK-BMS started with 115200 bit/s!
CAN started with 500 kbit/s!
Page switching button is at pin 2
At long press, CAN Info page is entered and additional debug data is printed as long as button is pressed
2000 ms between 2 BMS requests
2000 ms between 2 CAN transmissions
LCD Backlight timeout is 5 min
VOLTAGE PROTECTION INFO *
Battery Overvoltage Protection[mV]=56000, Undervoltage=48000
Cell Overvoltage Protection[mV]=3500, Recovery=3450, Delay[s]=5
Cell Undervoltage Protection[mV]=3000, Recovery=3050, Delay[s]=5
Cell Voltage Difference Protection[mV]=300
Discharging Overcurrent Protection[A]=80, Delay[s]=300
Charging Overcurrent Protection[A]=60, Delay[s]=30
TEMPERATURE PROTECTION INFO *
Power MosFet Temperature Protection=100, Recovery=80
Sensor1 Temperature Protection=100, Recovery=100
Sensor1 to Sensor2 Temperature Difference Protection=20
Charge Overtemperature Protection=70, Discharge=70
Charge Undertemperature Protection=-20, Recovery=-10
Discharge Undertemperature Protection=-20, Recovery=-10
MISC INFO *
Balance Starting Cell Voltage=[mV]2900
Balance Triggering Voltage Difference[mV]=10
Current Calibration[mA]=834
Sleep Wait Time[s]=10
Dedicated Charge Switch Active=0
Start Current Calibration State=0
Battery Actual Capacity[Ah]=210
Total Runtime Minutes=18848 -> 13D02H08M
Warning: CellOvervoltageProtectionMillivolt value 3500 mV > 3450 mV is not recommended for LiFePO4 chemistry. There is less than 1% extra capacity above 3.5V.
Temperature: Power MosFet=31, Sensor 1=27, Sensor 2=27
SOC[%]=38 -> Remaining Capacity[Ah]=79
Battery Voltage[V]=52.46, Current[A]=-9.34, Power[W]=-489, Difference to full[V]=3.5
===============END QUOTE===============================
More details on the wiring of the components would be good, as it is difficult to see from the photos.
Fritzing?
Originally posted by cfi700 July 29, 2023
First of all, thanks for the great project.
While rebuilding (with Arduino Nano Clone) I noticed the following problems:
PIN SCL is not PIN A3 but PIN A5.
PIN Rx is not PIN 1 as specified but PIN 2.
If you use the cable from the RS485 adapter of the JK-BMS and follow the labeling on the board, you have to swap the lines for RX and TX on the nano.
The BigNumbers are not always displayed correctly, mostly when the current changes from two digits (e.g. 31.5 A) to one digit (e.g. 7.9 A).
The Inverter (SUN-10K-SG04LP03-EU) displays the warning "W31 Battery_comm_warn" after a short time. Nevertheless, correct data is displayed on the Deye.
Hey ArminJo :)
I am trying to add status LED's to show if COMMS is working or not.
On the JKBMMS side I have managed to adjust/add to the code to allow LED to be on/off depending on status of BMS comms working or not.
I have defined STATUS LED's for CAN and BMS and POWER status
Then..
AT LINE 698 in JK-BMSToPylontechCAN.ino
bool readJK_BMSStatusFrame() {
sMillisOfLastReceivedByte = millis();
uint8_t tReceiveResultCode = readJK_BMSStatusFrameByte();
if (tReceiveResultCode == JK_BMS_RECEIVE_FINISHED) {
/*
* All JK-BMS status frame data received
*/
// START MY CODE HERE TO SWITCH ON LED
digitalWrite(BMS_STATUS_LED_PIN, HIGH); // Turn on LED IF BMS CONNECTED and Receiving - WORKING
// END MY CODE
return true;
} else if (tReceiveResultCode != JK_BMS_RECEIVE_OK) {
/*
* Error here
*/
// START MY CODE HERE TO SWITCH OFF LED
digitalWrite(BMS_STATUS_LED_PIN, LOW); // Turn on LED IF BMS CONNECTED and Receiving - WORKING
// END MY CODE HERE TO SWITCH OFF LED
Serial.print(F("Receive error="));
Serial.print(tReceiveResultCode);
Serial.print(F(" at index"));
Serial.println(sReplyFrameBufferIndex);
sFrameIsRequested = false; // do not try to receive more
sBMSFrameProcessingComplete = true;
printJKReplyFrameBuffer();
}
return false;
}
Now I want to do the same for the CAN side.
In the code I can find where to see status if CAN Module is on or not. But I cannot find any code which shows any signal/flag/callback coming from the inverter to say all comms are working.
Currently it looks like the CAN is one-way only, sending to the inverter, and nothing coming back from the inverter?
Or advise suggest another way to know in the code if CAN is communicating or not?
Hi
Can I use TJA1050 Instead of MCP2515!
How about wiring for TJA1050, It only have
Vcc,Rx,Tx and GND.
Thanks,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.