Well, it's been a minute. So this post details how to talk to three 24V LFP batteries over bluetooth.
The goal is to run a Python3 script as a system service on a Raspberry Pi to update via MQTT the battery voltages, currents and SoC % every few minutes.
The BMS run by each battery is below:
BLE MAC Name Type
'A4:C1:37:10:00:D2', 'SP10S009-L8S-100A-B-U', 'JK?'
'04:7F:0E:00:1A:7C', 'BR2262e-s', 'Xiaoxiang'
'40:18:04:01:23:34', 'DL-401804012334', 'Daly'
'A4:C1:37:10:00:D2', 'SP10S009-L8S-100A-B-U', 'JK?'
'04:7F:0E:00:1A:7C', 'BR2262e-s', 'Xiaoxiang'
'40:18:04:01:23:34', 'DL-401804012334', 'Daly'
Here's the pseudo code:
For each of the three batteries {
connect to battery (MAC_ADDDRESS, BMS_TYPE )
get_voltages()
get_current()
get_SoC()
connect to battery (MAC_ADDDRESS, BMS_TYPE )
get_voltages()
get_current()
get_SoC()
disconnect()
publish_to_MQTT()
}
publish_to_MQTT()
}
This will use object orientated Python3 code and timeouts if async calls need to be used in blocking function calls.
So, examining the https://github.com/KrystianD/smart_bms.git code which works with the "JK?" type BMS lets see how it get the job done...
The smart_bms/TransportBLE.py code makes a BLE connection to the battery using the Bleak library to provide a client.
No comments:
Post a Comment