ai-republic / bms-to-inverter

Use, monitor and control any battery brand with any inverter! Application to read and monitor data from BMSes and write data to an inverter using any protocol (e.g. UART, RS485, ModBus or CAN)
https://github.com/ai-republic/bms-to-inverter
Other
32 stars 6 forks source link

Growatt Hybrid high voltage / Pylontech BMS high voltage (powercube x1) / CAN #11

Open solsrvolt opened 5 months ago

solsrvolt commented 5 months ago

Hi, great work. Thx. A quick question, support your converter the Growatt SPH Hybrid (HV) series and the Pylontech HV BMS system (powercube X1) over CAN? Thanks for your response. Best regards Utz

ai-republic commented 5 months ago

Hi, yes, I'm sure I can support this. As far as I know, the Growatt inverters use the Pylontech CAN specification. But if you could get the CAN specifications from the manufacturers then I can tell for sure or - if it differs - implement the module in a couple of days.

solsrvolt commented 4 months ago

Hi, thanks for your quick reply. I attached the high voltage protocol and some other files for this setup (Growatt SPH Hybrid (HV) series and the Pylontech HV BMS system (powercube X1)) . It`s very hard to get the Growatt can bus protocol from the manufacturer. Maybe it will help you. Many thanks for your support. Best regads Utz pylon_CAN_210124.txt CAN-Bus-Protocol-Sermatec-high-voltage-V1.1810kW (1).pdf PYLONTECH.zip

ai-republic commented 4 months ago

Ok, I will have a look at it possibly this week. The file CAN-Bus-Protocol-Sermatec-high-voltage-V1.1810kW (1).pdf is the protocol for your Pylontech HV BMS, correct?

solsrvolt commented 4 months ago

Hi Torsten,

yes it is. I have attached a document regarding the growatt Can Bus. Best regards / Utz Growatt-Battery-BMS.docx

ai-republic commented 4 months ago

Thanks for the sponsoring! :)

I have implemented an initial version of the Pylontech HV BMS support. Could you test it to see if we get some proper readings?

The specs are a little unclear defining the response CAN ID. The official spec quotes:

Host device sending data with byte 0 set to 0
CAN ID:0x4200 (this is Broadcast Frame) 

Response:
CAN ID:0x4210+Addr (Addr. = 1~F) (Equipment Address: Addr.= 1~F, MAX 15 equipments can be parallel communicated.)
CAN ID:0x4220+Addr (Addr. = 1~F) (Equipment Address: Addr.= 1~F, MAX 15 equipments can be parallel communicated.)
...

So I would assume that the respone CAN ID would look something like 0x4211 .. 0x421F (=Battery packs 1-15).

But int the other document you provided it seems that the address starts with 0 (=Battery pack 1):

Host device sending data with byte 0 set to 0:
can1 00004200 [8] 00 00 00 00 00 00 00 00 

Response:
can1 00004210 [8] A5 09 30 75 9D 04 2E 64
can1 00004220 [8] 8C 0A E9 07 4A 79 4A 79
...

Well, we will see that in the logs when we get some readings from you BMS. If you need help with the setup of the application - just ask :)

solsrvolt commented 4 months ago

Hi Torsten,

thanks for your great support. I will testing in the next days. Replay comes.

Have nice (rest)weekend.

Best regards Utz

ai-republic commented 4 months ago

Ok. Be sure to connect CAN H and CAN L correctly of your Powercube X1 to the PI hat. This is what I found in the Operation Manual for the Powercube X1: image

So you need to cut a RJ45 network cable (min. CAT 5) and connect pin 4 (CANH) to CANH and pin 5 (CANL) to the CANL on your PI's CAN hat.

Let me know if you have any questions!

solsrvolt commented 4 months ago

Hi, thx. Currently I have a problem, I can only select the daly bms, no any other inverter bms and only "none" inverter brand. I installed the configurator on a pi 4 with JDK, do you have an idea what is the problem?

Thanks. best regrds Utz

solsrvolt commented 4 months ago

64-bit, newest PI firmware (bookworm)

solsrvolt commented 4 months ago

Hi, I solved the problem, but I can't select the bm pylontech hv protocol, only pylontech_can, see png attached 2024-02-11-182640_2560x1440_scrot

Thx. for your support. BG / Utz

ai-republic commented 4 months ago

Let me check.... Ok - I fixed it. The Configurator was missing the service descriptors for the BMSes and inverters. Please download the new current Configurator.

solsrvolt commented 4 months ago

merci, I will testing this week and come back with results. Bg / Utz

solsrvolt commented 4 months ago

Hi Tosrten,

I tested, see the result in the attached jpeg. Pls. can you help me? Thx. BG Utz error

ai-republic commented 4 months ago

Hi Utz, so far so good, but does it stop after the last log entry? Is your BMS connected to can1 or can0? Please configure the Dummy inverter for now, so we can test if we get any readings from the BMS. Also configure the log level to debug in the latest Configurator please. You can do this by simply choosing your installation folder in the Configurator app, change the settings and click Update configuration or Clean install (if you like to get the latest version with bugfixes). In the future please just attach the log file found in <installation directory>/logs folder. That's easier to read ;)

solsrvolt commented 4 months ago

Hi Torsten, I tested, pls. see the attached log. The converter display said "bms com failed". The pylon BMS show no errors on the leds. I think its not a great problem :-) Thx. for your support. BG / Utz BMS-to-Inverter.log

ai-republic commented 4 months ago

Hi Utz, good, looks like the BMS is responding properly to the request. But something is not right possibly with the configuration. Could you please attach your config.properties file from the config folder.

jenshermans commented 4 months ago

Hi, Subscibed to this. Having the same growatt HV inverter (SPH 5000TL3 BH-UP). I have the Pylontech Force H1 battery. But I'm guessing I also could use the pylontech_hv_can module. Attached my config and log file.

config.txt BMS-to-Inverter.log

solsrvolt commented 4 months ago

Hi Torsten, in the attachment you find my configuration properties. Thanks for analysing. BG Utz config.txt

ai-republic commented 4 months ago

Hi Utz & Jens, please update your installation (Clean install in the Configurator). I've fixed the problem with the exception so you should get some proper readings now. I've tested it on my PI giving it simulated data for the SOC, current and voltage readings. The best I can do since I don't have the components to test on :)

@jenshermans Please reduce your configuration to a minimum for now (see Utz's config) until we get decent data from the BMSes

jenshermans commented 4 months ago

Hi, Did a clean install, copied the config file from Utz and this is my log file; BMS-to-Inverter.log

solsrvolt commented 4 months ago

Hi Torsten, here is my clean configuration log file. Now I have some values from the hv pylontechs... , but still errors. The inverter does not recognise the bms. Thx. BG Utz BMS-to-Inverter.txt config.txt

ai-republic commented 4 months ago

Hi Utz & Jens, ok, that's great. We're getting proper readings from the BMS now. I can go forward implementing the rest of the HV protocol and will hopefully finish that today. Could you please try to configure the SolArk inverter (which also uses the Pylontech CAN communcation) and set your Inverter's communication protocol to Pylontech. I've googled and read that you need to choose 5 in the menu and then select L2. But consult your manual for the correct setting.

@jenshermans please configure the log level to debug for now

jenshermans commented 4 months ago

Hi Torsten, I'v added my current log on debug level, Doubting it's an other Pylontech HV protocol... For the growatt inverter; I can't set any protocols on my SPH, even on installer level. BMS-to-Inverter.log

ai-republic commented 4 months ago

Hi, thanks for the log. Could you check which protocols or batteries your inverter supports (maybe in the manual or website)? Maybe you could also ask Growatt to send you a list of supported batteries or even better their CAN protocol ;) What I've found was that that they support(ed?) the Pylontech protocol, so the SolArk should work: image

Have you connected the right pins from CAN hat to inverter to your can1 port? image

Please update (Clean install) the application. I did manage to find some time to get more readings from the inverter and also fix the exception in the SolArk processor.

solsrvolt commented 4 months ago

Hi Torsten,

that's tricky, Growatt supported the Pylontech Powercube X1 when the SPH bh-up inverter series was launched. Growatt has not officially supported the memory for some time now. But it still works. A friend is running this setup with the Pylontech CAN protocol 1.18 (see above). I think I read somewhere that Growatt uses the CAN bus protocol 1.01 (that's not open) for the high-voltage series. I have the firmware of the inverter as a zip file. I can attache if you need it. I'll check the SolArk settings again today. BG / Utz

solsrvolt commented 4 months ago

Hi, I tested three ways: Growatt-Pylon, SolArk-HVPylon, SolArk-Pylon. Logs attached. Bg / Utz BMS-to-Inverter-Growatt-Pylon.log BMS-to-Inverter-SolArk-HVPylon.log BMS-to-Inverter-SolArk-Pylon.log

jenshermans commented 4 months ago

Hi,

I'm receiving packages from my growatt inverter, uploaded my candump. maybe this could help you a little forward. Alsof tried the (new) configuration with pylonHV-Growatt and PylonHV-SolArk, logfiles are also added as attachment. Also found this similar project documents regarding the Growatt inverter. (jk-bms); https://drive.google.com/drive/folders/1YP-UwRgFRqus0CKmYnccU79ZlMlZN57e

candump.log PylonHV_Growatt.log PylonHV_Solark.log

Edit; After sending "cansend can0 00004200#0000000000000000" to my Pylon i get the following respond. candump can0.log

ai-republic commented 4 months ago

Hi, thanks for all your input! I've made a few adjustments, so it should also be no problem for @jenshermans since it looks like you have more than one BMS. Also I fixed the sending of data to the inverter. Thanks to the CAN dumps I could see that the inverter is using the Pylon HV CAN specification and not the Pylon LV CAN specification (SolArk, etc.). That means I need to implement a new inverter binding (PYLON_HV_CAN) which I am working on now. I've done an initial version sending basic data to the inverter.

Please update (Clean install) and choose the _PYLON_HVCAN as inverter.

sanitariu commented 4 months ago

Here is a link with the protocol information for low an high voltage https://www.amosplanet.org/how-to-commission-the-communication-between-lithium-ion-battery-and-spf-3500-5000es/

https://www.amosplanet.org/wp-content/uploads/2022/04/Growatt_BMS_RS485_protocal_1xSxxP_ESS_V2.02-1.pdf

https://www.amosplanet.org/wp-content/uploads/2022/04/Growatt-BMS-CAN-Bus-protocol-low-voltage-V1.04-1.pdf

ai-republic commented 4 months ago

Hi I fixed the missing dependency for the Pylontech HV inverter now. Please pulll the latest Configurator and do a clean install.

jenshermans commented 4 months ago

Hey Torsten, Downloaded the new files, and the configurator wont open anymore. Last working commit is 'bcbf2ac'.

configurator.log

ai-republic commented 4 months ago

Sorry, my bad! Shouldn't do this stuff at 11pm ;)

Fixed the service descriptors - now its working. Please get the new Configurator and do a Clean install.

jenshermans commented 4 months ago

Added the current log. I hear the BMS relay clicking, and the status led turned blue, so he goes out of error mode. On the inverter i now get 'batt voltage high'.

my config is: -bms: pylon_hv_can -inverter: pylon_hv_can BMS-to-Inverter.log

added candumps candump can0.log candump can1.log

ai-republic commented 4 months ago

Hi Jens & Utz, I just committed a full implementation of the Pylontech HV inverter module (also corrected some value units). Could you please test? Thanks!

solsrvolt commented 4 months ago

Hi Torsten, I will testing tomorrow. Currently I am two Day outside from my home. Thanx for your great work and support. BG Utz

ai-republic commented 4 months ago

No problem, just fixed another bug anyway (probably not the last) ;)

jenshermans commented 4 months ago

BMS reading looks right. Inverter now shows 'bat voltage high' at first,'bms com fault' afterwards.

BMS-to-Inverter.log candump bms.log candump inverter.log

ai-republic commented 4 months ago

Hi Jens, I fixed some wrong units. Hopefully that will solve the 'bat voltage high'. Can you please test the latest version?

jenshermans commented 4 months ago

Current logs attached, Inverter still shows bat voltage high, bms com fault BMS-to-Inverter.log

ai-republic commented 4 months ago

Hi Jens, I'm a little bit confused about your battery configuration. When I send a broadcast to all battery modules I only receive answers from Battery No. 2 (e.g. 0x4211) but not from Battery No. 1 (e.g. 0x4210). Last digit identifies the battery module.

On Utz's battery I get the correct Battery No. 1 (e.g. 0x4210) when doing the broadcast. Could it be that you need to change the DIP switch on your BMS or Battery module to correct the identifer?

When the inverter starts a broadcast to request the BMS data, I now send data from all BMS.

So I updated some code for more info. Maybe you can update and run it again?

solsrvolt commented 4 months ago

Hi Torsten, I tested, the inverter display dispatch BMS Abnormal, BMS Com fault. Can you provide me with the version that worked for Jens until the inverter/bms stopped using bms com fault, bat voltage high? The Powercube BMS schows a red error light. Thx. BG/Utz BMS-to-Inverter.log

jenshermans commented 4 months ago

Hi Torsten, It's not possible to change my BMS address, this addresses itself. Its only possible to change bitrate and some "special protocols" For this current version; Battery is okay and the inverter is showing the first 5 seconds "normal", after that it shows 'BMS com fault' and 'Normal' varying. But i noticed; the first 5 seconds, (while normal) the SOC is displaying like it should be, after that it disappears.

Did a candump on can0 and can1 (starting from timestamp 2024-02-23 17:36:07.064 in the bms-to-inverter log)

BMS-to-Inverter.log candump can0 bms.log candump can1 inv.log

ai-republic commented 4 months ago

Hi Utz, can you please update to the latest version. You seem to not get any responses from your BMS. Please also check that your CAN device is properly connected and that the BMS is not idle.

ai-republic commented 4 months ago

Hi Jens, from the candump can1 (inverter) I can see that everything gets sent to the inverter initially. Then 5 seconds between the sending of the invalid data of 0x4210 and then the valid data 0x4211, etc.

I have fixed that temporarily ignoring the battery for which I don't get data (0x4210 in your case). That should hopefully fix the problem that the inverter switches from normal to error mode.

But I've added a ToDo to manually configure the BMS id for the future.

jenshermans commented 4 months ago

Hi Torsten,

I'm still getting the bms com error on the inverter, in the logs you also will see 'error communicating to inverter'. BMS-to-Inverter.log

ai-republic commented 4 months ago

Hi Jens, I fixed the exception when sending of the manufacturer.

jenshermans commented 4 months ago

Still receiving the 'normal/bms com error' status added a candump of the inverter to attachments. BMS-to-Inverter.log candump-inv.log

ai-republic commented 4 months ago

hmm, can you access the inverter's log. Maybe there a more detailed error message

jenshermans commented 4 months ago

Hope I can help you with this? (via oss.growatt.com) Schermafbeelding 2024-02-24 082850

ai-republic commented 4 months ago

Ok, can you tell me your inverter settings for the maximum voltage limit?