syssi / esphome-pace-bms

ESPHome component to monitor and control a PACE Battery Management System (PACE-BMS) via RS485 (Modbus)
Apache License 2.0
23 stars 6 forks source link

Help for P16S100A, looks like PACE #19

Closed Maikeleg closed 1 month ago

Maikeleg commented 7 months ago

Hello, I have read the topic/issue "Add PACE BMS support #1" and tried with the default "esp32-example.yaml" but can't get communication to work. My MQTT is working as i can see in the MQTT explorer. I got my battery in error with all experiments (luckily solved now) so I'm a bit more carefull now. When i readout the pack with pbmstools i can only make connection with the version "Gobel_PC-BMS_Tools_HS2.0.3_Win32", i use rs485 on the parralel port. dip switch is set to 0, the dedicated rs485 next to can isnt working, other dipswitch settings are not working However I see that address 0x01 is setup in the yaml. Do I need to change the pack dipswitch or change the yaml? Also I use and only have the "esp32doit-devkit-v1" which i setup in yaml as:

esp32:
  board: esp32doit-devkit-v1
  framework:
    type: esp-idf

is this correct? I see in the topic "Add PCA BMS support" only 8266 mentioned and a different board. Also in your documentation you say to use orange/orange-white for B/A, however with pbmstools i can only communicate with brown/brown-white as B/A I'm using a Joyvoit Suns Energy battery pack BW5KW: https://www.alibaba.com/product-detail/Energy-Power-wall-5-3-2kw_1600330104517.html Using the pbmstools i get the VER readout: P16S100A-21468-1.00 Searching on google I think this is a PACE BMS, it also look like one, I can confirm it has 100A and 16 cells Also I'm using the following RS485 3.3-5V module: https://a.aliexpress.com/_mt820MY

Is changing the address setting enough to make this work, and if so do I have to change the dipswitch on the pack or the setting in the yaml? Sorry for all questions, I'm not experienced with ESP but would really like this to work Greetings Maikel

syssi commented 7 months ago
  1. Could you provide a photo of your RS485 converter Module?
  2. Which GPIOs do you use as UART pins? Does the TX LED of the RS485 board blink periodically?
  3. You could use the ESP+RS485 converter to capture some traffic between the BMS and the workstation. I would like to make sure the correct protocol (Modbus frames) is used here.
  4. Yes. Have have to align the device address on both sides. If the BMS uses 0x00 you have to use the same address in the YAML.
  5. You can ignore the esp32.board setting if you assign GPIOs at the YAML using GPIOxx. If you want to use the labels on the PCB like D1, D2, D2,... the setting is important.
  6. Is there a drop-down menu available in pbmstools to choose between different protocols?
Maikeleg commented 7 months ago

Thanks a lot for your reply, i'll gather all information and come back to you as soon as possible

Maikeleg commented 7 months ago
  1. Could you provide a photo of your RS485 converter Module?

    1. Which GPIOs do you use as UART pins? Does the TX LED of the RS485 board blink periodically?

    2. You could use the ESP+RS485 converter to capture some traffic between the BMS and the workstation. I would like to make sure the correct protocol (Modbus frames) is used here.

    3. Yes. Have have to align the device address on both sides. If the BMS uses 0x00 you have to use the same address in the YAML.

    4. You can ignore the esp32.board setting if you assign GPIOs at the YAML using GPIOxx. If you want to use the labels on the PCB like D1, D2, D2,... the setting is important.

    5. Is there a drop-down menu available in pbmstools to choose between different protocols? 1) This board; signal-2023-11-28-141542_002 signal-2023-11-28-141542_003 signal-2023-11-28-141556_002 2) GPIO 16+17 which should be UART 2 RX and UART 2 TX which i connected to RX-RX and TX-TX to the converter board 3) Could you tell me how to do that, connect the esp32 to usb-PC with converter board connected? 4) I will try to change the yaml address and upload to the esp32 again later today 5) Aah ok thanks 6) no there is not, it chooses that itself as it seems. Right under ADDR (Address) is shows Protocol: None, HS-PC-232-BP-V1.1 (it is connected through RS485)

I'll check address and give you an update later today

ThHanika commented 7 months ago

The Modbus seems to need a configurated address to work, I use AddressNo. 1. (switch 1 set ON) This example does the job. ( My impediments was wrong PIN-Selections on ESP-Board ;-P )

Maikeleg commented 7 months ago

The Modbus seems to need a configurated address to work, I use AddressNo. 1. (switch 1 set ON) This example does the job. ( My impediments was wrong PIN-Selections on ESP-Board ;-P )

Ok thanks for your reply, I will set both to address 1. No time this evening but will try tomorrow morning

Maikeleg commented 7 months ago

Ok lots of stuff came up but I did some stuff this morning: Set the battery pack to address 1 I cannot write a new config to the battery now so that's a thing but I'm getting lots of hex code reading in the MQTT explorer. In debug it's saying it doesn't get a reply from 0x00 so I think I have to double check the esp code. Will do that tmr Then I also get my tx and rx lights flashing on the converter board so some assumptions: Converter board ok Communication to battery seems to indeed be on 0x01 Change code in esp code from 0x00 to 0x01 might be the solution

Question in advance: anyone knows how I can get pbmstools to communicate on address 0x01?

ThHanika commented 7 months ago

I use pbmstools with interface RS232. RS485 is the monitoring interface for me. With homeassistant and esphome, i can also change the parameter (but not all)

syssi commented 7 months ago

This sounds like good progress. You have to change the address at the YAML to 0x01 too. Otherwise the responses doesn't get picked up and decoded.

ThHanika commented 7 months ago

FYI! The modbus-address 0x00 is a broadcast address and is not a valid slave-address

Maikeleg commented 7 months ago

I can't see to make it work. I checked the yaml in my home/esphome-pace-bms folder and it already had 0x01 defined I keep getting CRC errors, I think that means i have the wrong wires/pairs? In my battery-manual the are defining RS485 as follow: 1,8 orange-white,brown B1 2,7 orange,brown-white A1 3,6 blue-white GND tried all combinations including without GND tried different power supplies this is a snippet of the communication;

[D][uart_debug:114]: <<< 93:56:06:26:46:66:96:06:06:06:06:06:66:23:0B:A3:D6:FF:FF:FF:FF:FF:FF:FB:FF:FB:FF:FF:FF:FB:7E:32:35:30:33:34:36:39:30:30:30:30:30:46:44:41:33:0D
[D][uart_debug:114]: >>> 01:03:00:00:00:08:44:0C
[W][modbus:108]: Modbus CRC Check failed! 8101!=FFFF
[D][uart_debug:114]: <<< FB:FF:FF:FF:FF:FB:FB:FF
[D][uart_debug:114]: >>> 01:03:00:00:00:08:44:0C
[D][uart_debug:114]: <<< 7E:32:35:30:34:34:36:39:30:30:30:30:30:46:44:41:32:0D:FB:FB:FF:FF:FF
[D][uart_debug:114]: <<< 7E:32:35:30:35:34:36:39:30:30:30:30:30:46:44:41:31:0D:FF:FF:FF:FF:FF:FB:FF:FB
[D][uart_debug:114]: >>> 01:03:00:00:00:08:44:0C
[D][uart_debug:114]: <<< 7E:32:35:30:36:34:36:39:30:30:30:30:30:46:44:41:30:0D:FF
[D][uart_debug:114]: >>> 01:03:00:00:00:08:44:0C
[W][modbus:108]: Modbus CRC Check failed! 4200!=FFFF
[D][modbus_controller:043]: Modbus command to device=1 register=0x00 countdown=0 no response received - removed from send queue

I see rx and tx blinking on the conversion board irregularly so there seems to be communication that also stops when plugin in the single rs485 port rx is connected to rx and tx to tx between conversion-board and esp-board, correct? I don't know how to proceed now

Maikeleg commented 7 months ago

This sounds like good progress. You have to change the address at the YAML to 0x01 too. Otherwise the responses doesn't get picked up and decoded.

I also dont see any value in all the mqtt topics so I'm afraid its not being decoded I also look at the topic in grafana via the mqtt plugin and see all information but again no value

Maikeleg commented 7 months ago

FYI! The modbus-address 0x00 is a broadcast address and is not a valid slave-address

Do you mean by Slave address the battery pack address?? I only have one battery pack

syssi commented 7 months ago

The responses aren't valid Modbus frames. It looks like Seplos/Pylon responses. This reason could be one of the following options

  1. You've selected the wrong protocol at the RS485 protocol drop-down
  2. You are using the wrong port
  3. The BMS firmware doesn't support Modbus communication
syssi commented 7 months ago

This issue (#17) is about to the same problem.

Maikeleg commented 7 months ago

The responses aren't valid Modbus frames. It looks like Seplos/Pylon responses. This reason could be one of the following options

1. You've selected the wrong protocol at the RS485 protocol drop-down

2. You are using the wrong port

3. The BMS firmware doesn't support Modbus communication

Thanks for your quick reply

  1. I cannot change the protocol settings (in pbmstools i think you mean?)
  2. I tried all rs485 ports
  3. I will ask the battery manufacturer if that's the case

Do you know by any chance if the seplos/pylon method also needs to be on pack 1? I tried that but only with dip 0 Changing both pack dip and yaml setting to 0x00 not going to work anyway or worth a try?

I'll check issue 17 now! Thanks a lot

Maikeleg commented 7 months ago

This issue (#17) is about to the same problem.

Ok thanks again, I will try that tomorrow morning and let you know

Maikeleg commented 7 months ago

I use pbmstools with interface RS232. RS485 is the monitoring interface for me. With homeassistant and esphome, i can also change the parameter (but not all)

I'm a bit in doubt what to do next. With whatever version of pbmstools I tried yesterday I cannot change the inverter setting. Most versions only work with pack 1-xx. I tested mostly on dip 0x01 yesterday but also 0x00 The one that works for me (only 0x00) is the Gobel 2.03HS. Can write parameters, readout current stats but cannot change inverter protocol. Seems that's only possible with a rs232?? Thing is that connector isn't on any of my pcs so have to buy another adapter for that. No problem but will cost quite some time I have 8 different pbmstools to give you an idea and I'm running out of ideas to be honest Thanks for your and the developpers @syssi help so far!! Much appreciated

syssi commented 7 months ago

Could you provide a screenshot of the pbmstools protocols section? Did you try to contact the seller / manufacturer?

ThHanika commented 7 months ago

... and you now the special secret password (123456) for changing settings?

Maikeleg commented 7 months ago

Could you provide a screenshot of the pbmstools protocols section? Did you try to contact the seller / manufacturer?

I'll make tomorrow Planning to contact the factory in Monday. Let you know tmr

Maikeleg commented 7 months ago

... and you now the special secret password (123456) for changing settings?

Yups have that. Is a specific password for other settings and one for inverter protocol

ThHanika commented 7 months ago

Look at andy's video canal: offgrid-garage https://www.youtube.com/watch?v=A8nXija8wlc https://www.youtube.com/watch?v=TbUUCXPN1Xg

Maikeleg commented 7 months ago

Could you provide a screenshot of the pbmstools protocols section? Did you try to contact the seller / manufacturer?

signal-2023-12-05-120334_002 signal-2023-12-05-120334_007 signal-2023-12-05-120334_006 signal-2023-12-05-120334_005 signal-2023-12-05-120334_004 signal-2023-12-05-120334_003 If i change the xml file i also have an option with modbus protocol, i changed it back recently as one og the things to try So as you can see i can readout all info except read or write inverter protocol In the video that @ThHanika Thomas posted (thanks a lot for that) i understand i need an rs232 cable

I sent a message to the company i bought the battery from, didn't got an answer yet, will ask them again

ThHanika commented 7 months ago

On the last picture, you have to click \<Read> under Inverter protocol to show selected protocols

BTW: First you have generaly click \<Read> before you can write any parameters, Pace expect complete filled parameterfield to update its parameter.

Maikeleg commented 7 months ago

On the last picture, you have to click under Inverter protocol to show selected protocols

BTW: First you have generaly click before you can write any parameters, Pace expect complete filled parameterfield to update its parameter.

Hi Thomas, I just talked to the lady in china who supports the battery, she says i need another firmware version and (ofcourse) discouraged me to change the setting. I'm waiting for her to email me. Keep you updated

When pushing read it gives an error, when filling in all field or some fields it gives the same error. Tried all different options. Error is: "Command error"

Maikeleg commented 7 months ago

@syssi Sebastian, I saw your mention "It looks like some BMS firmware versions doesn't support Modbus. In best case there will be a different firmware version." I just got a version from my battery manufacturer with the following inverter protocols; inverter_protocols_P16S100A_pbmstoolsHS106 Pace-modbus is mentioned as first choice! This received bmstoolsHS106 doesn't once again work with RS485. I stopped talking with the manufacturer, they keep repeating the same thing and don't understand you can readout info with something else than pbmstools. The next battery will definitely NOT be from them Watching the videos @ThHanika Thomas mentioned, and also keep seeing 232 in the protocol mentioned when connecting with pbmstools, I'm afraid I need to construct a rs232 to USB cable. I also last year got the document to build an rs232 cable with title "instrunction for software - short version.pdf" instruction for software - short version.pdf The question is now which cable i should order from DB9 serial connector to usb, does anyone did this before?

Maikeleg commented 7 months ago

Just ordered these two cables, one with chipset according to a diysolar topic and one for SOK battery usb-rs232-rj11

Maikeleg commented 7 months ago

Ordered this combination tooimage Arrival date for all three 21 dec so have to be patient PS: you gotta love the Chinese translation haha 'Set meal'

Maikeleg commented 5 months ago

I got all cable the day before going on holiday and all three of them didnt work out of the box Since then I was out of country and busy getting back with things, I'll plan to continue this project probably monday morning and will report back Supposedly i need a special driver for the direct connected cables so i have some things to try still

Maikeleg commented 4 months ago

I got it working with the following cable: SOK SK48V100 Battery RS232 serial communicatrion Prolific USB RS232 to RJ11 6P6C I needed to update the serial driver for the prolific chipset PL2303GT on windows Then set protocol to PACE_MODBUS in special version of Pbmstools that i got from factory After that i kept using this cable to readout the battery Thanks for all help @syssi and @ThHanika

theyo-tester commented 1 week ago

@Maikeleg

May I know which PBMSTool Version you used? Is it online somewhere available? My versions does not allow me to change the protocols....

Thanks!