question

Dierk Grossfeld avatar image
Dierk Grossfeld asked

Liontron Bluetooth BMS an Venus

Hallo zusammen,

ich bin Dierk und neu hier :)

Ich bin seit einigen Jahren Wohnmobilist und Fan der Victron Produkte.

Seitdem ich Anfang des Jahres angefangen habe eine kleine Inselanlage in DIY zu bauen bin ich scheinbar dem Victron Virus verfallen.....


Zum Problem bzw. zur Frage:

Ich bastel gerade am Venus OS auf einem Raspberry PI fĆ¼r besagte Solar Inselanlage.

Dort sind bereits ein Phƶnix 500VA und ein MPPT 75/15 per ve.direct auf USB angeschlossen und alles funktioniert bisher wunderbar.


Als Energiespeicher dient eine Liontron 12,8V LX Smart Batterie, die normalerweise in unserem Wohnmobil verbaut ist. Allein dafĆ¼r ist sie mir aber zu schade (48 Wochen im Jahr Idle - nach einem Jahr 10 Ladezyklen....)


Ich hab bereits fĆ¼r das Wohnmobil eine Ɯberwachung gebaut, die das ganze per Bluetooth anzapft.

Intern ist in der Batterie ein JBD BMS verbaut, was zumindest vom Protokoll her eigentlich sehr sauber dokumentiert ist.

Die Liontron hat dort zwar ein paar Eigenheiten (register 0x03 muss initial mindestens 3 mal angefragt werden), ist im Abfragenden Teil aber auch gelƶst.

Das ganze lƤuft auf einem zweiten Raspberry, der nur dafĆ¼r da ist und dieser Published auch per MQTT an die Venus oder jeden anderen MQTT Broker (als JSON).


Das ganze wird zusƤtzlich noch in eine SQLite Datenbank geschrieben zum Monitoring.


Ich habs schon soweit, das ich das an den Venus MQTT publishe und dort im Node RED Dashboard auch Anzeige (mit den selbstgebauten PHP Scripten klappt das auf dem BMS-Pi selbst ja sowieso).


Ich brƤuchte einfach nur einen Schubs in die richtige Richtung, wie das ganze in Richtung Venus und MQTT abgebildet sein muss. Dann hƤtte man die Infos auch sauber im VRM und/oder dem Control Panel.


Da hat hier doch bestimmt jemand eine Idee, oder ??

Vielleicht hilfts ja auch anderen mit Ƥhnlichen Batterien.....


Liebe GrĆ¼ĆŸe,

Dierk


Venus OSBMSBluetooth Low Energy - BLE
3 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Matthias Lange - DE avatar image Matthias Lange - DE ā™¦ commented Ā·
@Dierk Grossfeld Verschoben in den Modification Bereich.
0 Likes 0 Ā·
surfduck avatar image surfduck commented Ā·

Hallo Dierk,

ich bin auf deinen Artikel gestoƟen nachdem ich nun verschieden Scripte ausprobiert habe (s.u.), um Ć¼berhaupt eine Verbindung vom raspberry zum BMS einer Liontron 200ah via Bluetooth herzustellen und abzufragen.

Leider ohne Erfolg - leider komme ich gerade sogar nicht mal mehr via APP (Android) auf das BMS. Ich hoffe das geht irgendwann wieder.

Meine Frage ist, ob du ggf. dein Script zum Auslesen zur VerfĆ¼gung stellen wĆ¼rdest?


schƶne GrĆ¼ĆŸe

Kay

https://github.com/GemZ/LiontronBmsInfo

https://github.com/sshoecraft/jbdtool

https://github.com/sw-home/FHEM-BluetoothSmartBMS/blob/master/Raspberry/bmsinfo.py


------------------------

Hello Dierk,


I came across your article after I have now tried various scripts to establish and query at all a connection from the raspberry to the BMS of a Liontron 200ah via Bluetooth.

Unfortunately without success - unfortunately I can not even get via APP (Android) on the BMS. I hope this will work again someday.

My question is if you would provide your script for readout?


greetings

Kay

0 Likes 0 Ā·
Dierk Grossfeld avatar image Dierk Grossfeld surfduck commented Ā·

Hi Kay,

sorry fĆ¼r die "spƤte" Antwort, bin in der letzten Zeit reichlich eingebunden gewesen durch verschiedene andere Projekte.


Bei meiner Liontron ists leider auch so, das das Protokoll da ein wenig picky ist.

Wenn der Raspi erstmal runtergefahren ist, ist normalerweise das Bluetooth auch wieder frei fĆ¼r die App.

Die gƤngigen JBD Tools habe ich auch fast alle nicht zum laufen bekommen.

Das Script kann ich gern sofern noch interessant zur VerfĆ¼gung stellen.

Allerdings wird hier zusƤtzlich zur "Venus" noch ein weiterer Pi gebraucht.

