Open elmozwo opened 1 year ago
Hi Stuart, I have a simple implementation of Pylontech protocol over RS485 integrated into diyBMS code and running with the PIP5048 / Voltronic VM III inverter.
The integration into diyBMS isn't perfect, I didn't know how to make it work together with existing RX/TX queues in main.cpp, so I commented those lines (I'm not using RS485 current shunt) and it's calling uart_read_bytes / uart_write_bytes directly.
What's implemented:
What's not:
Let me know what you need, I can share the code.
If you can do a GitHub pull request {PR) I can take a look
Ok, will do.
@elmozwo do you have anyway to test the changes @ruza87 has made?
I don't have the necessary inverters/equipment to test the RS485 protocol.
Yes, I have. If I get some time next days I can try. How can I get this build?
@ruza87 can you help with some build instructions?
@elmozwo Are you familiar with compiling of the sources in Visual Studio Code using PlatformIO addon? Clone the sources from https://github.com/ruza87/diyBMSv4ESP32/tree/pylon_rs485 and the next steps to build & flash are the same as in the original Stuart's repo.
Or you might try to use already compiled code from my (first, highly experimental:-) release. You can download it here https://github.com/ruza87/diyBMSv4ESP32/releases/download/v1.0.0/release_2023-04-14-09-07.zip and follow the original instructions to flash it: https://github.com/stuartpittaway/diyBMSv4ESP32/blob/master/ProgrammingHardware.md
How is it going? Also interested in this area...
For people who want to test this (@Jestergnet and @elmozwo ) GITHUB actions have pre-compiled the release.
https://github.com/stuartpittaway/diyBMSv4ESP32/actions/runs/4740188233?pr=195
Look at the bottom of that page for "[DIYBMS-Compiled]"(https://github.com/stuartpittaway/diyBMSv4ESP32/suites/12332390974/artifacts/654416283)
And use this file for the controller.
Has anyone already tested the code? After the RS485 firmware, I don’t show any signs at all. Diybms acting as a host? Who is contacting whom? Inverter to BMS or BMS to inverter? After flashing the screen is terribly slow ...
@Jestergnet I did. Mine is working with PIP 5048 (same as Voltronic VM III), the battery icon on the inverter is flashing, which means the communication is running OK. The inverter is a host, asking BMS for a reply.
Did you select PylonTech RS485 emulation on the diyBMS "Charge/Discharge configuration" page? Also, is your RS485 speed set correctly? For this inverter it needs to be set to 9600 baud, you can do it on "Current &Voltage Monitoring" page.
Regarding the screen issue - I don't have the screen attached so I cannot tell.
@Jestergnet I did. Mine is working with PIP 5048 (same as Voltronic VM III), the battery icon on the inverter is flashing, which means the communication is running OK. The inverter is a host, asking BMS for a reply.
Did you select PylonTech RS485 emulation on the diyBMS "Charge/Discharge configuration" page? Also, is your RS485 speed set correctly? For this inverter it needs to be set to 9600 baud, you can do it on "Current &Voltage Monitoring" page.
Regarding the screen issue - I don't have the screen attached so I cannot tell.
Ok, I'll try.
Finaly I also get some time to test. It looks good! The only thing is that it produces many warning popups about discharging/ charging is prevented. Even check or uncheck the boxes will not change anything.
Do you have an external temp sensor connected to the BMS, so it can measure battery temperature? Without any external temp sensor the charging/discharging is blocked.
I just have the two sensors from the batterie modules. Do I need a additional one?
Two sensors are fine. Can you check all the rules to see if any of them is preventing the charging? Is the communication between your inverter and diyBMS working? What inverter model do you have?
Found a problem, after activating PylonTech RS485, the screen loses its refresh rate. If you disable this option, the screen returns to the normal refresh rate of the image. In order for one page to load, it probably takes 20 seconds, or even more ...
Logs:
I (458680) diybms-webreq: API call: monitor2 I (458756) diybms-webreq: API call: chargeconfig I (460865) diybms: Task 1 W (461052) diybms-rules: Cell V>Max I (461053) diybms-rules: Set warning 9 I (461053) diybms-rules: Set warning 7 I (461053) diybms-rules: Set warning 8 I (462270) diybms-webreq: API call: monitor2 I (463361) diybms-webpost: API post: savechargeconfig W (463363) diybms-webfuncs: Missing key named 'stopchargebalance' W (463363) diybms-webfuncs: Missing key named 'socoverride' W (463366) diybms-webfuncs: Missing key named 'socforcelow' W (463372) diybms-webfuncs: Missing key named 'preventcharging' W (463377) diybms-webfuncs: Missing key named 'preventdischarge'
Hi @stuartpittaway, do you have any idea what could cause the issue described by @Jestergnet ? Could it be the modified loop in rs485_rx task
consuming more CPU time? (code here: https://github.com/ruza87/diyBMSv4ESP32/blob/pylon_rs485/ESPController/src/main.cpp#L2772) I don't have the LCD to replicate the issue.
From a quick review of the code @ruza87 I think you are in a near-infinite loop waiting for serial data to arrive.
The original code uses this ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
as a delay (part of the RTOS) until the transmit function triggers (notifies) it.
Oh, I see it now, thanks @stuartpittaway. I call uart_read_bytes
when the RX buffer contains at least pylon protocol header. This is tested in uart_get_buffered_data_len
. But, if the buffer is empty (or contains less data) the task is not suspended which leads to quick looping... I'll add vTaskDelay
to pause the task in that case.
Oh, I see it now, thanks @stuartpittaway. I call
uart_read_bytes
when the RX buffer contains at least pylon protocol header. This is tested inuart_get_buffered_data_len
. But, if the buffer is empty (or contains less data) the task is not suspended which leads to quick looping... I'll addvTaskDelay
to pause the task in that case.
Let me know when you make a fix, I'll check.
I fixed it in my repository. You can download the new release from here (https://github.com/ruza87/diyBMSv4ESP32/releases/tag/v1.0.1) or preferably wait for @stuartpittaway to approve GITHUB actions to create automated release.
I fixed it in my repository. You can download the new release from here (https://github.com/ruza87/diyBMSv4ESP32/releases/tag/v1.0.1) or preferably wait for @stuartpittaway to approve GITHUB actions to create automated release.
Hi, thanks for the fix. Checked, now the screen does not slow down.
Possibility to connect a Pylontech batterie via RS485 for inverters or Logger wich don't have a Can bus interface e.g. FSP Hybrid Power Manager and Plexlog.
Protokoll description: URL
If there are more informations required, just ask me. Possibly I can find them.