Closed proxer05 closed 8 months ago
i think the data is including a \r
so the standard serial reader is truncating the data (its a readuntil you find \r)
can you try
jkbms -b 115200 -P JKSERIAL -D -p /dev/ttyUSB0 --porttype daly
yep definitely a premature data termination due to the serial input read logic, cell number 13 (0d
in hex) is interpreted as end of data by the serial readline logic (porttype daly doesnt do this)
partial decode below seem to work (assuming there are 14 cells in your setup)
4e57011b00000000030001792a010f90020f92030f97040f90050f93060f93070f92080f90090f940a0f900b0f920c0f910d
bytes returned = 50
1 start (2) 4e57
2 length (2) 01 1b -> 283
3 terminal #(4) 00 00 00 00
4 command word (1) 03 -> read the data
5 frame source (1) 00 -> 0.BMS,1. Bluetooth,2.GPS,3. PC
6 transport type (1) 01 -> 0 for request frame, 1 for reply frame. 2 for active reporting
7 data (xx) 79 2a 010f90 020f92 030f97 040f90 050f93 060f93 070f92 080f90 090f94 0a0f90 0b0f92 0c0f91 0d
8 record # (4)
9 end of data (1 - 0x68)
10 checksum (4)
Data decode
79 2a 010f90 020f92 030f97 040f90 050f93 060f93 070f92 080f90 090f94 0a0f90 0b0f92 0c0f91 0d
1 0x79 'Single battery voltage'
2 2a byte length = 42 or 14 cells?
3 #cells*3 = cell#, voltage, eg
01 0f90 02 0f92 03 0f97
#1 3984 #2 3986 #3 3991
Yeh, now it works. Do you have idea how to adjust response addresses based on cell count as currently my setup will only work on 14 cells setup? Thanks anyway. https://github.com/proxer05/mpp-solar/commit/358b3589618942300adf6b1d31a52d6ff5fbc948
I am very happy with this USB TTL option .I managed to connect my JK BMS but i am getting some data that is wrong . All the data after cell voltage 08 is wrong . I cant even get the battery voltage .
Parameter Value Unit cells_connected 8.0 voltage_cell01 3.412 V voltage_cell02 3.416 V voltage_cell03 3.416 V voltage_cell04 3.416 V voltage_cell05 3.414 V voltage_cell06 3.417 V voltage_cell07 3.416 V voltage_cell08 3.417 V voltage_cell09 0.029 V voltage_cell10 0.026 V voltage_cell11 0.026 V voltage_cell12 2.732 V voltage_cell13 -32.759 V voltage_cell14 25.478 V mos_temp -30976 °C battery_t1 -30464 °C battery_t2 3698 °C battery_voltage 0.08 V balance_current 0.0 A percent_remain 0 % cycle_count 26767 total_capacity d0900e42 battery_warning_message 0005 battery_status_information 09c4
I am very happy with this USB TTL option .I managed to connect my JK BMS but i am getting some data that is wrong .
Command: getBalancerData - Get Balancer Data
Parameter Value Unit cells_connected 8.0 voltage_cell01 3.412 V voltage_cell02 3.416 V voltage_cell03 3.416 V voltage_cell04 3.416 V voltage_cell05 3.414 V voltage_cell06 3.417 V voltage_cell07 3.416 V voltage_cell08 3.417 V voltage_cell09 0.029 V voltage_cell10 0.026 V voltage_cell11 0.026 V voltage_cell12 2.732 V voltage_cell13 -32.759 V voltage_cell14 25.478 V mos_temp -30976 °C battery_t1 -30464 °C battery_t2 3698 °C battery_voltage 0.08 V balance_current 0.0 A percent_remain 0 % cycle_count 26767 total_capacity d0900e42 battery_warning_message 0005 battery_status_information 09c4
As I mentioned previously currently there is no cell count detection. You need to adjust it manually in protocol file. Also current measurement and total capacity are not done yet. @jblance can you add comment with this information in commit?
mos_temp -30976 °C battery_t1 -30464 °C battery_t2 3698 °C battery_voltage 0.08 V balance_current 0.0 A percent_remain 0 % cycle_count 26767 total_capacity d0900e42
The above are what i am interested to get correct
Clone this repo and edit mppsolar/protocols/jkserial.py(delete cell9-14) then install by running pip install -e . in mpp-solar folder.
Can you post a debug run (then I'll 2 different cell count examples to work from)
On Thu, 17 Aug 2023, 10:04 pm geofreybingachie, @.***> wrote:
mos_temp -30976 °C battery_t1 -30464 °C battery_t2 3698 °C battery_voltage 0.08 V balance_current 0.0 A percent_remain 0 % cycle_count 26767 total_capacity d0900e42
The above are what i am interested to get correct
— Reply to this email directly, view it on GitHub https://github.com/jblance/mpp-solar/issues/389#issuecomment-1682003745, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJVKNRA5PKOK3FS6PFKBODXVXUDZANCNFSM6AAAAAA3PSFCBM . You are receiving this because you were mentioned.Message ID: @.***>
I don't mean to hijack the channel, but is it possible to directly grab data off of the JKBMS using python code using this library, from TTL to USB? Not just solar assistant or whatever. I have the B2A24S20P
Yes. There are a variety of output methods including ones that just print the results (actually thebl default does this)
On Fri, 18 Aug 2023, 9:41 pm Apprisco, @.***> wrote:
I don't mean to hijack the channel, but is it possible to directly grab data off of the JKBMS using python code using this library, from TTL to USB? Not just solar assistant or whatever. I have the B2A24S20P
— Reply to this email directly, view it on GitHub https://github.com/jblance/mpp-solar/issues/389#issuecomment-1683647205, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJVKNXYBDCFEBFZ7CO65OLXV42EVANCNFSM6AAAAAA3PSFCBM . You are receiving this because you were mentioned.Message ID: @.***>
I don't mean to hijack the channel, but is it possible to directly grab data off of the JKBMS using python code using this library, from TTL to USB? Not just solar assistant or whatever. I have the B2A24S20P
Here you have full list of output options https://github.com/jblance/mpp-solar/wiki/Detailed-Usage#list-available-output-processors
I don't mean to hijack the channel, but is it possible to directly grab data off of the JKBMS using python code using this library, from TTL to USB? Not just solar assistant or whatever. I have the B2A24S20P
Can you post a debug run too(add -D to command)? It would help in development as currently only 14 cell setup report correct values.
I should just try this out, but is mpp-solar and jkbms a python importable library now? And, is it possible to communicate over USB to TTL? Or which connection protocol do you recommend? (Clearly TTL has some issues, hence the creation of this issue.)
logic to address this is implemented in powermon jkserial
Hi, I implemented logic to read data over ttl(https://github.com/proxer05/mpp-solar/commit/666c5c69873df93a9705fd79b4cf2a9a364c0821) but i have problem with decoding. Response length depends on cell count so its not possible to use static "addresses" of data(atleast for reading all data). Tested on B1A20S15P(v11 hw)
Debug info if needed
jkbms -b 115200 -P JKSERIAL -D -p /dev/ttyUSB0 2023-08-14 13:36:08,725:INFO:__init__:main@216: Solar Device Command Utility, version: 0.16.10, python version: 3.11.2 2023-08-14 13:36:08,726:DEBUG:mqttbrokerc:__init__@29: mqttbroker config: {'name': 'localhost', 'port': 1883, 'user': None, 'pass': None} 2023-08-14 13:36:08,726:DEBUG:__init__:main@251: MqttBroker name: localhost, port: 1883, user: None 2023-08-14 13:36:08,726:DEBUG:__init__:main@253: udp port 5555 2023-08-14 13:36:08,726:DEBUG:__init__:main@255: Using Postgres None 2023-08-14 13:36:08,726:DEBUG:__init__:main@258: Using Mongo None with mppsolar 2023-08-14 13:36:08,726:INFO:__init__:main@359: Creating device "unnamed" (type: "jkbms") on port "/dev/ttyUSB0 (porttype=None)" using protocol "JKSERIAL" 2023-08-14 13:36:08,729:DEBUG:__init__:main@363: device_classUpdate: When trying to get read all data only part of it is fetched. Partial reads like mos temperature are not affected(23 bytes)