JDB / XiaoXiang BMS tool

the binary works.. i updated the mybmm.conf to this (Which is my MAC for my BMS)

[24VSHED]
TYPE=jbd
TRANSPORT=bt
TARGET=8E:C2:30:38:C1:A4
UUID=e9e620fd-803a-4308-b25e-7558f1f87a4a

no idea where to get a UUID (this is yours)
tried this command with "TRANSPORT" above commented out like you had it and with the comment removed (like above)

and each time I get this

delta@piServ:~/git/jbdtool $ ./jbdtool -t bt:8E:C2:30:38:C1:A4 -r -a
Fail to connect to the bluetooth device.

Perhaps the RPi BT receiver isn't as good as my iPhone that can see the BMS BT from the same location.
 
You might try to make sure the the PI can see the bluetooth module by using bluetootctl

you could also turn on debugging output with the -d option

try: ./jbdtool -t bt:8E:C2:30:38:C1:A4 -d 3 -r -a

Here's a version compiled for the PI with bluetooth, mqtt, and debugging enabled

I also updated the github repo if you wanna pull that down

Also, jbdtool has no config file support - it is command line arguments only atm - so it will ignore mybmm.conf (thats just for mybmm)
 

Attachments

  • jbdtool_bt_mqtt_pi.zip
    381.6 KB · Views: 366
Last edited:
interesting... the BMS is showing up via "scan on" with bluetoothctl but.. its showing a MAC that is different than what my iOS device sees:

Device A4:C1:38:54:E3:A8 xiaoxiang BMS


[bluetooth]# info A4:C1:38:54:E3:A8
Device A4:C1:38:54:E3:A8
Name: xiaoxiang BMS
Alias: xiaoxiang BMS
Paired: no
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Unknown (0000ff00-0000-1000-8000-00805f9b34fb)
ManufacturerData Key: 0xc28e
ManufacturerData Value: 0x30
ManufacturerData Value: 0x38
ManufacturerData Value: 0xc1
ManufacturerData Value: 0xa4
RSSI: -97
TxPower: 63

but still no luck with either MAC addy

delta@piServ:~/git/jbdtool $ ./jbdtool -t bt:A4:C1:38:54:E3:A8 -d 3 -r -a
Fail to connect to the bluetooth device.
delta@piServ:~/git/jbdtool $ ./jbdtool -t bt:8E:C2:30:38:C1:A4 -d 3 -r -a
Fail to connect to the bluetooth device.


seems like its getting closer
 
of further interest is the fact there's no debug output; I'll have to send you another version

Is this BT module from the manufacturer? I'm wondering if it requires a pin. I have not yet tested a BT module from them.
 
of further interest is the fact there's no debug output; I'll have to send you another version

Is this BT module from the manufacturer? I'm wondering if it requires a pin. I have not yet tested a BT module from them.

My BMS and the BT module came from Battery Hookup

I can connect & adjust parameters just fine from the iOS app. I paid the $5.99 to be able to edit the config from the app.
 
So i have been trying to install and run MrSurley's BMS tools on my raspberry pi. Thought it would be a good chance to learn a bit.
It took all my available time yesterday to install the following,
Python 3.8.0
Pip 21 (tried pip3 but no luck)

I've had numerous failed attempts at installing WxPython, now i have found detailed instructions on installing WxPython on to raspi and at the very bottom it tells me i will need bigger than 16G SD card, which i dont have at the moment plus repeating all that i have done.

So i thought i would have a go at running sshoecraft's JDBtool. I know this is all basic stuff for you guys but i could really do with some pointers.
I have signed up to github and followed a tutorial on registries. I have downloaded the JDBtool and JDBtool_complete, now im looking around for a tutorial or instruction to run these files.

Any help would be greatly appreciated, I know its well below you guys pay grade but if i waste too many more days on this without any results my wifes gonna divorce me and ,, well even the Batrium system is cheaper than a divorce.
 
Few things...

1. jbdtool appears to be the creation of @sshoecraft he and I spoke last night you likely won't be finding any tutorials online
2. the binaries that he shared here are fairly specific since he and I were discussing he realized what version of Raspbian I was running, so those are a "use at your own discretion" kind of thing. Not sure how useful those will be for you.
3. I believe the pip3 install command for you would be "sudo apt install python3-pip". (I know b/c I just did this last night after he and I spoke). It seems the python + bluetooth approach is going to be a more robust approach. I still haven't got it to work, but with python (vs C) this is more in my wheelhouse.
4. There are tutorials online which will guide you through "growing" your SD from a smaller one to a larger one so that you don't lose all your work. google "raspberry pi switch to larger sd card" and then you will have more space and not lose anything you've done.

I also think its worth mentioning, @MrSurly BMS tool is a GUI app. I was interested in what @sshoecraft had created because it was a CLI (command line) process as I run all 3 of my RPi without a monitor (headless) so GUI tools are more or less useless to me. If you are interested in and using your RPi with a monitor then sticking with something like MrSurley's tool is probably more your speed. And apologies to @MrSurly for jacking his thread/post.
 
Last edited:
Graham, attached is a PI binary (created on a PI3B+/ARMv7) ... give it a try

Below is the usage info from the github page

If you have issues running it, enable debugging (-d 3) and PM me the output

Usage:

jbdtool -t transport:target,opt1[,optN]

For CAN:

jbdtool -t can:interface[,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 addr] [-e desc]

exmples:

jbdtool -t bt:01:02:03:04:05,06

jbdtool -t bt:01:02:03:04:05:06 -e ffe1

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],remote device,[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

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
 

Attachments

  • jbdtool_pi.zip
    394.2 KB · Views: 222
Thanks guys, I am trying to understand all the info you have given, thank you
So I am leaving MrSurley's bms tools until i have a bigger SD card, thank you Delta-9 for your suggestions
This morning i have gone back to Sshoecrafts Jbdtool
Thank you for the raspi version. I have downloaded the pi_static.zip
extracted it to downloads
executed it from the folder with ./
then wasn't sure how to run debug so tried ./jbdtool -d 3
pi@raspberrypi:~/Downloads/jbdtool_pi_static $ ./jbdtool -d 3
main(796): transport: (nil), target: (nil)
usage: jbdtool [-abcjJrwlh] [-f filename] [-t <module:target> [-o output file]
arguments:
-d <#> debug output
-c comma-delimited output
-j JSON output
-J JSON output pretty print
-r read parameters
-a read all parameters
-w write parameters
-l list supported parameters
-h this output
-f <filename> input filename for read/write.
-o <filename> output filename
-t <transport:target> transport & target
-e <opts> transport-specific opts
-n numbers only; dont interpret
-m <host:clientid:topic[:user[:pass]]> Send results to MQTT broker
-i Update interval

Not sure where to go from here if i lsusb i can see the uart connected at
Bus 001 Device 007: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC

If I just
$ jbdtool -d 3
I get
bash: jbdtool: command not found

Im sure it user error,,,
 
Thank you for the tutorial,,
added it to the PATH variable and learn't something thanks
 
I was so pleased to finally make contact with my BMS and start pulling data from it. thank you @sshoecraft et @Delta-9 for your help.

Now im looking at how to use that data, I obviously have alot to learn so i thought i would ask you guys if what i am trying to do would be possible.

I have been trying to use Node-red to communicate with a morningstar MPPT no luck there, but thats down to my lack of knowledge. But it has made me aware of Node-red and its potential. I have found a Json-db-collection with in, out and collection. I just need to fill in the gaps in my understanding to be able to config.

As i keep repeating i am new to this so am unaware of any potential limitations so would be grateful of any input. I also see that node-red has victron-nodes which I am very interested in using.

what do you guys recon? do-able?
 
is this software working for ant-bms too? i'm datalogging from python and windows (but works on linux too)
at the moment i'm in trouble changing mac address to connect more than 1 bms to same pc/raspy.

any idea on what i can do?
 
I was so pleased to finally make contact with my BMS and start pulling data from it. thank you @sshoecraft et @Delta-9 for your help.

Now im looking at how to use that data, I obviously have alot to learn so i thought i would ask you guys if what i am trying to do would be possible.

I have been trying to use Node-red to communicate with a morningstar MPPT no luck there, but thats down to my lack of knowledge. But it has made me aware of Node-red and its potential. I have found a Json-db-collection with in, out and collection. I just need to fill in the gaps in my understanding to be able to config.

As i keep repeating i am new to this so am unaware of any potential limitations so would be grateful of any input. I also see that node-red has victron-nodes which I am very interested in using.

what do you guys recon? do-able?

If compiled with MQTT support (needs paho mqqt library), jbdtool outputs mqtt data. You can specify the info on the comand line with the -m option, for example:


Code:
jbdtool -m host:clientid:topic[:user[ass]]

jbdtool -t ip:pack_01 -m localhost:pack_01:/Battery/pack_01

(pack_01 is the dns name of my wifi module #1)

In another window, I can subscribe to /Battery/# to see the JSON output:

# mosquitto_sub -h localhost -t '/Battery/#'
{"Voltage":53.330001831054688,"Current":0,"DesignCapacity":100,"RemainingCapacity":64.339996337890625,"PercentCapacity":64,"CycleCount":0,"Probes":2,"Temps":[17,15.300000000000001],"Strings":14,"Cells":[3.79,3.7850000000000001,3.7919999999999998,3.7909999999999999,3.819,3.8290000000000002,3.831,3.8300000000000001,3.8250000000000002,3.8130000000000002,3.8239999999999998,3.8039999999999998,3.794,3.7999999999999998],"CellTotal":53.326999664306641,"CellMin":3.7850000858306885,"CellMax":3.8310000896453857,"CellDiff":0.046000003814697266,"CellAvg":3.8090713024139404,"DeviceName":"15350019-SP15S008C-P14S-100A","ManufactureDate":"20210116","Version":2.5,"FET":"Charge,Discharge"}


I have a node-red server running on the same host which injects the info into an influx DB. It should look something like this:

1612743477989.png

Reads from /Battery topic, converts JSON to javascript obect, then flattens the Cells array into cell01,02,03,04 as seperate fields, does the same for temps, then removes arrays for the remainder of the data.

From there, its easy to make a dash for it in Grafana. Something like this maybe (could use some work):

1612743543468.png

After that you could get fancy and maybe do some linking if you have multiple packs so you can click on each pack to get the info


NOTE: I just updated the github repo ... it wasnt setting the name field in the JSON output with the mqtt clientid.

EDIT: no way to remove those stupid emojis ... they are colon p
 
Last edited:
is this software working for ant-bms too? i'm datalogging from python and windows (but works on linux too)
at the moment i'm in trouble changing mac address to connect more than 1 bms to same pc/raspy.

any idea on what i can do?

Sorry, this is specific to the JBD BMS only.
 
To remove emojis you have to manually insert bb code tag and the /code tag
Code:
jbdtool -m host:clientid:topic[:user[:pass]]

jbdtool -t ip:pack_01 -m localhost:pack_01:/Battery/pack_01

(pack_01 is the dns name of my wifi module #1)

In another window, I can subscribe to /Battery/# to see the JSON output:

# mosquitto_sub -h localhost -t '/Battery/#'
{"Voltage":53.330001831054688,"Current":0,"DesignCapacity":100,"RemainingCapacity":64.339996337890625,"PercentCapacity":64,"CycleCount":0,"Probes":2,"Temps":[17,15.300000000000001],"Strings":14,"Cells":[3.79,3.7850000000000001,3.7919999999999998,3.7909999999999999,3.819,3.8290000000000002,3.831,3.8300000000000001,3.8250000000000002,3.8130000000000002,3.8239999999999998,3.8039999999999998,3.794,3.7999999999999998],"CellTotal":53.326999664306641,"CellMin":3.7850000858306885,"CellMax":3.8310000896453857,"CellDiff":0.046000003814697266,"CellAvg":3.8090713024139404,"DeviceName":"15350019-SP15S008C-P14S-100A","ManufactureDate":"20210116","Version":2.5,"FET":"Charge,Discharge"}
I couldn't get the code icon to work. But manually inserting the code tags seems to work
later floyd
 
To remove emojis you have to manually insert bb code tag and the /code tag
Code:
jbdtool -m host:clientid:topic[:user[:pass]]

jbdtool -t ip:pack_01 -m localhost:pack_01:/Battery/pack_01

(pack_01 is the dns name of my wifi module #1)

In another window, I can subscribe to /Battery/# to see the JSON output:

# mosquitto_sub -h localhost -t '/Battery/#'
{"Voltage":53.330001831054688,"Current":0,"DesignCapacity":100,"RemainingCapacity":64.339996337890625,"PercentCapacity":64,"CycleCount":0,"Probes":2,"Temps":[17,15.300000000000001],"Strings":14,"Cells":[3.79,3.7850000000000001,3.7919999999999998,3.7909999999999999,3.819,3.8290000000000002,3.831,3.8300000000000001,3.8250000000000002,3.8130000000000002,3.8239999999999998,3.8039999999999998,3.794,3.7999999999999998],"CellTotal":53.326999664306641,"CellMin":3.7850000858306885,"CellMax":3.8310000896453857,"CellDiff":0.046000003814697266,"CellAvg":3.8090713024139404,"DeviceName":"15350019-SP15S008C-P14S-100A","ManufactureDate":"20210116","Version":2.5,"FET":"Charge,Discharge"}
I couldn't get the code icon to work. But manually inserting the code tags seems to work
later floyd

Fixed ... thank you!
 
Back
Top