jblance/mpp-solar

Can not read the total battery voltage?

SuperTunaa opened this issue · 1 comments

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

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