Monday, 20 July 2026

Trying to talk to all three 24v LFP batteries over BLE

(25/7/26 12:38)

Got some battery inform running 

/home/coderdojo/Arduino/M5 Stamp/BLE_client_v1_3/BLE_client_v1_3.ino

12:38:15.135 -> 

12:38:15.135 -> Looking for BLE device name [BR2262e-s]..

12:38:15.202 -> A BLE Advertised Device named [SP10S009-L8S-100A-B-U] found

12:38:15.235 -> A BLE Advertised Device named [BR2262e-s] found

12:38:15.235 -> Desired BLE Device [BR2262e-s] found

12:38:18.746 -> We are now connected to the BLE Server.

12:38:18.746 -> 0xdd, 0x03, 0x00, 0x19, 0x0a, 0x42, 0x00, 0x00, 0x10, 0x28, 0x27, 0x10, 0x00, 0x7d, 0x2a, 0xc5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x2b, 0x03, 0x08, 0x01, 0x0b, 0x83, 0xfc, 0xeb, 0x77, 

12:38:18.746 -> Battery current= 0.00 I

12:38:18.746 -> Battery balance=0

12:38:18.746 -> (Not being read!)Battery temperature=0.000000

12:38:18.746 -> messageMask=3

12:38:18.779 -> A BLE Advertised Device named [SP10S009-L8S-100A-B-U] found

12:38:18.779 -> A BLE Advertised Device named [BR2262e-s] found

12:38:18.779 -> Desired BLE Device [BR2262e-s] found

12:38:21.823 -> We are now connected to the BLE Server.

12:38:21.823 -> 0xdd, 0x04, 0x00, 0x10, 0x0c, 0xd4, 0x0c, 0xd3, 0x0c, 0xd3, 0x0c, 0xd2, 0x0c, 0xd2, 0x0c, 0xd2, 0x0c, 0xd3, 0x0c, 0xd4, 0xf8, 0xf9, 0x77, 

12:38:21.823 -> Cell 1=3284 mV, Cell 2=3283 mV, Cell 3=3283 mV, Cell 4=3282 mV, Cell 5=3282 mV, Cell 6=3282 mV, Cell 7=3283 mV, Cell 8=3284 mV, 

12:38:21.823 -> Total volts=26.26 V

12:38:21.823 -> messageMask=7




(25/7/26 10:39)

Just had some success with a M5 Stamp scanning near the batteries..

/home/coderdojo/Arduino/M5 Stamp/Scan/Scan.io



10:49:29.175 -> Advertised Device: Name: SP10S009-L8S-100A-B-U, Address: a4:c1:37:10:00:d2, manufacturer data: d2001037c1a4, serviceUUID: 0000ff00-0000-1000-8000-00805f9b34fb, rssi: -67 

10:49:29.175 -> Advertised Device: Name: , Address: 6e:2e:2e:be:f1:fe, manufacturer data: e000086aca8c48f4, serviceUUID: 0000fe9f-0000-1000-8000-00805f9b34fb, rssi: -83, serviceData:  

10:49:29.473 -> Advertised Device: Name: BR2262e-s, Address: 04:7f:0e:00:1a:7c, manufacturer data: 02a7dc3855a4, serviceUUID: 0000ff00-0000-1000-8000-00805f9b34fb, serviceUUID: 6e40ff00-b5a3-f393-e0a9-e50e24dcca9e, rssi: -69 

10:49:30.536 -> Advertised Device: Name: , Address: 40:00:4d:d3:2d:27, serviceUUID: 0000feed-0000-1000-8000-00805f9b34fb, rssi: -67, serviceData:  

10:49:30.669 -> Advertised Device: Name: DL-401804012334, Address: 40:18:04:01:23:34, manufacturer data: 020316401804012334444c, rssi: -84 

10:49:32.028 -> Advertised Device: Name: , Address: 55:8d:e4:9f:15:a7, serviceUUID: 0000fef3-0000-1000-8000-00805f9b34fb, rssi: -105, serviceData: J#CN2H2X⸮⸮⸮m⸮gLnc⸮)g⸮aB$ 

10:49:32.028 -> Advertised Device: Name: , Address: 40:00:59:aa:b7:e0, serviceUUID: 0000feed-0000-1000-8000-00805f9b34fb, rssi: -76, serviceData:  

10:49:34.153 -> Devices found: 7

