Open VictorBucha opened 2 years ago
what do you mean? errors reading from the bms? like timeouts or something?
I mean reading Current errors https://gitlab.com/bms-tools/bms-tools/-/blob/master/JBD_REGISTER_MAP.md#register-0x03-basic-info-read-only (Current errors)
You mean these? Like when the BMS has an undervolt or short circ or anything like that?
xAA error_cnts Various error condition counts 11 U16 -- sc_err_cnt, chgoc_err_cnt, dsgoc_err_cnt, covp_err_cnt, cuvp_err_cnt, chgot_err_cnt, chgut_err_cnt, dsgot_err_cnt, dsgut_err_cnt, povp_err_cnt, puvp_err_cnt READ ONLY
and/or these:
0x10 Current errors 16 bit:
bit 0: Cell overvolt
bit 1: Cell undervolt
bit 2: Pack overvolt
bit 3: Pack undervolt
bit 4: Charge overtemp
bit 5: Charge undertemp
bit 6: Discharge overtemp
bit 7: Discharge undertemp
bit 8: Charge overcurrent
bit 9: Discharge overcurrent
bit 10: Short Circuit
bit 11: Frontend IC error
bit 12: Charge or Discharge FET locked by config (See register 0xE1 "MOSFET control")
-- covp_err, cuvp_err, povp_err, puvp_err, chgot_err, chgut_err, dsgot_err, dsgut_err, chgoc_err, dsgoc_err, sc_err, afe_err, software_err
I actually put some of the stuff in the source for this:
https://github.com/sshoecraft/jbdtool/blob/main/jbd.c
But didn't actually implement it. How did you want it presented? Through the standard INFO output? i.e., below:
FET Charge,Discharge
like this:
Errors: covp_err, cuvp_err, povp_err, puvp_err, chgot_err, chgut_err, dsgot_err, dsgut_err, chgoc_err, dsgoc_err, sc_err, afe_err, software_err
Exactly, both of your messages. no matter how they will appear in JSON, but this would allow to see the output in the dashboard. If you happend to know how to remotely reboot JBD- drop me a line. the only method I know is to pull out the balancing wires and insert them back but that's not a method when you're far from home....
I had to reset one the other day, so this is a good question and I'll look into it
I'll look at adding the error info to the output ... might not be until this weekend - I might even add a general "status" field of "ok" or "error" to signal and error and then an errors array to detail which error
whatever you choose. Might be of assistance to you Jiabaida communication protocol new.pdf se
@sshoecraft any update on errors? I have found that bms can be reloaded manually without pulling the harness by installing a switch (or a normally closed button) on the last of the 2 red wires in the small harness- B20. I dont think there is or could be a viable implementation of rebooting it via relay on a RPi gpio as it may trigger into a reboot infinite loop. But manually it is a great thing.
I added the -X to jbdtool that will reset the BMS - you might try it
Hello sschoecraft, great work you have done. I use the program via mqtt-->NodeRed-->MariaDB-->Grafana. In this post, the topic was: Outputting the error counters was already on the agenda. Apparently, however, the output was not implemented. I would be very happy if I could also display the error counters in my dashboard. I'm looking forward to hearing from you.
OK i'll implement this in the next couple weeks
Hello sschoecraft, I am very pleased that you are taking up the subject again. It would be ideal if the additional error messages could be output in an array analog cells or temp with an additional parameter e.g. -ae. I wish you a prosperous and healthy new year.
Hello sschoecraft,
I'm excited by the potential of combining this with conky and displaying data on my desktop! Thank you for your work on this. I have everything installed as per your guide, but I get no output from the command jbdtool bt:E0:9F:2A:FD:1E:68 -r -a
it connects then disconnects...
I get the following readout on bluetoothctl
Device E0:9F:2A:FD:1E:68 Connected: yes [CHG] Device E0:9F:2A:FD:1E:68 ServicesResolved: yes [CHG] Device E0:9F:2A:FD:1E:68 ServicesResolved: no [CHG] Device E0:9F:2A:FD:1E:68 Connected: no
If I try to connect via systemctl using #pair E0:9F:2A:FD:1E:68 I get; Attempting to pair with E0:9F:2A:FD:1E:68 [CHG] Device E0:9F:2A:FD:1E:68 Connected: yes Failed to pair: org.bluez.Error.AuthenticationFailed [CHG] Device E0:9F:2A:FD:1E:68 Connected: no
What am I doing wrong please?
you might require a pin in order to pair
from the readme:
$ bluetoothctl
# scan on
(look for your device)
[NEW] Device XX:XX:XX:XX:XX:XX name
# trust XX:XX:XX:XX:XX:XX
# pair XX:XX:XX:XX:XX:XX
From mav's comment in another issue:
You might try this
Couldn't get this to work, spend too much time on it already.
However, for what its worth, this did work for me:
Install https://github.com/Jakeler/ble-serial with pip install ble-serial. Run ble-scan to identify BMS:
$ ble-scan
Started BLE scan
A4:C1:38:19:9A:A2 (RSSI=-54): 16S10AH-LIGHT
A4:C1:38:F0:86:0D (RSSI=-91): 16S20AH50A
then run:
$ ble-serial -d A4:C1:38:F0:86:0D
Should get the following output:
21:34:19.750 | INFO | linux_pty.py: Slave created on /tmp/ttyBLE -> /dev/pts/0
21:34:19.750 | INFO | ble_interface.py: Receiver set up
21:34:19.913 | INFO | ble_interface.py: Trying to connect with A4:C1:38:F0:86:0D: 16S20AH50A
21:34:22.252 | INFO | ble_interface.py: Device A4:C1:38:F0:86:0D connected
21:34:22.253 | INFO | ble_interface.py: Found write characteristic 0000ff02-0000-1000-8000-00805f9b34fb (H. 20)
21:34:22.253 | INFO | ble_interface.py: Found notify characteristic 0000ff01-0000-1000-8000-00805f9b34fb (H. 16)
21:34:22.622 | INFO | main.py: Running main loop!
Now you can use jbdtool to connect to the serial port mentioned:
jbdtool -t serial:/dev/pts/0
Voltage 53.400
Current 0.000
DesignCapacity 20.000
RemainingCapacity 19.990
PercentCapacity 100
CycleCount 14
Probes 3
Strings 16
Temps 19.0,19.0,19.1
Cells 3.337,3.336,3.336,3.337,3.341,3.338,3.339,3.337,3.339,3.335,3.339,3.337,3.339,3.337,3.339,3.335
Balance 0000000000000000
CellTotal 53.401
CellMin 3.335
CellMax 3.341
CellDiff 0.006
CellAvg 3.338
DeviceName SP20S020A-L16S-50A-50A-B-U
ManufactureDate 20211101
Version 12.9
FET Charge,Discharge
Thanks for your replies. I'm not sure how to enter the pin (if there is one)- It doesn't ask for one. I tried the second solution and still get no output from the command... $ ble-serial -d E0:9F:2A:FD:1E:68 23:01:23.204 | INFO | linux_pty.py: Port endpoint created on /tmp/ttyBLE -> /dev/pts/2 23:01:23.204 | INFO | ble_interface.py: Receiver set up /home/anthony/.local/lib/python3.10/site-packages/ble_serial/bluetooth/ble_interface.py:28: FutureWarning: This method will be removed future version, pass the callback to the BleakClient constructor instead. self.dev.set_disconnected_callback(self.handle_disconnect) 23:01:24.076 | INFO | ble_interface.py: Trying to connect with E0:9F:2A:FD:1E:68: Batt 2 (bottom) 23:01:25.727 | INFO | ble_interface.py: Device E0:9F:2A:FD:1E:68 connected 23:01:25.727 | INFO | ble_interface.py: Found write characteristic 0000ff02-0000-1000-8000-00805f9b34fb (H. 20) 23:01:25.727 | INFO | ble_interface.py: Found notify characteristic 0000ff01-0000-1000-8000-00805f9b34fb (H. 16) 23:01:25.898 | INFO | main.py: Running main loop!
The bluetoothctl in your first example (not systemctl as I said in my original comment) gives
I get; Attempting to pair with E0:9F:2A:FD:1E:68 [CHG] Device E0:9F:2A:FD:1E:68 Connected: yes Failed to pair: org.bluez.Error.AuthenticationFailed [CHG] Device E0:9F:2A:FD:1E:68 Connected: no
... I now have had a bit of success and have retrieved readings from the two batteries using the ble-serial as described. It doesn't ask for authentication. If anyone can help me bypass this step and use the bluetoothctl pairing only (i.e why/how to give authentication) I would appreciate it. Thanks @sshoecraft!
I have been experimenting with the agent and have if the agent is changed it no longer tells me authentication failed.
However I still get no output from the jbdtool -t bt:
Its the C library that i'm using for bluetooth. See my post re: ble-serial above for a workaround.
I have not yet had the opportunity to work on this yet.
Is it possible to add the function of reading errors? Would be very useful for monitoring