Introducing Pylontech Battery Health Node-RED integration

Happy Friday everyone,

I am a Victron customer running my home ESS with Pylontech US3000C batteries. Recently I experienced classical Pylontech warranty case where two of my US3000C units started misbehaving after three years in production, generating lot of high cell voltage errors. Both units successfully swapped under warranty with me wondering what could I have done differently (nothing - these were simply faulty units).

Because I am Victron Grafana maintainer (GitHub - victronenergy/venus-grafana: Default Grafana dashboards, for docker solution and Venus OS Large · GitHub) and love polished and helpful visualizations of all kinds, I started weekend tinkering and came up with a project that helps me achieve the following goals:

  • Collect detailed per cell level data from my Pylontech batteries, that I can use to asses the health.
  • Visualize them nicely in Venus Grafana.
  • Adjust DVCC charging algorithm near the top balancing to help avoid “high cell voltage” errors and hopefully (maybe) prolong useful battery life.

The project is rather simple to setup alongside existing Venus Grafana installation, Pylontech diagnostic cable connected from master battery directly to Cerbo USB port, with simple node red flow collecting the stats periodically and sending them to Venus Grarana Influx DB.

The project has not yet been tagged 1.0 as I am currently seeking feedback from more experienced users. If you are using Node Red, and Pylontech, and love Grafana, I’d like to hear your thoughts…

Example screenshot from my Grafana: 7 days of two of my batteries clearly showing aging cells that charge and discharge faster than the rest of the stack:

thanks a lot for your thoughts,

Martin

Martin, this is really cool. Perhaps flag the weak cells on the left labels? I’d be interested to know which ones are on average weak or high.

Is this doable for other batteries than Pylontech?

I’d love to extend this to other batteries, it only matters if they publish this data, and how. Pylontech makes this simple via serial console cable to the master battery.

Victron Smart LiFePo come to mind next because these are units that I have and can test, and they only publish cell data via BT advertisement so setup of multi battery deployments is a bit tricky (but not impossible) - entering the decryption key for each battery and watching them in Node RED via BT advertisements…

Other batteries for sure but do not have the necessary details yet and testing units :slight_smile:

ciao,

Martin

There does seem to be more of a trend for battery manufacturers to cloud enable their packs so this data can be viewed online, updates pushed remotely etc. Busy updating my own system to one that does this, so will be keen to see what can be queried over IP or API.
I left my console cable days behind me in the early 2000’s, would prefer to not return :wink:

Really cool project though. Batteries are perfect for heatmap-type visualisation.

@enodev

nice dashboard.

About the cells… and from YT: Offgrid Garage created a video about single cells charging and discharging faster than other. In the end all cell have been good. Just the contact surface got dirty over time by chemical reaction. He cleaned all contact surfaces with carbon paste and his “battery shelf” was 100% good again.
Pls read the comments carefaully as there different opionions baout using carbon paste.

Pls find the vid: https://youtu.be/Mhg_FCoD3Jo?si=mUasU8PsOUA_Sj14

Good luck. BR, Bjoern

Thanks Bjorn for the video!

Thank you @enodev for your work.
You were lucky with exchange batteries. In my case they want to repair them through an approved service center.
So no exchange. Which, personally, I don’t like…

Thank you @BjoernK for the video.
Only if Pylontechs were like that… They are pouch cells with soldered terminals.

I am “charging myself” with desire/will to take two of my “behaving” modules out of my system and from two to make a good one by taking apart/unsolder the cells, measure them individually (Rin and C), and rebuilding one good battery and then keep the left good cells for future repairs.
I have the feeling there will be more… :grinning_face_with_smiling_eyes:

Alex, this is precisely the rebuilding that I did - make one unit from two bad ones combining the better cell packs. Hoping to get some more useful life out of the replaced units which would otherwise go to the recycling center. Once I opened the boxes I can clearly see that the cells are visibly delaminating, so I am not sure how much time they have, but balancing them properly and observing them from time to time in more detail I hope will help.

Only time will tell whether this was a wise experiment. But I am learning at lot along the way and that is what matters :slight_smile: And as a side effect I now have a beautiful (my words :slight_smile: ) Grafana dashboards with per cell statistics which will prove useful for future projects with other batteries as well.

Martin

Hi Martin, looks fantastic.

You can access the extended data over CAN, using socketcan, without requiring a diagnostic cable. There are a couple of wrinkles: they have to be running a relatively modern Pylontech firmware version (say, later than 2022) so they have BMS protocol > 2.0, and they have to not be behind an LV-Hub.

Here’s something way less pretty (+mashed formatting due to Chrome screen cap) that I’ve been working on:

and from a system running a slightly later version of the script (with temperatures) and waaaay less happy set of batteries:

I’ll check out your code, because I’m very interested in Grafana. Not sure if I can post mine - it’s a work project.

If anyone wants to get that info from the Pylontechs, just need to look over the extended CAN commands that can be found in the Pylontech doc in the topic below.

Thanks Dean for the socketcan recommendation. I will take a look because it that proves to be a viable route to match the data I can obtain via console cable, that may simplify the deployment… Let me take a look and see what can be done about it…

Martin

@Dean_Commodore , @alexpescaru — thanks, I spent some time with candump, the spec Alex linked, and my own Cerbo. Writing up what I found:

Sharing the bus with Victron’s driver is a non-issue. This was my main worry — can-bus-bms
owns BMS-Can, so how can a second process read it? It turns out SocketCAN interfaces are
netdevices, not exclusive character devices like /dev/ttyUSB0: every socket bound to the
interface gets its own copy of every frame. There’s no owner and no lock. CAN_RAW also isn’t
gated behind CAP_NET_RAW on current kernels, so this works as the unprivileged nodered user
that Node-RED runs as, on a Cerbo GX with Venus OS v3.80 and can-bus-bms v0.72 live on can1:

# su -s /bin/sh nodered -c "candump -n 3 can1"
  can1  351   [8]  14 02 AC 08 AC 08 C2 01
  can1  355   [4]  13 00 64 00
  can1  356   [6]  24 13 68 00 F9 00

can-utils is already in the Venus OS image, which helps.

But the per-module frames aren’t on the bus by default.
Revision 2.0.1 of the spec (2021-04-02) changed section 2.4 “from sending by BMS to need trigger
by upper device / inverter”. The modules answer the extended 0x4000000 / 0x5000000 requests;
they never volunteer them. A 150-frame capture of my live can1 has zero 29-bit frames in it —
only the usual 351 355 356 359 35A 35C 35E 35F 372 373 374-377 379 37A-37F 382 385. Victron’s driver never asks, so nothing answers.

The data available are module-level, not cell-level. Section 2.5 gives you, per module: min/max cell
voltage, module voltage and current, max/min cell temperature, MOSFET and BMS temperature, SOC,
SOH, nominal capacity, status/flag/error bitfields, serial number and firmware version. That’s
genuinely useful — SOH and serial per module especially. What it doesn’t give is the individual
cell voltages, temperatures and balancing flags, which is exactly what the dashboards I posted
are built on. So for my project CAN is an additional, coarser source rather than a replacement
for the console cable. Alex, this is probably also the answer to whether it would help with the
rebuild work — for picking good cell packs apart you still want bat N.

Open question which I was afraid to do for now: Writing data to can1 to trigger the module stats to be pushed back. I will first investigate what can be the side effects.

I’ve written all of this up with the full frame tables, including which decodes come from the
spec and which are inferred, plus a read-only can-probe command that decodes what’s on the
bus:

Running it read-only on my stack:

stack   PYLON US3000D  firmware 1.4
        6 module(s) online, 0 offline, 0 blocking charge, 0 blocking discharge
        49.11 V  11.7 A  24.7 C  SOC 20 %  SOH 100 %
        cell 3.250 - 3.286 V (spread 36 mV)
        min V module 1/3, max V module 1/3, min T module 1/6, max T module 1/1

Martin

True!

I’ve wondered… Maybe you’ve already thought about it…
Instead of the USB to serial adapter, what if you have a free/unconnected VE.Direct port on Cerbo (which is already RS232) and use that port, by detaching it from the Venus OS and use it to communicate with the master battery, with the help of a small TTL to RS232 converter.
I’ve always considered a direct serial connection more reliable than passing through an USB to serial converter.
And then, implement all commands and communication handling directly on the Venus OS, through a low level driver or even high level script.

Anyhow, good work ! :+1:

Nothing happens, the CAN dialog will have both 29 and 11 bits IDs, on the same can1.
The driver will only parse the 11 bits, while 29 bits can be interpreted by your software.