10:49:34.153 -> Scan done!


I will next see if I can get battery info!




(20/7/26)

I have three 24v nominal LFP batteries.

Can I use Python3 code to access each over BLE ?

First, "SP10S009-L8S-100A-B-U" A4:C1:37:10:00:D2

Second, "BR2262e-s" 04:7F:0E:00:1A:7C

Third. "????" xx:xx  (daly BMS)


Starting with with First do I write to characteristic 0xFF01 of service 0xFF00 ?


./gatt-python could discover but not connect to "B" or "S"

pi@sionnach:~/gatt-python $ python3 ./discover.py 

Discovered [41:3c:6e:a0:75:f1] 41-3C-6E-A0-75-F1

Discovered [40:00:59:aa:b7:e0] 40-00-59-AA-B7-E0

Discovered [a4:c1:37:10:00:d2] SP10S009-L8S-100A-B-U

Discovered [a4:c1:37:10:00:d2] SP10S009-L8S-100A-B-U

Discovered [04:7f:0e:00:1a:7c] BR2262e-s

Discovered [a4:c1:37:10:00:d2] SP10S009-L8S-100A-B-U

Discovered [a4:c1:37:10:00:d2] SP10S009-L8S-100A-B-U


pi@sionnach:~/gatt-python $ 

pi@sionnach:~/gatt-python $ python3 ./connects_S.py 

[a4:c1:37:10:00:d2] Connection failed: Device does not exist, check adapter name and MAC address.


(2026_05_bleak) pi@sionnach:~/2026_05_bleak also failed.

2026_05_bleak) pi@sionnach:~/2026_05_bleak $ nano scanner_S.py 

(2026_05_bleak) pi@sionnach:~/2026_05_bleak $ 

(2026_05_bleak) pi@sionnach:~/2026_05_bleak $ python3 ./scanner_S.py 

Traceback (most recent call last):

  File "/home/pi/2026_05_bleak/./scanner_S.py", line 37, in <module>

    asyncio.run(main(address))

  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run

    return runner.run(main)

           ^^^^^^^^^^^^^^^^

  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run

    return self._loop.run_until_complete(task)


This directory was also no good...


(24v_battery) pi@sionnach:~/24v_battery/bin $ ./gattctl 

Module 'dbus' not found

Please run: sudo apt-get install python3-dbus

See also: https://github.com/getsenic/gatt-python#installing-gatt-sdk-for-python

(24v_battery) pi@sionnach:~/24v_battery/bin $ 


(24v_battery) pi@sionnach:~/jbdtool/build $ 

(24v_battery) pi@sionnach:~/jbdtool/build $ ls ..

battery.h  build.h  changelog  dsfuncs.h  jbd_info.c  list.h    module.h  pack.h    README.md  utils.h

bt.c       can.c    config.h   ip.c       jbd_info.h  main.c    mqtt.c    parson.c  serial.c   uuid.h

buffer.h   cfg.c    daemon.c   jbd.c      LICENSE     Makefile  mqtt.h    parson.h  si.h       worker.h

build      cfg.h    debug.h    jbd.h      list.c      module.c  mybmm.h   r         utils.c

(24v_battery) pi@sionnach:~/jbdtool/build $ 

Also no good



Also no good

(JBD_BMS_BTLE) pi@sionnach:~/JBD_BMS_BTLE $ cd ..


Didn't try aiobmsble as it looks incomplete as no runnable .py script!


Didn't try ANT_BMS as it uses serial port


smart_bms also failed..

docs  dumb_test.py  examples  LICENSE.txt  README.md  requirements.txt  smart_bms  test.py

pi@sionnach:~/smart_bms $ vim test.py 

pi@sionnach:~/smart_bms $ python3 ./test.py 

('A4:C1:37:10:00:D2', 'SP10S009-L8S-100A-B-U', 'Jikong')

WALSH: Running bluetootchctl command <disconnect A4:C1:37:10:00:D2>

WALSH: Running bluetootchctl command <power on>

Traceback (most recent call last):

  File "/usr/lib/python3.11/asyncio/tasks.py", line 490, in wait_for

    return fut.result()

           ^^^^^^^^^^^^

  File "/home/pi/smart_bms/smart_bms/TransportBLE.py", line 70, in _read_inner

    data = [await self._read_queue.get()]




pi@sionnach:~/solar-bt-monitor $ nano solar-bt-monitor.ini

