Skip to content
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

Testing #2

Closed
faizan-elite opened this issue Jun 8, 2022 · 36 comments
Closed

Testing #2

faizan-elite opened this issue Jun 8, 2022 · 36 comments

Comments

@faizan-elite
Copy link

Hi Syssi,
Great work on the project thus far. I tested your code on the Seplos BMS (15s) model 1101-ZH26 running Version 2.02. Connected to the WeMos via RS485.

I have attached my logs to help you advance your project. Look forward to upcoming changes and decoding on ESP8266 (if possible).

If you would like some assistance in testing and advancing this project further you may reach out.
logs_wemos-mini_upload.txt

@syssi
Copy link
Owner

syssi commented Jun 8, 2022

Thanks for your support! I will ping you next week for some testing!

@faizan-elite
Copy link
Author

Sure. FYI my BMS has the following ports:
RS 232 (2400 Baud)
2 x RS 485 (9600 Baud)

So far i have been able to decode the responses from the telemetry and communication commands via NodeRed. (Still working on decoding some of those 20bit warning responses).

@syssi
Copy link
Owner

syssi commented Jun 18, 2022

I've pushed a first draft of the external component: https://github.com/syssi/esphome-seplos-bms/blob/main/esp8266-example.yaml

The component requests the telemetry frame periodically and decodes the contents to the log (for now):

[18:53:57][I][seplos_bms:024]: Telemetry frame received
[18:53:57][D][seplos_bms:041]: Number of cells: 16
[18:53:57][D][seplos_bms:047]: Cell voltage 1: 3.287 V
[18:53:57][D][seplos_bms:047]: Cell voltage 2: 3.304 V
[18:53:57][D][seplos_bms:047]: Cell voltage 3: 3.316 V
[18:53:57][D][seplos_bms:047]: Cell voltage 4: 3.287 V
[18:53:57][D][seplos_bms:047]: Cell voltage 5: 3.311 V
[18:53:57][D][seplos_bms:047]: Cell voltage 6: 3.301 V
[18:53:57][D][seplos_bms:047]: Cell voltage 7: 3.297 V
[18:53:57][D][seplos_bms:047]: Cell voltage 8: 3.292 V
[18:53:57][D][seplos_bms:047]: Cell voltage 9: 3.304 V
[18:53:57][D][seplos_bms:047]: Cell voltage 10: 3.312 V
[18:53:57][D][seplos_bms:047]: Cell voltage 11: 3.304 V
[18:53:57][D][seplos_bms:047]: Cell voltage 12: 3.311 V
[18:53:57][D][seplos_bms:047]: Cell voltage 13: 3.306 V
[18:53:57][D][seplos_bms:047]: Cell voltage 14: 3.290 V
[18:53:57][D][seplos_bms:047]: Cell voltage 15: 3.294 V
[18:53:57][D][seplos_bms:047]: Cell voltage 16: 3.289 V
[18:53:57][D][seplos_bms:051]: Number of temperature sensors: 6
[18:53:57][D][seplos_bms:058]: Temperature sensor 0: 29.82 °C
[18:53:57][D][seplos_bms:058]: Temperature sensor 1: 29.76 °C
[18:53:57][D][seplos_bms:058]: Temperature sensor 2: 29.67 °C
[18:53:58][D][seplos_bms:058]: Temperature sensor 3: 29.82 °C
[18:53:58][D][seplos_bms:062]: Environment temperature: 29.82 °C
[18:53:58][D][seplos_bms:065]: Mosfet temperature: 29.78 °C
[18:53:58][D][seplos_bms:068]: Current: -6.44 A
[18:53:58][D][seplos_bms:071]: Total battery voltage: 52.80 V
[18:53:58][D][seplos_bms:074]: Residual capacity: 133.82 Ah
[18:53:58][D][seplos_bms:078]: Battery capacity: 170.00 Ah
[18:53:58][D][seplos_bms:081]: State of charge: 78.7 %
[18:53:58][D][seplos_bms:084]: Rated capacity: 180.00 %
[18:53:58][D][seplos_bms:087]: Rated capacity: 70 %
[18:53:58][D][seplos_bms:090]: State of health: 100.0 %
[18:53:58][D][seplos_bms:093]: Port voltage: 52.79 V

I would be happy if you give it a try!

@faizan-elite
Copy link
Author

Thanks for the update.

I have tested the new draft. Seems to be getting errors. I have attached the log and mqtt messages.

logs_wemos-mini_logs.txt
Screenshot 2022-06-19 at 6 13 18 PM

@syssi
Copy link
Owner

syssi commented Jun 19, 2022

Thanks for testing! Your log containing some real responses helps a lot.

@syssi
Copy link
Owner

syssi commented Jun 19, 2022

You battery has 15 cells, right?

@faizan-elite
Copy link
Author

Yes its 15 cells.

@syssi
Copy link
Owner

syssi commented Jun 19, 2022

I've pushed a fix to handle/decode shorter telemetry responses of a 15 cell system. Please give it a try. You can ignore the MQTT topics for now because all important output is written to the log. No sensors are implemented yet.

@faizan-elite
Copy link
Author

