jakeler / bms-parser Goto Github PK
View Code? Open in Web Editor NEWBinary protocol parser for the smart BMS from LTT Power
Binary protocol parser for the smart BMS from LTT Power
I'm attempting to connect to a Meritsun BMS over BLE. I have been able to connect to the device and list its characteristics, but I haven't gotten any useful information out of it as of yet. I'm kind of new to the whole BLE space, so right now I probably have some very feeble attempts at trying to convince thing to talk to me.
What I have found so far:
$ sudo bluetoothctl info
Device AC:23:3F:41:90:3B (public)
Name: MSP-12V300Ah
Alias: MSP-12V300Ah
Paired: no
Trusted: no
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (6e40fff0-b5a3-f393-e0a9-e50e24dcca9e)
ManufacturerData Key: 0x0000
ManufacturerData Value:
4d 69 6e 65 77 20 54 65 63 68 Minew Tech
ServiceData Key: 0000ffe1-0000-1000-8000-00805f9b34fb
ServiceData Value:
ac 23 3f 41 90 3b .#?A.;
$ sudo ble-scan -d AC:23:3F:41:90:3B
Started deep scan of AC:23:3F:41:90:3B
SERVICE 6e40fff0-b5a3-f393-e0a9-e50e24dcca9e (Handle: 14): Unknown
CHARACTERISTIC 6e40fff2-b5a3-f393-e0a9-e50e24dcca9e (Handle: 18): Unknown ['write-without-response', 'write']
CHARACTERISTIC 6e40fff1-b5a3-f393-e0a9-e50e24dcca9e (Handle: 15): Unknown ['notify']
DESCRIPTOR 00002902-0000-1000-8000-00805f9b34fb (Handle: 17): Client Characteristic Configuration
SERVICE 00001801-0000-1000-8000-00805f9b34fb (Handle: 10): Generic Attribute Profile
CHARACTERISTIC 00002a05-0000-1000-8000-00805f9b34fb (Handle: 11): Service Changed ['indicate']
DESCRIPTOR 00002902-0000-1000-8000-00805f9b34fb (Handle: 13): Client Characteristic Configuration
If I attempt to read on that 6e40fff2 characteristic, then I'm getting a well-known packet out:
Attempting to read /org/bluez/hci0/dev_AC_23_3F_41_90_3B/service000e/char0012
[CHG] Attribute /org/bluez/hci0/dev_AC_23_3F_41_90_3B/service000e/char0012 Value:
dd a5 04 00 ff fc 77 ......w
I then proceeded with trying to set up ble-serial over this:
$ sudo ble-serial -d AC:23:3F:41:90:3B -r 6e40fff1-b5a3-f393-e0a9-e50e24dcca9e -w 6e40fff2-b5a3-f393-e0a9-e50e24dcca9e
22:30:56.889 | INFO | linux_pty.py: Slave created on /tmp/ttyBLE -> /dev/pts/3
22:30:56.890 | INFO | ble_interface.py: Receiver set up
22:30:56.902 | INFO | ble_interface.py: Trying to connect with AC:23:3F:41:90:3B
22:30:59.894 | INFO | ble_interface.py: Device AC:23:3F:41:90:3B connected
22:30:59.895 | INFO | ble_interface.py: Found write characteristic 6e40fff2-b5a3-f393-e0a9-e50e24dcca9e (H. 18)
22:30:59.895 | INFO | ble_interface.py: Found notify characteristic 6e40fff1-b5a3-f393-e0a9-e50e24dcca9e (H. 15)
22:31:00.071 | INFO | main.py: Running main loop!
But when I then attempted to run your code to try and query it, nothing really happens:
$ sudo python3 ./main.py /dev/pts/3 -v
> Request: dda50300fffd77
> Request: dda50400fffc77
> Request: dda50300fffd77
> Request: dda50400fffc77
and so it continues.
What am I missing here? How can I get this device to talk to me? I believe this is the BMS in question: https://www.meritsunpower.com/high-quality-3s-4s-8s-15s-16s-12v-24v-48v-bms-lifepo4-for-lithium-ion-battery-pack-with-balance
Great thanks in advance! :)
As reported by @mikspec
I tried to charge battery in negative temperature and parser returns ocp_short (10th bit set) however in reality it should return utp_charge - 5th bit (counting from 0). Parsing protection bits in reverse order seems fix the issue - in reverse order 10th bit became 5th.
Needs further verification, I have to admit that I haven't really tested these bits so far.
Use new packaging standard - poerty build.
Submodules:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.