pi@sionnach:~/solar-bt-monitor $ nano solar-bt-monitor.ini.B

pi@sionnach:~/solar-bt-monitor $ 

pi@sionnach:~/solar-bt-monitor $ python3 ./solar-bt-monitor.py 

DEBUG: [CONFIG] mac_addr: A4:C1:37:10:00:D2

DEBUG: [CONFIG] alias: SP10S009-L8S-100A-B-U

DEBUG: [CONFIG] adapter: hci0

DEBUG: [CONFIG] reconnect: True

DEBUG: [CONFIG] continuous_monitor: True

DEBUG: [CONFIG] data_read_interval: 30

DEBUG: [CONFIG] logger_type: prometheus

INFO: Starting Prometheus Server

INFO: Adapter status - Powered: True

INFO: Starting discovery...

INFO: Devices found: 5

INFO: Found bt1 device SP10S009-L8S-100A-B-U  [A4:C1:37:10:00:D2]

INFO: Found bt1 device SP10S009-L8S-100A-B-U  [a4:c1:37:10:00:d2]

DEBUG: Found. So connecting...

DEBUG: _connect() run manager...

INFO: [a4:c1:37:10:00:d2] Discovered, alias = SP10S009-L8S-100A-B-U

INFO: [A4:C1:37:10:00:D2] Connected

INFO: [a4:c1:37:10:00:d2] Discovered, alias = SP10S009-L8S-100A-B-U

INFO: [A4:C1:37:10:00:D2] Resolved services

DEBUG: resolved services

DEBUG: request_data...

DEBUG: create_read_request 256 => [255, 3, 1, 0, 0, 34, 209, 241]

ERROR: Exception in handler for D-Bus signal:

Traceback (most recent call last):

  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 218, in maybe_handle_message

    self._handler(*args, **kwargs)

  File "/home/pi/.local/lib/python3.11/site-packages/gatt/gatt_linux.py", line 398, in properties_changed

    self.services_resolved()

  File "/home/pi/solar-bt-monitor/SolarDevice.py", line 63, in services_resolved

    self.resolved_callback()

  File "/home/pi/solar-bt-monitor/BTOneApp.py", line 95, in on_resolved

    self.request_data()

  File "/home/pi/solar-bt-monitor/BTOneApp.py", line 91, in request_data

    self.device.characteristic_write_value(request)

  File "/home/pi/solar-bt-monitor/SolarDevice.py", line 79, in characteristic_write_value

    self.write_characteristic.write_value(value)

    ^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: 'SolarDevice' object has no attribute 'write_characteristic'

INFO: [a4:c1:37:10:00:d2] Discovered, alias = SP10S009-L8S-100A-B-U



^CDEBUG: _connect() keyboard exception...

INFO: gracefully_exit

INFO: Exit: Disconnecting device: SP10S009-L8S-100A-B-U [A4:C1:37:10:00:D2]

pi@sionnach:~/solar-bt-monitor $ 

pi@sionnach:~/solar-bt-monitor $ 

pi@sionnach:~/solar-bt-monitor $ date

Mon 20 Jul 17:40:23 IST 2026

pi@sionnach:~/solar-bt-monitor $ # Got further may be worth debugging?

pi@sionnach:~/solar-bt-monitor $ 

pi@sionnach:~/solar-bt-monitor $ 

Or should I use a wired connection to each BMS ? Scary


What does Android app make of them ?


daly

jbd

xiaoxiang




Hurrah!!!!



