Coder Social home page Coder Social logo

arminjo / jk-bmstopylontechcan Goto Github PK

View Code? Open in Web Editor NEW
49.0 6.0 10.0 11.73 MB

Converts the JK-BMS RS485 data to Pylontech CAN data

License: GNU General Public License v3.0

C++ 70.22% C 29.78%
bms jkbms can deye pylontech 2004 2004lcd arduino battery-monitor converter

jk-bmstopylontechcan's People

Contributors

arminjo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

jk-bmstopylontechcan's Issues

Inverter read battery total capacity (norminal) wrong (50Ah) while serial log show different value (210Ah)

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

  • BMS INFO *
    Protocol Version Number=1
    Software Version Number=11.XW_S11.272__
    Modify Parameter Password=123456a@

External Temperature Sensors=2

  • BATTERY INFO *
    Manufacturer Date=2310
    Manufacturer Id=Input Userda210Ah0804202
    Device ID String=Input Us
    Device Address=1
    Total Battery Capacity[Ah]=210, Low Capacity Alarm Percent=20
    Charging Cycles=8
    Total Charging Cycle Capacity=1710

Battery Cells=16, Cell Count=16

  • 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

  • CELL INFO *
    16 Cells, Minimum=3273 mV, Maximum=3281mV, Delta=8 mV, Average=3279 mV
    1=3280 mV, 2=3279 mV, 3=3279 mV, 4=3278 mV, 5=3279 mV, 6=3278 mV, 7=3280 mV, 8=3281 mV,
    9=3273 mV, 10=3279 mV, 11=3278 mV, 12=3279 mV, 13=3280 mV, 14=3280 mV, 15=3280 mV, 16=3281 mV,

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===============================

Schematic details

More details on the wiring of the components would be good, as it is difficult to see from the photos.
Fritzing?

Troubleshooting and Warning W31 on Deye

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.

Cell Info Page with maximum and minimum indicators

The indicator for the maximum is not always displayed correctly (see first row).
The indicator for the minimum does not appear at all.

bms_16

Info: I use a battery with 16 cells and have set this in the source code accordingly.

Code Signal Flag from inverter to indicate CAN comms is working?

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?

TJA1050 instead of MCP2515

Hi
Can I use TJA1050 Instead of MCP2515!
How about wiring for TJA1050, It only have
Vcc,Rx,Tx and GND.

Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.