JBD BMS linux-based utility
MQTT support requires the phao.mqtt.c library https://github.com/eclipse/paho.mqtt.c
build & install the library then edit the Makefile and set MQTT=yes
To build MQTT - paho.mqtt.c (https://github.com/eclipse/paho.mqtt.c.git)
mkdir -p build && cd build
cmake -DPAHO_BUILD_SHARED=TRUE -DPAHO_BUILD_STATIC=TRUE -DPAHO_ENABLE_TESTING=FALSE -DPAHO_BUILD_SAMPLES=FALSE ..
make && make install
BLUETOOTH support requires glib-2.0 gio-2.0. Install the development packages and set BLUETOOTH=yes
Transports are specified as:
jbdtool -t transport:target,opt1[,optN]
For CAN:
jbdtool -t can:device[,speed]
example:
jbdtool -t can:can0,500000
For Serial:
jbdtool -t serial:device[,speed]
example:
jbdtool -t serial:/dev/ttyS0,9600
For Bluetooth:
jbdtool -t bt:mac,descriptor
exmples:
jbdtool -t bt:01:02:03:04:05,06
jbdtool -t bt:01:02:03:04:05:06,ff01
For IP/esplink:
jbdtool -t ip:address[,port]
example:
jbdtool -t ip:10.0.0.1,23
for CANServer/Can-over-ip
jbdtool -t can_ip:address,[port],interface on server,[speed]
example:
jbdtool -t can_ip:10.0.0.1,3930,can0,500000
CAN bus cannot read/write parameters
to read all parameters using bluetooth:
jbdtool -t bt:01:02:03:04:06 -r -a
to list the params the program supports, use -l
to specify single params, specify them after -r
jbdtool -t bt:01:02:03:04:06 -r BalanceStartVoltage BalanceWindow
to read a list of parameters using a file use -f:
jbdtool -t serial:/dev/ttyS0,9600 -r -f jbd_settings.fig
use -j and -J (pretty) to specify filename is a json file
to write parameters, specify a key value pair after -w
jbdtool -t ip:10.0.0.1 -w BalanceStartVoltage 4050 BalanceWindow 20
BatteryConfig and NtcConfig are bit fields. They read back as a list of names and can be written the same way, or as a number (decimal, or 0x for hex):
jbdtool -t serial:/dev/ttyS0,9600 -w BatteryConfig SCRL,BALANCE_EN
jbdtool -t serial:/dev/ttyS0,9600 -w BatteryConfig 6
jbdtool -t serial:/dev/ttyS0,9600 -w NtcConfig NTC1,NTC2
The value replaces the whole field - names left out are cleared. Writing an unrecognized name is an error and nothing is written.
BatteryConfig bits:
Switch 0x01 key/switch control
SCRL 0x02 sleep/current recalibration
BALANCE_EN 0x04 balancing enabled
CHG_BALANCE 0x08 balance only while charging
LED_EN 0x10 led enabled
LED_NUM 0x20 led shows number of cells
RTC 0x40 real time clock
EDV 0x80 end of discharge voltage
NtcConfig bits: NTC1 (0x01) through NTC8 (0x80)
to send all output to a file, use -o. If the filename ends with .json, file will be written in JSON format:
jbdtool -t can:can0,500000 -j -o pack_1.json