(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ vim jbd_bms_bleak2.py 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ vim ./jbd_bms_bleak2.py 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ python3 ./jbd_bms_bleak2.py 

INFO:__main__:Found device: SP10S009-L8S-100A-B-U (A4:C1:37:10:00:D2)

INFO:__main__:Updating BMS data...

INFO:__main__:BMS data: {'voltage': 25.99,

        'current': 0.0,

        'cycle_charge': 0.14,

        'design_capacity': 100,

        'cycles': 584,

        'balancer': 0,

        'problem_code': 4096,

        'battery_level': 0,

        'chrg_mosfet': True,

        'dischrg_mosfet': False,

        'temp_sensors': 2,

        'temp_values': [TempSensor(22.6,

        <T.GENERIC: 0>),

        TempSensor(22.7,

        <T.GENERIC: 0>)],

        'cell_voltages': [3.249,

        3.25,

        3.247,

        3.249,

        3.248,

        3.248,

        3.248,

        3.253],

        'delta_voltage': 0.006,

        'cell_count': 8,

        'cycle_capacity': 3.639,

        'power': 0.0,

        'battery_charging': False,

        'temperature': 22.65,

        'problem': True}

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ date

Mon 20 Jul 2026 19:16:20 IST

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 


Now lets try that on a Raspberry Pi!

Pythoin version only 3.11 needs to be at least 3.12



(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ python3 ./jbd_S_bms_bleak.py 

INFO:__main__:Found device: SP10S009-L8S-100A-B-U (A4:C1:37:10:00:D2)

INFO:__main__:Updating BMS data...

INFO:__main__:BMS data: {'voltage': 25.99,

        'current': 0.0,

        'cycle_charge': 0.14,

        'design_capacity': 100,

        'cycles': 584,

        'balancer': 0,

        'problem_code': 4096,

        'battery_level': 0,

        'chrg_mosfet': True,

        'dischrg_mosfet': False,

        'temp_sensors': 2,

        'temp_values': [TempSensor(22.6,

        <T.GENERIC: 0>),

        TempSensor(22.7,

        <T.GENERIC: 0>)],

        'cell_voltages': [3.249,

        3.25,

        3.247,

        3.249,

        3.248,

        3.248,

        3.248,

        3.253],

        'delta_voltage': 0.006,

        'cell_count': 8,

        'cycle_capacity': 3.639,

        'power': 0.0,

        'battery_charging': False,

        'temperature': 22.65,

        'problem': True}

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ nano jbd_B_bms_bleak.py 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ vim jbd_B_bms_bleak.py 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ python3 ./jbd_B_bms_bleak.py 

ERROR:root:Device 'BR2262e-s' not found.

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ date

Mon 20 Jul 2026 19:27:29 IST



https://raspberrytips.com/install-latest-python-raspberry-pi/


Trying to build Python 3.12.g on sionnach to run aiobmsble!


pi@sionnach:~/Python-3.13.6 $ sudo make


..

e.o  Modules/_weakref.o  Modules/_abc.o  Modules/_functoolsmodule.o  Modules/_localemodule.o  Modules/_operator.o  Modules/_stat.o  Modules/symtablemodule.o  Modules/pwdmodule.o Modules/getpath.o Python/frozen.o -ldl                           -lm 

sed -e "s,/usr/bin/env python3,/usr/local/bin/python3.13," < ./Tools/scripts/idle3 > build/scripts-3.13/idle3.13

sed -e "s,/usr/bin/env python3,/usr/local/bin/python3.13," < ./Tools/scripts/pydoc3 > build/scripts-3.13/pydoc3.13

The following modules are *disabled* in configure script:

_sqlite3                                                                   


The necessary bits to build these optional modules were not found:

_bz2                      _ctypes                   _ctypes_test           

_curses                   _curses_panel             _dbm                   

_gdbm                     _lzma                     _tkinter               

_uuid                     readline                                         

To find the necessary bits, look in configure.ac and config.log.


Checked 112 modules (33 built-in, 66 shared, 1 n/a on linux-aarch64, 1 disabled, 11 missing, 0 failed on import)

pi@sionnach:~/Python-3.13.6 $ 



pi@sionnach:~/Python-3.13.6 $ sudo make install

..

Looking in links: /tmp/tmpawanvuou

Processing /tmp/tmpawanvuou/pip-25.2-py3-none-any.whl

Installing collected packages: pip

Successfully installed pip-25.2

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

pi@sionnach:~/Python-3.13.6 $ 


pi@sionnach:~/Python-3.13.6 $ 

pi@sionnach:~/Python-3.13.6 $ ls -al python

-rwxr-xr-x 1 root root 32817424 Jul 20 23:07 python

pi@sionnach:~/Python-3.13.6 $ date

Tue 21 Jul 10:06:15 IST 2026

pi@sionnach:~/Python-3.13.6 $ ./python

Fatal Python error: Failed to import encodings module

Python runtime state: core initialized

ModuleNotFoundError: No module named 'encodings'


Current thread 0x0000007f8e77d040 (most recent call first):

  <no Python frame>

pi@sionnach:~/Python-3.13.6 $ 

pi@sionnach:~/Python-3.13.6 $ 


So still cannot execute it!

















No comments:

Post a Comment