New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add EG4 Lifepower driver #212
Conversation
Many batteries use the same BMS internally. The Revov is using a Tian Power BMS (so it should actually be renamed) |
I seem to get valid looking responses from the Revov driver, but they fail to parse because of different response lengths. It looks to me like revov.py doesn't account for different cell counts that would cause different offsets for all subsequent data. |
Assuming the Revov and Lifepower drivers both work with Tian Power BMS, then one of the implementations is redundant. It would be nice if this Lifepower driver also works on Revov batteries, but I only have a Lifepower battery though so I'm unable to verify that. I registered the Lifepower driver over the Revov driver because it can accommodate different cell counts and has more fields filled out. It might break support for Revov batteries, though. Any modifications to unify the drivers are welcome. |
The Revov driver was not fully working yet, so it is very possible that you might have fixed a few things there. I was planning to rename it to Tian Power. |
To provide a more complete documentation of the protocol, I'm adding the content of this link below : https://powerforum.co.za/topic/13120-narada-npfc-tian-power-bms-protocol/ Preamble Firstly, all data sent appears to have a header, body and CRC check. For example:
The first byte is either 7c or 7e according to the software. In my case it is always 7e. The second byte is the DIP switch setting on the battery and corresponds to the following in the software: The third byte is the function code, which you will see several examples of below, such as "read data", "read BMS time", "read BMS version", "read serial number". The fourth byte is the length of the payload supplied as part of the function call - most "read" type functions will not include a payload and this parameter will be 00, but the "write" functions would have a payload. If there is a payload, it would follow this byte. The last two bytes are the CRC check. The response is structured in a similar way:
The first three bytes are an echo of what the request was, the fourth byte indicates the response length followed by the response bytes, and finally we have the CRC check. Function 1 - Read data
This allows you to read almost everything that is displayed on the first tab of the BMS software. The response will look as follows:
The response body for this function is a data map structured as follows: data entry index, number of high/low byte pairs, the high/low byte pairs. Data 1 - Cell count and cell voltages
The second byte is the number of cells - this is 15 for a 15 cell battery like mine or 16 cells for Revov. The individual cell voltages follow as high/low pairs which need to be divided by 1000, for example, 0ce1 maps to 3297 which means 3.297V. Since my battery has 15 cells, there would be 15 individual cell voltages. Data 2 - Current
This is a tricky one. 7530 hex maps to 30000 decimal. The BMS software works it out as: current_in_amps = (30000 - value_of_item_2) / 100 Data 3 - Remaining capacity
This value needs to be divided by 100 to get Ah. In this case I have 1674 hex or 5748 decimal, so 57.48Ah left of my 100Ah battery, therefore the SOC is 57.48%. Data 4 - Full capacity
Divide by 100 to get full battery capacity in Ah. 2710 in hex is 10000 in decimal, so I have a 100Ah battery. Data 5 - Temperatures
In the Revovs the number of temperatures listed are different. The last two appear to be important ones. Each temperature value is calculated as: temp_value = (bms_temp_value & 0xFF) - 50
Data 7 - Cycles
Data 8 - Voltage
Data 9 - State of Health
Data 10 - ALM bytes
Function 67 - Read protection parameters Request:
This is another data map which ultimately gets translated into the following, with the necessary scaling factors applied:
Function 51 - Read BMS version The request is as follows:
Function 66 - Read PCB barcode Request:
Function 220 - Read serial number Request:
Function 69 - Read BMS time Request:
There are many "write"-type functions too but I would be wary of using those. I hope the above is useful to someone. I will post more useful ones if I find any. Edited September 13 by SolarConvert |
Am I correct in reading that the most recent commit is still hard coding battery addresses? Would it be possible to set a mode or work around that concatenates all the modules in series if there are multiple battery addresses available on the rs485 bus? Creating a data structure that listens to multiple batteries, then packing the returned data into that concatenated structure, then returning that as "one giant battery" back over dbus might be a way to do that. |
@aaronsb yes, right now the battery ID is hardcoded to 1 so there is no support for multiple batteries. While an interesting suggestion, your concept of a giant battery would work for reporting individual cell state, but wouldn't work for other attributes like temperature, SOC, etc. that needs to be one value per battery. |
@pchiquit I sort of started this as a conversation continuation. (I'm also happy if this needs to move to another thread if needed) Very shortly I will be getting my hands on 4 SOK 48 volt battery banks which I have a hunch use the same BMS controller, and will be paralleled together into one large bank. Just trying to get started on thinking about how to make multi-pack work appropriately. |
There are 2 seperate requests. Both of these are not spesific to a BMS but would be for all BMS that can handle this #8 is for handeling multiple battery banks and combining the data as one large battery. Each BMS will still need to have it's own serial port connection on the GX device. This is currently being worked on. #142 is to be able to address different banks on the same RS485 device using different address for each. This will only be able to work on some BMS where their protocol has the ability for address built in. |
I have tian power bms i cant connect with voltronic inverter . |
I need update my bms to connect with voltronic inverter |
1 similar comment
I need update my bms to connect with voltronic inverter |
This driver will work with the Victron inverter, but not with an Voltronic. The voltronic does not have a microcontroller that we can load the driver on too. |
Thank you |
Fixes #137
Marking as draft pending more complete testing.
I've tested this locally on my laptop with a EG4-LiFePower4 | 24V 200AH, but not on an actual Venus OS installation or any other EG4 batteries.I have not yet figure out the alarm code formatting.