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

Can not read the total battery voltage? #425

Closed
SuperTunaa opened this issue Nov 24, 2023 · 1 comment
Closed

Can not read the total battery voltage? #425

SuperTunaa opened this issue Nov 24, 2023 · 1 comment

Comments

@SuperTunaa
Copy link

I try to run this code #112 (comment)

This is my output.

4e
57
00
13
00
00
00
00
06
03
00
00
00
00
00
00
68
01
29
sending command: 4e5700130000000006030000000000006800000129
wrote 21 bytes
Got response: b'NW\x01\t\x00\x00\x00\x00\x06\x00\x01y\x18\x01\x0c\xc9\x02\x0c\xc9\x03\x0c\xc8\x04\x0c\xc9\x05\x0c\xc8\x06\x0c\xc8\x07\x0c\xc9\x08\x0c\xc9\x80\x00\x1b\x81\x00\x19\x82\x00\x19\x83\n'
Got response: b':\x84\x00\x00\x851\x86\x02\x87\x00\x00\x89\x00\x00\x00\x12\x8a\x00\x08\x8b\x00\x00\x8c\x00\x03\x8e\n'
Got response: b'\xf0\x8f\t\xb0\x90\r\xac\x91\rH\x92\x00\x05\x93\x0c\x1c\x94\x0c\x80\x95\x00\x05\x96\x01,\x97\x00P\x98\x00\x1e\x99\x00\x19\x9a\x00\x1e\x9b\rH\x9c\x00\n'
Got response: b'\x9d\x01\x9e\x00F\x9f\x00<\xa0\x00d\xa1\x00d\xa2\x00\x14\xa3\x002\xa4\x002\xa5\x00\x00\xa6\x00\n'
Got response: b'\xa7\xff\xec\xa8\xff\xf6\xa9\x08\xaa\x00\x00\x002\xab\x01\xac\x01\xad\x03A\xae\x01\xaf\x00\xb0\x00\n'

  1. Why can I read the total battery voltage n:
    \x83\n:\
  2. How to calculate the voltage of one battery to the same value read in the app?
    -BomA8Cj
@jblance
Copy link
Owner

jblance commented Jan 8, 2024

the script is truncating the total data, partial decode is below (as per https://github.com/jblance/mpp-solar/blob/master/docs/protocols/JK-TTL-20201217.pdf):

NW
\x01\t
\x00\x00\x00\x00
\x06  # command word - get all data
\x00  # source - 1:BMS
\x01  # transport type - 1: response
y     # data reference y=0x79 - single battery voltage
\x18  # data length = 24 = 3x 8 cells of data
\x01 \x0c\xc9 # cell 01 = 0x0cc9 = 3273 mV
\x02 \x0c\xc9 # cell 02 = 0x0cc9 = 3273 mV
\x03 \x0c\xc8 # cell 03 = 0x0cc8 = 3272 mV
\x04 \x0c\xc9 # cell 04 = 0x0cc9 = 3273 mV
\x05 \x0c\xc8 # cell 05 = 0x0cc8 = 3272 mV
\x06 \x0c\xc8 # cell 06 = 0x0cc8 = 3272 mV
\x07 \x0c\xc9 # cell 07 = 0x0cc9 = 3273 mV
\x08 \x0c\xc9 # cell 08 = 0x0cc9 = 3273 mV
\x80 \x00\x1b # 27 degrees power tube temp
\x81 \x00\x19 # 25 battery box temp
\x82 \x00\x19 # 25 battery temp
\x83 \n:      # total battery - \n: = 0xa3a = 2618 (0.01V) = 26.18V

\x84 \x00\x00
\x85 1        # battery capacity = 49%  - ord('1')
\x86 \x02
\x87 \x00\x00
\x89 \x00\x00\x00\x12
\x8a \x00\x08
\x8b\x00\x00
\x8c\x00\x03
\x8e\n\xf0
\x8f\t\xb0
\x90\r\xac
\x91\rH
\x92\x00\x05
\x93\x0c\x1c
\x94\x0c\x80
\x95\x00\x05
\x96\x01,
\x97\x00P
\x98\x00\x1e
\x99\x00\x19
\x9a\x00\x1e
\x9b\rH
\x9c\x00\n
\x9d\x01
\x9e\x00F
\x9f\x00<
\xa0\x00d
\xa1\x00d
\xa2\x00\x14
\xa3\x002
\xa4\x002
\xa5\x00\x00
\xa6\x00\n
\xa7\xff\xec
\xa8\xff\xf6
\xa9\x08
\xaa\x00
\x00\x002
\xab\x01
\xac\x01
\xad\x03A
\xae\x01
\xaf\x00
\xb0\x00\n

\xb1 - \xb5 missing

@jblance jblance closed this as completed Feb 22, 2024
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

2 participants