Thanks Working Now. Attached logs.

logs_wemos-mini_upload.txt

@faizan-elite
Copy link
Author

attached a more detailed log. seems to be getting the invalid header error in between readings.

logs_wemos-mini_logs.txt

but overall its working well.

@syssi
Copy link
Owner

syssi commented Jun 19, 2022

The invalid header errors are fine because some bytes (-> the start of frame byte) gets missed every now and then. This can be improved by not using software serial. Let's ignore this "issue" for now because it's not dangerous.

@syssi
Copy link
Owner

syssi commented Jun 19, 2022

As next step I will expose the values as sensors. So you can access the data via mqtt or api.

@faizan-elite
Copy link
Author

Thanks That will be great for anyone wanting to get data from their seplos bms.

It is currently how i have been able to setup on my end using nodered to update MQTT topics and send notifications for battery warnings as they occur.

Screenshot 2022-06-19 at 8 39 52 PM

Screenshot 2022-06-19 at 8 40 07 PM

Screenshot 2022-06-19 at 8 39 44 PM

my next step now is to pull mqtt topics and construct CAN messages in Pylon protocol to send to inverter. Since my batt has the RS232 instead of the CAN port it is unable to communicate with the inverter.

@syssi
Copy link
Owner

syssi commented Jun 19, 2022

I've started another project here: https://github.com/syssi/esphome-virtual-can-bms

This component helps to pick some measurements of a connected BMS and construct CAN bus message to inform a Sunny Boy f.e.

@faizan-elite
Copy link
Author

faizan-elite commented Jun 19, 2022 via email

@syssi
Copy link
Owner

syssi commented Jun 19, 2022

I've implemented all sensors. Please add the sensors to your configuration yaml and give it another try! :-)

@syssi
Copy link
Owner

syssi commented Jun 19, 2022

Could you provide a photo of your Seplos BMS mainboard? I would like to know the exact model number and PCB version.

@faizan-elite
Copy link
Author

faizan-elite commented Jun 19, 2022

Thanks for the update. Will test it and provide you feedback tomorrow.

My pack is actually assembled and sold by a local company (not branded) however being under warranty for another 3 years getting inside is not an option at this time. Took me sometime to figure out it was a seplos bms after much research figuring out how to get the battery and inverter communication to work.

From the manufacturer info command i was able to get the following:
Model : 1101-ZH26
Protocol Version 2.02
Manufacturer name and communications shows blank.

Same infö as above also shows up in the seplos battery monitor software.

@faizan-elite
Copy link
Author

faizan-elite commented Jun 19, 2022

Was able to test the update. Will have more logs when the battery is in use during the day to check the power figures. The sensors are working. This is awesome work on your part !

logs_wemos-mini_upload.txt

Screenshot 2022-06-20 at 2 14 21 AM

@syssi
Copy link
Owner

syssi commented Jun 19, 2022

Try to have a look at the full MQTT traffic of the node. A ESPHome node exposes one sensor per topic. The message contains the plain measurement (no JSON object).

@faizan-elite
Copy link
Author

faizan-elite commented Jun 20, 2022 via email

@faizan-elite
Copy link
Author

Attached log during discharging. All seems to be working well for telemetry data.

logs_wemos-mini_logs_Charging.txt

@syssi
Copy link
Owner

syssi commented Jun 20, 2022

You told me you are already requesting and parsing the CID2 0x44 frame. Could you provide a raw request and response payload I can work with?

@faizan-elite
Copy link
Author

faizan-elite commented Jun 20, 2022 via email

@syssi
Copy link
Owner

syssi commented Jun 20, 2022

Yes!

~20004644E00200FD35\r
       ^^ CID2

@faizan-elite
Copy link
Author

Attached decoding the communication response. Its a bit messy but should be able to understand.

let me know if you need any help here / confusion on anything.

Also attached my NodeRed Flow if that can help you. It takes the mqtt responses (first version of your code basic uart) and decodes all the values for the telemetry data & warnings.

Seplos BMS Decode Communication Response.docx

Seplos BMS Flow NodeRed.json.zip

@syssi
Copy link
Owner

syssi commented Jun 20, 2022

I've found what I'm looking for at your first post / log:

>>> "~20004644E00200FD35\r"
<<< "~20004600A06000010F000000000000000000000000000000060000000000000000140000000000000300000200000000000000000002EB74\r"

Thanks for sharing your node red implementation. This will speed up things. :-)

@faizan-elite
Copy link
Author

faizan-elite commented Jun 20, 2022 via email

@syssi
Copy link
Owner

syssi commented Jun 20, 2022

Could you do me another favor? Please flash this configuration to your device

substitutions:
  name: seplos-bms
  tx_pin: GPIO4
  rx_pin: GPIO5

esphome:
  name: ${name}
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

api:
ota:
logger:

uart:
  id: uart0
  baud_rate: 9600
  tx_pin: ${tx_pin}
  rx_pin: ${rx_pin}
  debug:
    direction: BOTH
    dummy_receiver: true
    after:
      delimiter: "\r"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

interval:
  - interval: 20s
    then:
      # Get system parameters (CID2 `0x47`)
      - uart.write: "~200046470000FDA9\r"
      - delay: 2s

      # Get protocol version (CID2 `0x4F`)
      - uart.write: "~2000464F0000FD9A\r"
      - delay: 2s

      # Get manufacturer info (CID2 `0x51`)
      - uart.write: "~200046510000FDAE\r"
      - delay: 2s

      # Get management info (pylontech only?)
      - uart.write: "~200046920000FDA9\r"
      - delay: 2s

      # Get module serial number (pylontech only?)
      - uart.write: "~200046930000FDA8\r"
      - delay: 2s

and provide the log. I'm looking for response examples of the commands above and I would to know your BMS is able to respond to "custom pylontech commands".

@faizan-elite
Copy link
Author

Seems to be returning responses to these commands. Surprising i tried to change the setting in battery monitor to RS485 Pylon protocol but that failed. Also even on RS485 inverter is not able to communicate with battery.

logs_wemos-mini_logs.txt

@syssi
Copy link
Owner

syssi commented Jun 20, 2022

Thanks! I did split the log/payloads into one issue per response type:

#6
#12
#13
#14
#15
#16

@javierhouse
Copy link

javierhouse commented Dec 21, 2022

Hi Syssi,

Im reading you project because I need read the information of my bms seplos. I would like learn something about this protocol, because is new for me. I try your last code in my ESP32 and I can see the out message in the log, but I don´t receive any response from the bms.

The only difference is the baud_rate parameter, I just try with 19200 and 9600 to, and have the same result.

[22:01:17][C][uart.arduino_esp32:108]: UART Bus 1:
[22:01:17][C][uart.arduino_esp32:109]:   TX Pin: GPIO17
[22:01:17][C][uart.arduino_esp32:110]:   RX Pin: GPIO16
[22:01:17][C][uart.arduino_esp32:112]:   RX Buffer Size: 384
[22:01:17][C][uart.arduino_esp32:114]:   Baud Rate: 19200 baud
[22:01:17][C][uart.arduino_esp32:115]:   Data Bits: 8
[22:01:17][C][uart.arduino_esp32:116]:   Parity: NONE
[22:01:17][C][uart.arduino_esp32:117]:   Stop bits: 1
[22:01:17][C][captive_portal:088]: Captive Portal:
[22:01:17][C][web_server:125]: Web Server:
[22:01:17][C][web_server:126]:   Address: battery.local:80
[22:01:17][C][mdns:103]: mDNS:
[22:01:17][C][mdns:104]:   Hostname: battery
[22:01:17][C][ota:093]: Over-The-Air Updates:
[22:01:17][C][ota:094]:   Address: battery.local:3232
[22:01:17][C][ota:097]:   Using Password.
[22:01:17][C][api:138]: API Server:
[22:01:17][C][api:139]:   Address: battery.local:6053
[22:01:17][C][api:143]:   Using noise encryption: NO
[22:01:25][D][uart_debug:158]: >>> "~200046470000FDA9\r"
[22:01:27][D][uart_debug:158]: >>> "~2000464F0000FD9A\r"
[22:01:29][D][uart_debug:158]: >>> "~200046510000FDAE\r"
[22:01:31][D][uart_debug:158]: >>> "~200046920000FDA9\r"`

but really I don´t know were is the problem, If you can help me, I will very gratefull.

thanks in advance.

@syssi
Copy link
Owner

syssi commented Dec 21, 2022

Could you provide a photo of your wiring? I would like to verify the RX/TX lines are connected to GPIO16/17. Which RS485 converter module do you use? May be flow control is required? Does your RS485 module have RX/TX leds? Does the TX led blink periodically? If the RX led links instead you should switch the RX/TX lines. What about the dip switches of your Seplos BMS? Did you turn off all switches?

@javierhouse
Copy link

Syssl, first of all, thank you a lot.

  1. Wiring (tx-->brawn rx-->grey)
    1671658454773
    1671658454792

  2. Which RS485 converter module do you use?
    I`m using this model: https://www.amazon.es/ARCELI-Adaptador-Puerto-M%C3%B3dulo-convertidor/dp/B07DN115BZ

  3. Does your RS485 module have RX/TX leds?
    Yes, and if I`m not wrong, both are blinking every 2/5 seconds

  4. If the RX led links instead you should switch the RX/TX lines.
    Im sorry, I dont understand what do you mean with this.

  5. What about the dip switches of your Seplos BMS? Did you turn off all switches?
    Yes all are "off" actually I only have one battery.

@syssi
Copy link
Owner

syssi commented Dec 22, 2022

  1. Please unplug the BMS. The TX LED should blink periodically. The RX LED must stay off.
  2. I tried to say you have to swap the TX/RX lines if the TX pin of the ESP is connected to the RX pin of the RS485 module . It looks like you have connected the RS485 module properly.

@javierhouse
Copy link

javierhouse commented Dec 22, 2022

  1. Yes, If I unplug the A & B cable from BMS to the RS845 only the TX Led blink.
  2. Yes, I changed it, but I didn´t see any difference.

@syssi syssi closed this as completed Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants