-
-
Notifications
You must be signed in to change notification settings - Fork 151
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 legacy protocol support #14
base: main
Are you sure you want to change the base?
Conversation
I receive the same messages being connected/disconnected to the BMS. disconnected: [17:54:57][VV][scheduler:152]: Running interval 'update' with interval=5000 last_execution=78911 (now=83911) connected: [17:58:32][VV][scheduler:152]: Running interval 'update' with interval=5000 last_execution=94285 (now=99290) I'm using the original RS232-485 JKBMS converter + a XY-017 RS485-TTL converter to the esp: platform: ESP32 baud_rate: 9600 |
Does the TX led of the rs485 module blink periodically? Please make sure the TX led is blinking and not the RX led. Did you try to swap the RS485 (A/B) wires once? |
Tx blinks periodically. Rx stays off.
I will try swapping them either way.
El lun., 1 nov. 2021 19:51, Sebastian Muszynski ***@***.***>
escribió:
… Does the TX led of the rs485 module blink periodically? Please make sure
the TX led is blinking and not the RX led. Did you try to swap the RS485
(A/B) wires once?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACYQ3FRRP3QUWEXGI2XBIK3UJ3OTDANCNFSM5HCUHQOQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Tested swapping A/B wires for both the new and normal esphome-jk-bms. Still
the same.
|
Could you try to swap the GPIOs at the yaml once. Does the RX led blink this time? I want to make sure the GPIOs are connected properly. You have to swap the GPIOs later again because the TX led must blink / the ESPs sends periodically. The last step would be dropping both rs485 converters. You can connect the ESP directly to the BMS because of the TTL level (3.3V). This time it is super important to identify the RX and TX pin of the BMS. Don't use |
Can i just change the code in esphome ? Pin4 <->14
|
Yes. This is the idea! So we can be sure the GPIOs are properly connected (without re-wiring). |
1) Original code:
A & B no swap / A & B swap= All the esphome sensors remains 0
TX LED in the 485 converter flickers as usual, RX off
```
tx_pin: GPIO14
rx_pin: GPIO4
```
2) Original code:
```
baud_rate: 115200
rx_buffer_size: 384
tx_pin: GPIO4 #original 14
rx_pin: GPIO14 #original 4
```
A & B swapp or A & B normal:
TX LED in the 485 converter flickers as usual, RX off
Even with the BMS cable disconnected I get the same garbage data .. must be
reading itself.
```
esphome_jkbms temperature sensor 1 -22289 °C
esphome_jkbms temperature sensor 2 -22289 °C
esphome_jkbms total voltage 403.07 V
esphome_jkbms current 0.00 A
esphome_jkbms capacity remaining 253 %
esphome_jkbms charging cycles 64831
esphome_jkbms total charging cycle capacity 1945976576
esphome_jkbms total voltage overvoltage protection 163.04 V
esphome_jkbms total voltage undervoltage protection 648.31 V
esphome_jkbms cell voltage overvoltage protection 22.189 V
esphome_jkbms cell voltage overvoltage recovery 51.315 V
esphome_jkbms cell voltage overvoltage delay 16180 s
esphome_jkbms cell voltage undervoltage protection 47.787 V
esphome_jkbms cell voltage undervoltage recovery 0.000 V
esphome_jkbms cell voltage undervoltage delay 43130 s
esphome_jkbms cell pressure difference protection 16.248 V
esphome_jkbms balance starting voltage 0.000 V
esphome_jkbms balance opening pressure difference 30.205 V
esphome_jkbms total runtime 24237100 h
esphome_jkbms actual battery capacity 855668800 Ah
esphome_jkbms charging ON
esphome_jkbms discharging
esphome_jkbms balancing
esphome_jkbms operation mode Balancer enabled
```
3) test code:
```
uart:
id: uart0
baud_rate: 9600
rx_buffer_size: 384
tx_pin: GPIO4 #original 14
rx_pin: GPIO14 #original 4
```
TX LED in the 485 converter flickers as usual, RX always off
Even with the BMS cable disconnected I get the same garbage data .. must be
reading itself.
```
[13:01:00][VV][uart.arduino_esp32:121]: Wrote 0b11011101 (0xDD)
[13:01:00][VV][uart.arduino_esp32:121]: Wrote 0b10100101 (0xA5)
[13:01:00][VV][uart.arduino_esp32:121]: Wrote 0b00000011 (0x03)
[13:01:00][VV][uart.arduino_esp32:121]: Wrote 0b00000000 (0x00)
[13:01:00][VV][uart.arduino_esp32:121]: Wrote 0b11111111 (0xFF)
[13:01:00][VV][uart.arduino_esp32:121]: Wrote 0b11111101 (0xFD)
[13:01:00][VV][uart.arduino_esp32:121]: Wrote 0b01110111 (0x77)
[13:01:00][VV][uart.arduino_esp32:142]: Flushing...
[13:01:00][V][component:186]: Component esphome.coroutine took a long time
for an operation (0.06 s).
[13:01:00][V][component:187]: Components should block for at most 20-30ms.
[13:01:00][VV][uart.arduino_esp32:135]: Read 0b11011101 (0xDD)
[13:01:00][VV][uart.arduino_esp32:135]: Read 0b10100101 (0xA5)
[13:01:00][VV][uart.arduino_esp32:135]: Read 0b00000011 (0x03)
[13:01:00][VV][uart.arduino_esp32:135]: Read 0b00000000 (0x00)
[13:01:00][VV][uart.arduino_esp32:135]: Read 0b11111111 (0xFF)
[13:01:00][VV][uart.arduino_esp32:135]: Read 0b11111101 (0xFD)
[13:01:00][VV][uart.arduino_esp32:135]: Read 0b01110111 (0x77)
[13:01:00][V][component:186]: Component jk_modbus took a long time for an
operation (0.05 s).
[13:01:00][V][component:187]: Components should block for at most 20-30ms.
[13:01:05][VV][scheduler:152]: Running interval 'update' with interval=5000
last_execution=139366 (now=144366)
[13:01:05][VV][uart.arduino_esp32:121]: Wrote 0b11011101 (0xDD)
[13:01:05][VV][uart.arduino_esp32:121]: Wrote 0b10100101 (0xA5)
[13:01:05][VV][uart.arduino_esp32:121]: Wrote 0b00000011 (0x03)
[13:01:05][VV][uart.arduino_esp32:121]: Wrote 0b00000000 (0x00)
[13:01:05][VV][uart.arduino_esp32:121]: Wrote 0b11111111 (0xFF)
[13:01:05][VV][uart.arduino_esp32:121]: Wrote 0b11111101 (0xFD)
[13:01:05][VV][uart.arduino_esp32:121]: Wrote 0b01110111 (0x77)
[13:01:05][VV][uart.arduino_esp32:142]: Flushing...
[13:01:05][VV][uart.arduino_esp32:135]: Read 0b11011101 (0xDD)
[13:01:05][VV][uart.arduino_esp32:135]: Read 0b10100101 (0xA5)
[13:01:05][VV][uart.arduino_esp32:135]: Read 0b00000011 (0x03)
[13:01:05][VV][uart.arduino_esp32:135]: Read 0b00000000 (0x00)
[13:01:05][VV][uart.arduino_esp32:135]: Read 0b11111111 (0xFF)
[13:01:05][VV][uart.arduino_esp32:135]: Read 0b11111101 (0xFD)
[13:01:05][VV][uart.arduino_esp32:135]: Read 0b01110111 (0x77)
```
I don't get why the TX LED always flickers (every 2 seconds aprox) in the
rs485 converter, even changing 4<->14.
RX stays off all the time.
|
This is super strange. I talked to some aliexpress seller of the BMS. He told me something like: Every BMS with firmware version IMO your device should work with the original code of this component. Could you try to connect the ESP32 directly to your BMS? |
Connected directly (no 485 converters), with original code, swapping/ not
swapping 4 / 14 pin, 9600/115200 bps.
I always get crazy data in the sensors.
Connecting or disconnecting the com cable to the BMS, doesn't change
anything, still receiving the same sensor data.
Also, I noticed that the voltage between GND and VBAT in the JST connector
=0 vdc. Is this normal for the 485/GPS port ?
[18:18:36][I][jk_bms:061]: Status frame received [18:18:36][D][sensor:113]:
'esphome_jkbms temperature sensor 1': Sending state -22289.00000 °C with 0
decimals of accuracy [18:18:36][D][sensor:113]: 'esphome_jkbms temperature
sensor 2': Sending state -22289.00000 °C with 0 decimals of accuracy
[18:18:36][D][sensor:113]: 'esphome_jkbms total voltage': Sending state
308.06000 V with 2 decimals of accuracy [18:18:36][D][sensor:113]:
'esphome_jkbms current': Sending state 0.00000 A with 2 decimals of accuracy
[18:18:36][D][sensor:113]: 'esphome_jkbms capacity remaining': Sending
state 253.00000 % with 0 decimals of accuracy [18:18:36][D][sensor:113]:
'esphome_jkbms charging cycles': Sending state 47787.00000 with 0 decimals
of accuracy [18:18:36][D][sensor:113]: 'esphome_jkbms total charging cycle
capacity': Sending state 0.00000 with 0 decimals of accuracy
[18:18:36][D][text_sensor:067]:
'esphome_jkbms errors': Sending state 'Low capacity;Charging
overvoltage;Discharging undervoltage;Battery over temperature;Charging
overcurrent;Discharging overcurrent;Cell pressure difference;Battery low
temperature' [18:18:36][D][text_sensor:067]: 'esphome_jkbms operation
mode': Sending state '' [18:18:36][D][sensor:113]: 'esphome_jkbms total
voltage overvoltage protection': Sending state 0.00000 V with 2 decimals of
accuracy [18:18:36][D][sensor:113]: 'esphome_jkbms total voltage
undervoltage protection': Sending state 0.00000 V with 2 decimals of
accuracy [18:18:36][D][sensor:113]: 'esphome_jkbms cell voltage overvoltage
protection': Sending state 0.00000 V with 3 decimals of accuracy
[18:18:36][D][sensor:113]:
'esphome_jkbms cell voltage overvoltage recovery': Sending state 0.00000 V
with 3 decimals of accuracy [18:18:36][D][sensor:113]: 'esphome_jkbms cell
voltage overvoltage delay': Sending state 0.00000 s with 0 decimals of
accuracy [18:18:36][D][sensor:113]: 'esphome_jkbms cell voltage
undervoltage protection': Sending state 0.00000 V with 3 decimals of
accuracy [18:18:36][D][sensor:113]: 'esphome_jkbms cell voltage
undervoltage recovery': Sending state 0.00000 V with 3 decimals of accuracy
[18:18:36][D][sensor:113]: 'esphome_jkbms cell voltage undervoltage delay':
Sending state 0.00000 s with 0 decimals of accuracy [18:18:36][D][sensor:113]:
'esphome_jkbms cell pressure difference protection': Sending state 0.00000
V with 3 decimals of accuracy [18:18:36][D][sensor:113]: 'esphome_jkbms
balance starting voltage': Sending state 0.00000 V with 3 decimals of
accuracy [18:18:36][D][sensor:113]: 'esphome_jkbms balance opening pressure
difference': Sending state 0.00000 V with 3 decimals of accuracy
[18:18:36][D][sensor:113]:
'esphome_jkbms total runtime': Sending state 5237056.00000 h with 0
decimals of accuracy [18:18:36][D][sensor:113]: 'esphome_jkbms actual
battery capacity': Sending state 2018946432.00000 Ah with 0 decimals of
accuracy [18:18:41][I][jk_bms:061]: Status frame received
[18:18:41][D][sensor:113]:
'esphome_jkbms temperature sensor 1': Sending state -22289.00000 °C with 0
decimals of accuracy [18:18:41][D][sensor:113]: 'esphome_jkbms temperature
sensor 2': Sending state -22289.00000 °C with 0 decimals of accuracy
|
How many cables did you connect to the BMS? |
gnd, tx,rx (tested also without connecting gnd to the ESP).
I'm powering the ESP from an isolated 5v PSU.
Never used Vbat (red cable from the JST),
|
A side note: If your BMS doesn't provide VBAT the original RS485 adapter won't be powered properly and cannot work. |
You are right, Vbat wasn't connected to the multimeter before...
Vbat provides battery voltage correctly.
|
BTW, there is another github that actually works with the new versions of
JKBMS:
https://github.com/Louisvdw/dbus-serialbattery/blob/master/etc/dbus-serialbattery/jkbms.py
¿Is this the same protocol that you have implemented ?
|
Yes. It's the same protocol. The is the command to query the current status: https://github.com/Louisvdw/dbus-serialbattery/blob/master/etc/dbus-serialbattery/jkbms.py#L19 This component does the same here: https://github.com/syssi/esphome-jk-bms/blob/main/components/jk_modbus/jk_modbus.cpp#L126-L147 |
Could you try to use the python implementation by connecting the BMS to a TTL-to-USB adapter? |
567c006
to
7aa5227
Compare
8ddbada
to
2d6fd82
Compare
@inorhan: Could you download this feature branch and flash the
esp32-example.yaml
to your esp32:I've added a single query to this feature branch. Your BMS should respond if it supports the protocol v4. You should see something like this:
Please provide some responses of your BMS.
Closes: #13