Ist dann in der Art:
BMS-Pi -> MQTT Venus -> Treiber Venus (https://github.com/freakent/dbus-mqtt-devices)


Ist also nicht direkt im Venus OS lauffƤhig.

Hast du mal diesen Treiber ausprobiert ?

-> https://github.com/bradcagle/dbus-btbattery


Liebe GrĆ¼ĆŸe,

Dierk

1 Like 1 Ā·
5 Answers
Dierk Grossfeld avatar image
Dierk Grossfeld answered Ā·

So maybe it is also a good idea to post it in english.

Sorry, i am not a native speaker...


Hello, everyone,

I'm Dierk and I am new here :)


I've got a camper van and I am a fan of Victron products for a number of years now.


Since I started building a small island system in DIY at the beginning of the year, I seem to have been infected with the Victron virus.....


Regarding the problem or more precise the question:


I am currently working on the Venus OS on a Raspberry PI for said solar island system.


A Phoenix 500VA and an MPPT 75/15 are already connected there via ve.direct to USB and everything has worked wonderfully so far.


A Liontron 12.8V LX Smart battery, which is normally installed in our mobile home, serves as energy storage. But for that alone it's too good for me (idle for 48 weeks a year - after a year of use it has 10 charge cycles....)


I've already built a monitor for the mobile home that taps into the whole BMS thing via Bluetooth (can share the code if you want to).


A JBD BMS is installed internally in the battery, which is actually documented very cleanly, at least in terms of the protocol.


The Liontron has a few peculiarities there (register 0x03 must initially be queried at least 3 times), but they are also solved in the querying part.


The whole thing runs on a second Raspberry, which is only there for that bluetooth communication and it publishes that queried data via MQTT to the Venus or any other MQTT broker (as JSON).


The whole dataset is also written to an SQLite database for monitoring purposes (on PHP).


I've already gotten so far that I publish it to the Venus MQTT and also display it there in the Node RED dashboard (with the self-built PHP scripts it works on the BMS-Pi itself anyway).


I just need a nudge in the right direction on how the whole thing needs to be mapped towards Venus and MQTT.

Then you would have the information clean in the VRM and/or the Control Panel.


I am hoping that someone here has an idea regarding that.....


It might help others with similar batteries and might be a nice addition to the campers out there.


Kind regards,

Dierk

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Dierk Grossfeld avatar image
Dierk Grossfeld answered Ā·

Since the Venus already has some mqtt tree where values can be read and also written (R/ W/ and so on) I also hoped that it could be possible without writing any driver......

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Dierk Grossfeld avatar image
Dierk Grossfeld answered Ā·

Good morning !


I finally found a way....


Credits go to https://github.com/freakent/dbus-mqtt-devices for writing that mqtt device driver.

I only needed to extend the services.yml by:

battery:
  ProductId:
    default: 65535
  CustomName:
    default: "Liontron BMS"
    persist: true
  Soc:
    description: "%"
  Dc/0/Voltage:
    description: "V DC"
  Dc/0/Current:
    description: "A DC"
  Dc/0/Power:
    description: "W


My Liontron reader is then publishing to the topic

device/dg01/Status

a

{ "clientId": "dg01", "connected": 1, "version": "v1.0 ALPHA", "services": {"soc1": "battery"} }

and afterwards to the according topics under

W/<vrmid>/battery/<vrminstance>/Soc | Dc/0/Voltage | Dc/0/Current | Dc/0/Power

the according values out of the liontron.


At the moment its only doing it once every minute to not hammer the bluetooth bms like hell.

There could also be the option to also translate the Protection States of the Battery over to the venus.
But for me its at the moment sufficent to work with.

The device is also nicely showing up in the vrm.


Kind regards,

Dierk

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

-martin-1 avatar image
-martin-1 answered Ā·

Hi together,

there is a solution since a few weeks!

A direct Bluetooth connection of the Liontron battery (JBD BMS)

https://github.com/bradcagle/dbus-btbattery

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

gmbo avatar image
gmbo answered Ā·

Ich bin den Weg Ć¼ber einen ESP32 als Kopplung zur Liontron 200Ah gegangen.

Dabei habe ich eine gute Vorlage gefunden.

https://github.com/kolins-cz/Smart-BMS-Bluetooth-ESP32

Die habe ich dann dahingehend geƤndert, dass die Daten per MQTT gepublisht werden.

Da ich auch inzwischen wegen der Wlan Reichweite das ganze auf einem 2. ESP per LoRaWAN Ć¼bertrage, stelle ich auch immer wieder das hakeln beim Kommunikationsaufbau fest.

@Dierk Grossfeld Danke fĆ¼r den Tipp mit dem mindestens 3 mal Telegramm 3 abfragen, werde mal schauen ob ich da schnellere Verbindung bekomme wenn ich nicht toggle und erst einmal in kĆ¼rzeren Intervallen abfrage bis die Antwort kommt.

Liebe GrĆ¼ĆŸe

Gisbert

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Dierk Grossfeld avatar image Dierk Grossfeld commented Ā·
Gerne Gisbert,

leider ist das BMS da ein wenig hakelig, in der Tat.
Ich mache mittlerweile einfach nur noch alle 2 Sekunden eine Anfrage, dann lƤuft das eigentlich zuverlƤssig. Bluetooth ist halt nunmal auch Ɯbertragung per shared medium Luft....

Aber die Idee mit nem ESP32 ist auch super. DarĆ¼ber war ich noch nicht gestolpert....


Liebe GrĆ¼ĆŸe,
Dierk

0 Likes 0 Ā·

Related Resources

Victron Venus OS Open Source intro page

Venus OS GitHub (please do not post to this)

Victron VE.Bus BMS product page

Victron 3rd party BMS compatibility page

Additional resources still need to be added for this topic