Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JK BMS Temperature problem below 0° #339

Closed
Knedox opened this issue Dec 10, 2022 · 15 comments
Closed

JK BMS Temperature problem below 0° #339

Knedox opened this issue Dec 10, 2022 · 15 comments

Comments

@Knedox
Copy link

Knedox commented Dec 10, 2022

Hello,
now that we have negativ temperature in germany i have seen that my battery reports 0°C then 50°C then 100°C and then 0°C

So it seems like the negative temperature calculation here is wrong.

self.to_temp(1, temp1 if temp1 <= 100 else 100 - temp1)

I was already able to find this out:

0x02 = 0b10 -> 2°C
0x01 = 0b1 -> 1°C
0x00 = 0b0 -> 0 °C
0x32 = 0b0110010 -> 0 ?
0x64 = 0b1100100 -> -1 °C
0x65 = 0b1100101 -> -2 °C
0x66 = 0b1100110 -> -3 °C

does anyone have the same problem? i am not really sure how to handle the 0x32 byte. Seems a little bit out of order

possible fix

temp1 = 0 if temp1 == 50 else temp1
temp2 = 0 if temp2 == 50 else temp2
self.to_temp(1, temp1 if temp1 < 100 else 99 - temp1)
self.to_temp(2, temp2 if temp2 < 100 else 99 - temp2)

@kakariki1
Copy link

I'm owning a JK B2A24S-15P BMS and just tried cooling down the 2 temperature sensors by using cooling spray.
Temperature went down to about -25°C, without problems. During the transition from negative to positive it shortly peaked to 100°C.
Without any further investigations I think that's the same problem ...

Best regards,
lakeroe

@kakariki1
Copy link

According to the protocol definition here (jblance/mpp-solar#112 (comment)) the part exceeding 100 is negative temperature, such as 101 is negative 1 degree.

So I think the problem is here:

self.to_temp(1, temp1 if temp1 <= 100 else 100 - temp1)

This should be changed to:
self.to_temp(1, temp1 if temp1 <= 100 else temp1 - 100)

Best regards,
lakeroe

@wormsman
Copy link

Many thanks for you fix and the protocol definition. I have changed it online on my installation. Currently my battery is at +1°C, so maybe I can see if the temperature reading is Ok with the change.

@kakariki1
Copy link

I made a mistake above. If it helps at all, the change has to be made to:
self.to_temp(1, temp1 if temp1 <= 100 else -(temp1 - 100))

In theory there should be no difference to the original code though ...

@MS123uk
Copy link

MS123uk commented Dec 15, 2022

how do you make this change to the scraped ? I'm new programming rasp and vinos os

@kakariki1
Copy link

Sorry, I'm no native english speaker.
What do you mean by "change to the scraped" ?

@MS123uk
Copy link

MS123uk commented Dec 15, 2022

i have same problem with jk bms showing the wrong temp below 0 c or 32f i.e. 100 c when bms probe go below 0c
you
This should be changed to:
self.to_temp(1, temp1 if temp1 <= 100 else temp1 - 100)

how can i change this line

@kakariki1
Copy link

kakariki1 commented Dec 15, 2022

Now I understand, just read here (How to edit utils.py):
https://github.com/Louisvdw/dbus-serialbattery/wiki/How-to-install#how-to-edit-utilspy

@MS123uk
Copy link

MS123uk commented Dec 15, 2022

thanks

@MS123uk
Copy link

MS123uk commented Dec 15, 2022

ok can not find line 88 self.to_temp(1, temp1 if temp1 <= 100 else 100 - temp1) ?

@Louisvdw
Copy link
Owner

I'll add the change to the next release, so you can just wait for that.

@MS123uk
Copy link

MS123uk commented Dec 15, 2022

and how long will be as its the only way is see bms has lock out charging at low temp apart from 0 amp charging and thank for feedback

Louisvdw added a commit that referenced this issue Dec 15, 2022
@Knedox
Copy link
Author

Knedox commented Dec 15, 2022

Well, now there is a copy & paste mistake in the code. Please check temp2, line 89

@wormsman
Copy link

wormsman commented Dec 15, 2022

Also the fix was not working for me. Via Bluetooth I got -0°C as current temperature and with the code in version 14.2 I got 100°C.

For me

    self.to_temp(1, temp1 if temp1 < 99 else (100 - temp1))
    self.to_temp(2, temp2 if temp2 < 99 else (100 - temp2))

seems to work. I now get 0°C and hopefully can check this night some values below 0°C.

I have tested the temperature sensors now with and salt ice bath and my fingers. In the range from -16°C up to 30°C the measurement with the formula above is correct and corresponds the data in the JK-BMS android software. In the android software I could see -0°C and also 0°C and booth were translated to 0°C.

@Knedox
Copy link
Author

Knedox commented Dec 29, 2022

Also the fix was not working for me. Via Bluetooth I got -0°C as current temperature and with the code in version 14.2 I got 100°C.

For me

    self.to_temp(1, temp1 if temp1 < 99 else (100 - temp1))
    self.to_temp(2, temp2 if temp2 < 99 else (100 - temp2))

seems to work. I now get 0°C and hopefully can check this night some values below 0°C.

I have tested the temperature sensors now with and salt ice bath and my fingers. In the range from -16°C up to 30°C the measurement with the formula above is correct and corresponds the data in the JK-BMS android software. In the android software I could see -0°C and also 0°C and booth were translated to 0°C.

i have tested your code. Seems to work:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants