JK-B1A24S / JK-B2A24S Active Balancer

Announcement - Help us fight the BOTS! Please report all spam including stuff in your inbox!

not2bme

Member
Joined
Oct 16, 2017
Messages
493
I bought this active balancer a while back but never got around to actually use it. It's a step up from my current active balancer which has no ability to configure it. So I'm posting up all I have on it at the moment and will continue to update it. My current balancer works fine but I thought it's time to try something new. At under $100 it was worth trying it. I'm in no way recommending it yet but it sounds like a promising unit to balance your packs at a pretty good rate. Most balancers promise 1A but rarely give you any more than 10% of that rate. This one doesn't get there but I'd say it gets almost 60% there.

https://www.jkbms.com/product/jk-b1a24s/

First there's a couple versions of it, ranging from 1A to 10A. It also has versions that has Canbus and RS485. I bought mine before they released those versions, which is why I never started using it because I needed it to be able to log the data into a database.
https://www.aliexpress.com/item/4000252216391.html

This active balancer works by transferring the energy into a supercapacitor. It then transfers that energy into another battery. Since it can't transfer from battery to battery directly this essentially halves the transfer rate. So if you were looking to drain a battery at 1Ah you will need a 2A version. It claims that it can transfer this at 1A (for the 1A version) but so far I've seen it transfer to the supercap at around 600mA and then from the supercap to battery at around 800mA. This takes about 30 to 50 seconds each to charge the supercap and then discharge. I haven't thoroughly tested it so maybe it could be a connection issue.

I tested it using just 4 18650 cells

Below is when I started at a 300mV difference

image_mdknrj.jpg


Two hours later it was brought down to ~10mV difference (ignore my celllog8s, I had a bad connection so it shows 39mV). This is pretty impressive for me anyways. The unit was not even warm to the touch, just because the energy is essentially transferred to another cell instead of being dissipated via resistors as heat as most of the other passive balancers do.

image_ozhgxg.jpg


It does come with a bluetooth app which allows you to monitor it, as well as program it for the minimum voltage cutoff, the differential voltage cutoff, voltage calibration, number of cells (up to 24) and max current.

The most important thing for me was the minimum voltage cutoff so it doesn't drain the battery and a differential voltage cutoff so it doesn't constantly balance and only balance when the cells start to vary. The power consumption is next to nothing and my 4-cell setup test has not drained at all once it achieves the balance.

Now for the logging part. This is where I was stuck since my version that lacked a canbus or rs485 serial output I was unable to use it. It has a Bluetooth Low Energy on it but no way to interface to it until now. A user on github by the name of jblance posted up a version of it that would talk to it and output the data through mqqt to an influxdb.

https://github.com/jblance/jkbms

I'm still a little stuck on it because I need to modify it to match my current bms data so I won't lose it, but the author must be some wiz with all the classes and proper way of programming it that it's almost too much for me to understand. But I've been able to get some data out through the gatttool and hcitool command so I'm actually getting somewhere now. So it will be a matter of time before I make my own easier to understand python script that will communicate with the bluetooth.

Below is the documentation for the Canbus and I'm sure there's a serial rs-485 version out there as well)
https://secondlifestorage.com/showthread.php?tid=8258&pid=58487#pid58487

Hope this helps anyone that is looking at this balancer.
 

not2bme

Member
Joined
Oct 16, 2017
Messages
493
Quick update. Got the jkbms python script running through grafana and did some tests with some good results.

Took 4 18650 and had a difference of over 650mV between the highest and lowest cell from 3.3V to 4.15V.

image_sigujk.jpg


The balancer took about 3.5 hrs to bring it down to under 25mV (the threshold setting)

image_iyeyzs.jpg


Total voltage stayed the same, so not much energy lost during the balance.

image_tpvrgm.jpg


My next test would be to see the sustained transfer on one cell but will need a coulumb counter for that.
 

Mtour

New member
Joined
Jul 21, 2020
Messages
7
Any how-to guides out there, or could this be done with Windows... I am three hours into this, managed to load Ubunto on a laptop and download the files but am lost on updating python...
 

Korishan

Moderator
Joined
Jan 7, 2017
Messages
6,552
Mtour said:
Any how-to guides out there, or could this be done with Windows... I am three hours into this, managed to load Ubunto on a laptop and download the files but am lost on updating python...


There are plenty of guides out there. InfluxDB web site shows how to install on windows. Grafana site shows how to install on Windows. Python site shows how to install on Windows.

Do I recommend going that route? Probably not. For testing purposes probably just fine. Production purposes, I would go with linux definitely. It's far more stable for these situations. One of those being no middle of the night reboots because of an update.

And 3 hours isn't much time at all. I've spent days worth of time working on mine ;) Buuuut, I'm also installing other services like dns, dhcp, telegraf, and many other things.



Mtour: If you'd like, please join the discord linked in my signature and we can get your linux setup up and running. We have several linux/coding guru's over there.
 

not2bme

Member
Joined
Oct 16, 2017
Messages
493
Mtour said:
Any how-to guides out there, or could this be done with Windows... I am three hours into this, managed to load Ubunto on a laptop and download the files but am lost on updating python...

The jkbms code works for a raspberry pi 3. I don't know if it'll work on an ubuntu install without rewriting some code. For example it use bluepy which is a bluetooth python library. The rest of the applications like influxdb and grafana can be installed on windows, but I've been installing it on linux. I have been using unix off and on for ages now and I still hate how it's difficult to use certain things. Had to use vi the other day and was surprised I still remembered the few shortcuts... haha.

But if you get the raspberry pi 3 working with raspbian, which is quite simple, then you just have to follow the directions.
sudo apt-get install python3-pip
sudo pip3 install bluepy
sudo pip3 install paho-mqtt

Then download from github by typing
wget https://github.com/jblance/jkbms/archive/master.zip

unzip master.zip
cd master
sudo python3 setup.py

Then you need to edit the config file which is
sudo nano /etc/jkbms/jkbms.conf

you may need make a copy of the example config file first so issue a
sudo cp /etc/jkbms/jkbms.conf.example /etc/jkbms/jkbms.conf


ALso to make your life easier, enable the VNC server on the raspberry pi, then install the VNC Viewer software on your windows machine and you can attach to it remotely.
 

Mtour

New member
Joined
Jul 21, 2020
Messages
7
ok, makes sense... I'll order a raspberry pi 3 starter kit..

Thanks
 

not2bme

Member
Joined
Oct 16, 2017
Messages
493
Hmm now that I looked at it again, I thought it was bluepi, not bluepy. So it's a bluetooth le library for python. That means it probably doesn't have anything to do with the raspberry pi. I just had a pi 3 that I was already using to interface with my other bms and inverter so it wasn't a big deal. Probably a good thing to have anyways since it's quite a powerhouse for such a small unit so it can act like your mini pc and has a built in bluetooth already.

Also you will need to run the sudo hcitool lescan command to find the address of that balancer. Need that for the config file.
 

bwolten

New member
Joined
Sep 13, 2020
Messages
8
not2bme said:
Hmm now that I looked at it again, I thought it was bluepi, not bluepy. So it's a bluetooth le library for python. That means it probably doesn't have anything to do with the raspberry pi. I just had a pi 3 that I was already using to interface with my other bms and inverter so it wasn't a big deal. Probably a good thing to have anyways since it's quite a powerhouse for such a small unit so it can act like your mini pc and has a built in bluetooth already.

Also you will need to run the sudo hcitool lescan command to find the address of that balancer. Need that for the config file.
I followed your steps for the Rasp Pi 4...I am new to CLI, I am stuck at how or where do I open the application to view the values?? I have the apk on my phone but it would be nice to have it running on the PI4 so I can send the data to a PLC..

Would be great if you had a minute to explain how you got the app running on Grafana... After reading your post I had to have Grafana!!!!

thanks Brad
 

michu_michu

New member
Joined
Nov 28, 2019
Messages
4
I am also asking for info on how to run jk-b2a24s in grafan: P

thanks greetings.



Query BMS via BLE
Reading config file: /etc/jkbms/jkbms.conf
Logging level: 20
jkBMS Logging level: 20
Delegate JKBMS instance --- name: Power Wall 1, model: JK-DZ11-B2A24S, mac: 3C:A5:19:7B:27:D0, command: command, tag: Power_Wall_1, format: influx2, records: 1, maxConnectionAttempts: 3, mqttBroker: None
INFO:JKBMS-BT:Attempting to connect to Power Wall 1
INFO:JKBMS-BT:Connected to b'JK-DZ11-B2A24S\x00'
INFO:JKBMS-BT:Read characteristic: Characteristic <ffe3>, handle 10
INFO:JKBMS-BT:Enable 0x0b handle
INFO:JKBMS-BT:Enable read handle
INFO:JKBMS-BT:Write getInfo to read handle
INFO:JKBMS-BT:processing info record
INFO:JKBMS-BT:Record number: 153
INFO:JKBMS-BT:VendorID: JK-DZ11-B2A24S
{'VendorID': 'JK-DZ11-B2A24S'}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Device Name: JK-DZ11-B2A24S
{'DeviceName': 'JK-DZ11-B2A24S'}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Hardware Version: 3.0
{'HardwareVersion': '3.0'}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Software Version: 3.3.0
{'SoftwareVersion': '3.3.0'}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Uptime: 0D23H0M0S
{'Uptime': '0D23H0M0S'}:influx2:None:power_Wall_1
INFO:JKBMS-BT:power Up Times: 4
{'Power Up Times: 4'}:influx2:None:power_Wall_1
INFO:JKBMS-BT:notificationData has ACK
INFO:JKBMS-BT:Write getCellInfo to read handle
INFO:JKBMS-BT:Grabbing 1 records (after inital response)
INFO:JKBMS-BT:processing extended record
INFO:JKBMS-BT:Record number: 153
INFO:JKBMS-BT:notificationData has ACK
INFO:JKBMS-BT:processing cell data record
INFO:JKBMS-BT:Record length 300
INFO:JKBMS-BT:Record number: 153
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.359375
INFO:JKBMS-BT:After position 1: 3.3717041015625
INFO:JKBMS-BT:After position 0: 3.3717079162597656
INFO:JKBMS-BT:Cell: 01, Volts: 3.3717
{'VoltageCell01': 3.3717079162597656}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.359375
INFO:JKBMS-BT:After position 1: 3.37451171875
INFO:JKBMS-BT:After position 0: 3.3745412826538086
INFO:JKBMS-BT:Cell: 02, Volts: 3.3745
{'VoltageCell02': 3.3745412826538086}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.359375
INFO:JKBMS-BT:After position 1: 3.37310791015625
INFO:JKBMS-BT:After position 0: 3.373124599456787
INFO:JKBMS-BT:Cell: 03, Volts: 3.3731
{'VoltageCell03': 3.373124599456787}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.375
INFO:JKBMS-BT:After position 1: 3.3773193359375
INFO:JKBMS-BT:After position 0: 3.3773746490478516
INFO:JKBMS-BT:Cell: 04, Volts: 3.3774
{'VoltageCell04': 3.3773746490478516}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.375
INFO:JKBMS-BT:After position 1: 3.3787841796875
INFO:JKBMS-BT:After position 0: 3.378791332244873
INFO:JKBMS-BT:Cell: 05, Volts: 3.3788
{'VoltageCell05': 3.378791332244873}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.375
INFO:JKBMS-BT:After position 1: 3.38018798828125
INFO:JKBMS-BT:After position 0: 3.3802080154418945
INFO:JKBMS-BT:Cell: 06, Volts: 3.3802
{'VoltageCell06': 3.3802080154418945}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.375
INFO:JKBMS-BT:After position 1: 3.3773193359375
INFO:JKBMS-BT:After position 0: 3.3773746490478516
INFO:JKBMS-BT:Cell: 07, Volts: 3.3774
{'VoltageCell07': 3.3773746490478516}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.375
INFO:JKBMS-BT:After position 1: 3.3773193359375
INFO:JKBMS-BT:After position 0: 3.3773746490478516
INFO:JKBMS-BT:Cell: 08, Volts: 3.3774
{'VoltageCell08': 3.3773746490478516}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.375
INFO:JKBMS-BT:After position 1: 3.38018798828125
INFO:JKBMS-BT:After position 0: 3.3802080154418945
INFO:JKBMS-BT:Cell: 09, Volts: 3.3802
{'VoltageCell09': 3.3802080154418945}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.375
INFO:JKBMS-BT:After position 1: 3.38299560546875
INFO:JKBMS-BT:After position 0: 3.3830413818359375
INFO:JKBMS-BT:Cell: 10, Volts: 3.3830
{'VoltageCell10': 3.3830413818359375}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.375
INFO:JKBMS-BT:After position 1: 3.3773193359375
INFO:JKBMS-BT:After position 0: 3.3773746490478516
INFO:JKBMS-BT:Cell: 11, Volts: 3.3774
{'VoltageCell11': 3.3773746490478516}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.375
INFO:JKBMS-BT:After position 1: 3.3787841796875
INFO:JKBMS-BT:After position 0: 3.378791332244873
INFO:JKBMS-BT:Cell: 12, Volts: 3.3788
{'VoltageCell12': 3.378791332244873}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.359375
INFO:JKBMS-BT:After position 1: 3.37310791015625
INFO:JKBMS-BT:After position 0: 3.373124599456787
INFO:JKBMS-BT:Cell: 13, Volts: 3.3731
{'VoltageCell13': 3.373124599456787}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.359375
INFO:JKBMS-BT:After position 1: 3.37451171875
INFO:JKBMS-BT:After position 0: 3.3745412826538086
INFO:JKBMS-BT:Cell: 14, Volts: 3.3745
{'VoltageCell14': 3.3745412826538086}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.375
INFO:JKBMS-BT:After position 1: 3.3773193359375
INFO:JKBMS-BT:After position 0: 3.3773746490478516
INFO:JKBMS-BT:Cell: 15, Volts: 3.3774
{'VoltageCell15': 3.3773746490478516}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.375
INFO:JKBMS-BT:After position 1: 3.3787841796875
INFO:JKBMS-BT:After position 0: 3.378791332244873
INFO:JKBMS-BT:Cell: 16, Volts: 3.3788
{'VoltageCell16': 3.378791332244873}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 17, Volts: 0.0000
{'VoltageCell17': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 18, Volts: 0.0000
{'VoltageCell18': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 19, Volts: 0.0000
{'VoltageCell19': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 20, Volts: 0.0000
{'VoltageCell20': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 21, Volts: 0.0000
{'VoltageCell21': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 22, Volts: 0.0000
{'VoltageCell22': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 23, Volts: 0.0000
{'VoltageCell23': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 24, Volts: 0.0000
{'VoltageCell24': 0.0}:influx2:None:power_Wall_1
{'VoltageTotal': 54.03374433517456}:influx2:None:power_Wall_1
INFO:JKBMS-BT:processing wire resistances
INFO:JKBMS-BT:After position 3: 0.125
INFO:JKBMS-BT:After position 2: 0.1376953125
INFO:JKBMS-BT:After position 1: 0.13832473754882812
INFO:JKBMS-BT:After position 0: 0.13832587003707886
INFO:JKBMS-BT:Cell: 00, Resistance: 0.1383
INFO:JKBMS-BT:After position 3: 0.125
INFO:JKBMS-BT:After position 2: 0.1376953125
INFO:JKBMS-BT:After position 1: 0.13832473754882812
INFO:JKBMS-BT:After position 0: 0.13832587003707886
{'ResistanceCell00': 0.13832587003707886}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.1171875
INFO:JKBMS-BT:After position 1: 0.11728477478027344
INFO:JKBMS-BT:After position 0: 0.11728477478027344
INFO:JKBMS-BT:Cell: 01, Resistance: 0.1173
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.1171875
INFO:JKBMS-BT:After position 1: 0.11728477478027344
INFO:JKBMS-BT:After position 0: 0.11728477478027344
{'ResistanceCell01': 0.11728477478027344}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.1123046875
INFO:JKBMS-BT:After position 1: 0.11254215240478516
INFO:JKBMS-BT:After position 0: 0.11254262179136276
INFO:JKBMS-BT:Cell: 02, Resistance: 0.1125
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.1123046875
INFO:JKBMS-BT:After position 1: 0.11254215240478516
INFO:JKBMS-BT:After position 0: 0.11254262179136276
{'ResistanceCell02': 0.11254262179136276}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.11767578125
INFO:JKBMS-BT:After position 1: 0.11778545379638672
INFO:JKBMS-BT:After position 0: 0.11778612062335014
INFO:JKBMS-BT:Cell: 03, Resistance: 0.1178
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.11767578125
INFO:JKBMS-BT:After position 1: 0.11778545379638672
INFO:JKBMS-BT:After position 0: 0.11778612062335014
{'ResistanceCell03': 0.11778612062335014}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.11279296875
INFO:JKBMS-BT:After position 1: 0.11290168762207031
INFO:JKBMS-BT:After position 0: 0.11290179565548897
INFO:JKBMS-BT:Cell: 04, Resistance: 0.1129
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.11279296875
INFO:JKBMS-BT:After position 1: 0.11290168762207031
INFO:JKBMS-BT:After position 0: 0.11290179565548897
{'ResistanceCell04': 0.11290179565548897}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.111328125
INFO:JKBMS-BT:After position 1: 0.11148452758789062
INFO:JKBMS-BT:After position 0: 0.1114853210747242
INFO:JKBMS-BT:Cell: 05, Resistance: 0.1115
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.111328125
INFO:JKBMS-BT:After position 1: 0.11148452758789062
INFO:JKBMS-BT:After position 0: 0.1114853210747242
{'ResistanceCell05': 0.1114853210747242}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.11083984375
INFO:JKBMS-BT:After position 1: 0.11087417602539062
INFO:JKBMS-BT:After position 0: 0.1108749583363533
INFO:JKBMS-BT:Cell: 06, Resistance: 0.1109
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.11083984375
INFO:JKBMS-BT:After position 1: 0.11087417602539062
INFO:JKBMS-BT:After position 0: 0.1108749583363533
{'ResistanceCell06': 0.1108749583363533}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.11083984375
INFO:JKBMS-BT:After position 1: 0.1109476089477539
INFO:JKBMS-BT:After position 0: 0.11094840615987778
INFO:JKBMS-BT:Cell: 07, Resistance: 0.1109
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.11083984375
INFO:JKBMS-BT:After position 1: 0.1109476089477539
INFO:JKBMS-BT:After position 0: 0.11094840615987778
{'ResistanceCell07': 0.11094840615987778}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.11083984375
INFO:JKBMS-BT:After position 1: 0.11102867126464844
INFO:JKBMS-BT:After position 0: 0.11102940887212753
INFO:JKBMS-BT:Cell: 08, Resistance: 0.1110
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.11083984375
INFO:JKBMS-BT:After position 1: 0.11102867126464844
INFO:JKBMS-BT:After position 0: 0.11102940887212753
{'ResistanceCell08': 0.11102940887212753}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.113037109375
INFO:JKBMS-BT:After position 1: 0.11310005187988281
INFO:JKBMS-BT:After position 0: 0.11310017853975296
INFO:JKBMS-BT:Cell: 09, Resistance: 0.1131
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.113037109375
INFO:JKBMS-BT:After position 1: 0.11310005187988281
INFO:JKBMS-BT:After position 0: 0.11310017853975296
{'ResistanceCell09': 0.11310017853975296}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.112548828125
INFO:JKBMS-BT:After position 1: 0.11266040802001953
INFO:JKBMS-BT:After position 0: 0.11266123130917549
INFO:JKBMS-BT:Cell: 10, Resistance: 0.1127
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.112548828125
INFO:JKBMS-BT:After position 1: 0.11266040802001953
INFO:JKBMS-BT:After position 0: 0.11266123130917549
{'ResistanceCell10': 0.11266123130917549}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.113037109375
INFO:JKBMS-BT:After position 1: 0.11324501037597656
INFO:JKBMS-BT:After position 0: 0.11324548721313477
INFO:JKBMS-BT:Cell: 11, Resistance: 0.1132
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.113037109375
INFO:JKBMS-BT:After position 1: 0.11324501037597656
INFO:JKBMS-BT:After position 0: 0.11324548721313477
{'ResistanceCell11': 0.11324548721313477}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.1171875
INFO:JKBMS-BT:After position 1: 0.11725711822509766
INFO:JKBMS-BT:After position 0: 0.11725746467709541
INFO:JKBMS-BT:Cell: 12, Resistance: 0.1173
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.1171875
INFO:JKBMS-BT:After position 1: 0.11725711822509766
INFO:JKBMS-BT:After position 0: 0.11725746467709541
{'ResistanceCell12': 0.11725746467709541}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.117431640625
INFO:JKBMS-BT:After position 1: 0.11765003204345703
INFO:JKBMS-BT:After position 0: 0.11765042692422867
INFO:JKBMS-BT:Cell: 13, Resistance: 0.1177
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.117431640625
INFO:JKBMS-BT:After position 1: 0.11765003204345703
INFO:JKBMS-BT:After position 0: 0.11765042692422867
{'ResistanceCell13': 0.11765042692422867}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.112548828125
INFO:JKBMS-BT:After position 1: 0.112579345703125
INFO:JKBMS-BT:After position 0: 0.1125798411667347
INFO:JKBMS-BT:Cell: 14, Resistance: 0.1126
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.112548828125
INFO:JKBMS-BT:After position 1: 0.112579345703125
INFO:JKBMS-BT:After position 0: 0.1125798411667347
{'ResistanceCell14': 0.1125798411667347}:influx2:None:power_Wall_1
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.1123046875
INFO:JKBMS-BT:After position 1: 0.11250972747802734
INFO:JKBMS-BT:After position 0: 0.11250985786318779
INFO:JKBMS-BT:Cell: 15, Resistance: 0.1125
INFO:JKBMS-BT:After position 3: 0.03125
INFO:JKBMS-BT:After position 2: 0.1123046875
INFO:JKBMS-BT:After position 1: 0.11250972747802734
INFO:JKBMS-BT:After position 0: 0.11250985786318779
{'ResistanceCell15': 0.11250985786318779}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 16, Resistance: 0.0000
{'ResistanceCell16': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 17, Resistance: 0.0000
{'ResistanceCell17': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 18, Resistance: 0.0000
{'ResistanceCell18': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 19, Resistance: 0.0000
{'ResistanceCell19': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 20, Resistance: 0.0000
{'ResistanceCell20': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 21, Resistance: 0.0000
{'ResistanceCell21': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 22, Resistance: 0.0000
{'ResistanceCell22': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 23, Resistance: 0.0000
{'ResistanceCell23': 0.0}:influx2:None:power_Wall_1
INFO:JKBMS-BT:Cell: 24, Resistance: 0.0000
{'ResistanceCell24': 0.0}:influx2:None:power_Wall_1
Got 1 records
INFO:JKBMS-BT:Disconnecting...
 

ajw22

Member
Joined
Nov 16, 2018
Messages
641
not2bme, the active BMS is certainly efficient and very powerful... very envious... but I'm afraid that in my system, it would mask faulty cells. My puny 50mA passive balancer simply cannot keep up with any abnormal self-discharging cells, and I can easily see the problem in the voltage graphs after a few days~weeks.
How has been your experience on that front? Do you have some sort of counter to track which packs needed the most balancing?
 

bwolten

New member
Joined
Sep 13, 2020
Messages
8
michu_michu,

looks like it is working for you... What is the application sequence to obtain the data??

I follow the part where I need to modify the config file but after that I am Lost!!

thanks
 

not2bme

Member
Joined
Oct 16, 2017
Messages
493
bwolten said:
michu_michu,

looks like it is working for you... What is the application sequence to obtain the data??

I follow the part where I need to modify the config file but after that I am Lost!!

thanks

If you installed it correctly, all you have to do is just type in jkbms -D and that will go into debug mode and display what michu_michu had posted (or is it jkbms -p I forget?!). Now as far as getting it into grafana, that's where I didn't follow the script. It uses something called mqqt and I'm just not familiar with it. So that's why I had to hack mine to make it work with what I know (which is using telegraf and getting the raw data into influxdb). I know! it's confusing!

I'm kinda tied up right now and had to break down the setup, so when I have a chance, I can look into mqqt and see how it works and write up something. Or if someone here's familiar with mqqt maybe they can chime in.

Code:
pi@raspberrypi:~ $ jkbms --help
usage: jkbms [-h] [-c CONFIGFILE] [-q MQTTBROKER] [-n NAME] [-p] [-r RECORDS]
      [-x DECODEHEX] [-d] [-D] [-I]

JKBMS Utility, version: 0.1.0

optional arguments:
 -h, --help      show this help message and exit
 -c CONFIGFILE, --configFile CONFIGFILE
            Config file
 -q MQTTBROKER, --mqttBroker MQTTBROKER
            MQTT Broker
 -n NAME, --name NAME Process on the device with this section name in the
            config file
 -p, --printResultsOnly
            Just print the results, dont try to send to the MQTT
            Broker
 -r RECORDS, --records RECORDS
            Number of records to get from the BMS
 -x DECODEHEX, --decodeHex DECODEHEX
            Hex to decode (will not communication to BMS)
 -d, --dumpConfigFile Print the config file and exit
 -D, --enableDebug  Enable Debug and above (i.e. all) messages
 -I, --enableInfo   Enable Info and above level messages
pi@raspberrypi:~ $ jkbms -D


ajw22 said:
not2bme, the active BMS is certainly efficient and very powerful... very envious... but I'm afraid that in my system, it would mask faulty cells. My puny 50mA passive balancer simply cannot keep up with any abnormal self-discharging cells, and I can easily see the problem in the voltage graphs after a few days~weeks.
How has been your experience on that front? Do you have some sort of counter to track which packs needed the most balancing?

Honestly I haven't installed it yet. It's part of my setup to move to 48V (I got a new inverter last year so I had been meaning to switch to it). But I don't expect it to behave any different than my current balancer. In fact, with this setup you can program your balance point. So for example you set your unit to only balance at 50mV, then the one that drags behind will be your culprit. So the highest pack will start charging the lowest pack, but it will stop once the deviation between the highest and the lowest is 50mV. And if one is self discharging, you'd bet it'll always be the one that's the lowest.

The problem is my packs are pretty well balanced so they never even hit the limit for me to see it in action.


If you're impatient, I can show you how I do it on mine, even though it's not elegant. Attached is my version of this python script. The original author had this whole install setup and service, etc. Pretty cool stuff. I'm just old school and want it all in one script. So I merged all the different code in all the different folders and put it all in one file.

So this is how mine works:
1. Run my version of the jkbms.py. It outputs in json data.
2. Use telegraf (an influxdb tool) that willexecute the above script, take the data and push it into my influxdb database server on 10.1.1.10.
3. I have a database called 'powerwall' already set up and my bms table where all these data are dumped is called 'jkbms'. Influxdb will automatically generate this table as soon as you push data to it through telegraf.
3. Then use grafana and select the powerwall database and the choose the jkbms table and voila that's how I roll :)

To test my script it you type in python3 jkbms.py (in the same directory as the file)

You have to edit the file first by nano jkbms.py and put in the address of the bluetooth mac.

It outputs in json data (some formatted data that I use through telegraf to import into my influxdb server). Below is part of the config showing the inputs plugin for the /etc/telegraf/telegraf.conf file. That jkbms script is actually on my desktop on the raspberry pi. It's a test after all.



Code:
[agent]
 ## Default data collection interval for all inputs
 interval = "15s"
 round_interval = true
 metric_batch_size = 1000
 metric_buffer_limit = 10000
 collection_jitter = "0s"
 flush_interval = "10s"
 flush_jitter = "0s"
 precision = ""
 debug = false
 quiet = false
 logfile = ""
 hostname = ""
 omit_hostname = false


###############################################################################
#              OUTPUT PLUGINS                 #
###############################################################################

# Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
urls = ["http://10.1.1.10:8086"]
database = "powerwall"



###############################################################################
#              INPUT PLUGINS                  #
###############################################################################

# # Read metrics from one or more commands that can output to stdout

 [[inputs.exec]]
 commands = [
  "/home/pi/Desktop/jkbms.py"
 ]

 timeout = "20s"
name_suffix = ""
name_override = "jkbms"
 data_format = "json"
 

Attachments

  • jkbms.zip
    4.2 KB · Views: 224

bwolten

New member
Joined
Sep 13, 2020
Messages
8
Hey thanks,

looks like your rolling in the right direction.. I saw tutorials on telgraph and influxdb so I will head that way with your script...

Thank you for your effort and taking the time for your reply..
 

OffGridInTheCity

Active member
Joined
Dec 15, 2018
Messages
1,746
ajw22 said:
not2bme, the active BMS is certainly efficient and very powerful... very envious... but I'm afraid that in my system, it would mask faulty cells. My puny 50mA passive balancer simply cannot keep up with any abnormal self-discharging cells, and I can easily see the problem in the voltage graphs after a few days~weeks.
How has been your experience on that front? Do you have some sort of counter to track which packs needed the most balancing?
This is a great point. An 'active balancer' sounds attractive - but as I've discovered, healthy packs do not need but the smallest balance during operation. My packs run months at a time with no balance needed. The thing I appreciate about Batrium is that I can turn balance on / off - so I can use it to touch things up but leave it off most of the time.... so I can see if any of the packs need attention.

I've come to view balancing as a useful tool (e.g. when you first hookup a battery or for touch-ups)but not something I aspire to run all the time.
 

not2bme

Member
Joined
Oct 16, 2017
Messages
493
Here's the RS485 protocol that I was able to obtain for the JK-B1A24S. I don't have the board with this interface so I can't use it but is up for anyone else that could use it.

View attachment 5
 

Attachments

  • JK-B1A24S-RS485-protocol-english.pdf
    108 KB · Views: 243

Solardad

Member
Joined
Oct 27, 2018
Messages
76
not2bme said:
Here's the RS485 protocol that I was able to obtain for the JK-B1A24S. I don't have the board with this interface so I can't use it but is up for anyone else that could use it.

Wondering if folks made any progress with taking this data from the JKBMS process into Node-Red? I am able to successfully confirm the package has been setup on my RPI zeroand is polling the JKBMS correctly - all cells are listed with voltage and resistance.

EX:

Code:
DEBUG:JKBMS-BT:Hex bytearray(b'.\x03T@') decoded to 3.3126940727233887
INFO:JKBMS-BT:Cell: 02, Volts: 3.3127
{'VoltageCell02': 3.3126940727233887}:influx2:None:Power_Wall_1
INFO:JKBMS-BT:After position 3: 2
INFO:JKBMS-BT:After position 2: 3.3125
INFO:JKBMS-BT:After position 1: 3.31414794921875
INFO:JKBMS-BT:After position 0: 3.314167022705078
DEBUG:JKBMS-BT:hexString: bytearray(b'P\x1bT@')
DEBUG:JKBMS-BT:hex(byte1): 0x40
DEBUG:JKBMS-BT:byte1Low: 0
DEBUG:JKBMS-BT:hex(byte2): 0x54
DEBUG:JKBMS-BT:byte2High: 5
DEBUG:JKBMS-BT:byte2Low: 4
DEBUG:JKBMS-BT:hex(byte3): 0x1b
DEBUG:JKBMS-BT:byte3High: 1
DEBUG:JKBMS-BT:byte3Low: 11
DEBUG:JKBMS-BT:hex(byte4): 0x50
DEBUG:JKBMS-BT:byte4High: 5
DEBUG:JKBMS-BT:byte4Low: 0
DEBUG:JKBMS-BT:step1: 0.25
DEBUG:JKBMS-BT:step2: 0.015625
DEBUG:JKBMS-BT:step3: 0.0009765625
DEBUG:JKBMS-BT:step4: 6.103515625e-05
DEBUG:JKBMS-BT:step5: 3.814697265625e-06
DEBUG:JKBMS-BT:step6: 2.384185791015625e-07
DEBUG:JKBMS-BT:Hex bytearray(b'P\x1bT@') decoded to 3.314167022705078
INFO:JKBMS-BT:Cell: 03, Volts: 3.3142


As for MQTT protocol JBLANCE usesI was able to figure out (I think) that the original install instructions was missing directions on installing a MQTT service. I am working off of a RPI Zero so it is somewhat slow ;-) but once I installed the MQTT client I was able to 'connect' via Node-Red MQTT IN node.

sudo apt-get install mosquitto mosquitto-clients

The challenge I have is that even though the code states JSON via MQTT service I only receive data via 'string' setting, if I manually select JSON it barfs.Failed to parse JSON string

MQTT IN setup:


image_ofkuqu.jpg


Also I appear to be receiving only part of the data that relates to the device only, VendorID, Hardware, Software and Uptimeex:


image_frowif.jpg


There appears to be only one main MQTT topic, "jkbms" to reference so I am not sure how to pull in the Cell details...?.?
For now my flow is very basic as I am trying to confirm via the debug window in Node Red what the payload options look like before I push it over to influxdb.


Thoughts anyone?
 

daromer

Moderator
Joined
Oct 8, 2016
Messages
5,659
Not perhaps a resolution but i have learned that you often need to use the JSON node in Node-red to convert the incomming to actual json. Have you tried that ?

When pushing to influx beware of how influx works! there are plenty of dos-donts to be honest. its not like a normal database where you pre-assign several collumns. In influx its better to use tags and only one(1) value.

So instead of inserting val1,val2,val3,val3 in one row its better to insert [{val,device=xxxx}, { val,device=yyyyy}] and so forth. This ensures that you easier can work with the built in functions in influx and run it. This of course depends on how the data look like. Above is for when you know you got different data comming in from the devices. If you know that 1 row ALWAYS look the same you can predefine val1,val2,val3 and so forth instead and that most likely goes faster

I can explain more but there are really good material out there on designing and this may not seem rellevant in the beginning but when you want to start to do math and other scientific functions on the data including having huge datasets you will have a great advantage.

Same goes in using properly setup age of the data. How long should the database keep the data and to what resolution :D
 
Top