question

lennycb avatar image
lennycb asked

Anbindung an RPI4 | USB <-> TTL und USB <-> RS485

Mal ein paar Fragen an die, die ihre Geräte per RS485 und VE.direct anbinden und die Adapter selbst konfektioniert haben.


Meine Anlage funktionierte lange problemlos.

bisheriges Setup:

1x MultiPlus USB<->MK3 (org. Victron)

1x MPPT 100/20 USB<->TTL auf CH340 Basis

1x Shunt 500A USB<->TTL auf CH340 Basis

1x ET112 USB<->RS485 auf FTDI Basis


Nach Neustarts wurden immer alle Geräte problemlos gefunden.

Nun wurde die Anlage auf LiFePo4 umgebaut und ein größerer MPPT verbaut


neues Setup:

1x MultiPlus USB<->MK3 (org. Victron)

1x MPPT 100/50 USB<->TTL auf CH340 Basis

1x Shunt 500A USB<->TTL auf CH340 Basis

1x ET112 USB<->RS485 auf FTDI Basis

1x JBD BMS (LiFePo4) USB<->RS485 auf FTDI Basis


Nach der Installation der Komponenten zeigte sich, dass ich mal VenusOS auf dem Pi4 neu auflege.

Alle Komponenten wurden gefunden und korrekt im VenusOS angezeigt.


Letzte Änderung die ich durchführte war, der Austausch der Kabel vom MPPT zur Sammelschiene (Anpassung Querschnitt zum neuen MPPT)

Hier hatte ich den VE.direct Stecker am MPPT abgezogen und danach fing der Salat an.


Seit dem findet VenusOS nur noch sporadisch die Komponenten im VE-Netz.


Was habe ich schon recherchiert:

- gibt wohl arge Probleme mit USB/TTL Wandlern mit den CH340 Chips.

(Wundert mich aber, dass es so lange ohne Probleme lief)

- Victron empfiehlt die originalen Adapter.

(diese laufen m.M. auch nur mit einen FTDI-Chip, daher wundert es mich, dass meine USB/RS485 Umsetzer nicht gleichzeitig gehen)


Wer hat ne Idee warum meine Anlage solch "komisches Verhalten" an den Tag legt?

Wie macht ihr das?

Welche Umsetzer nutzt ihr?

Wer nutzt USB/TTL mit CP2104 Chip und funktioniert es mit mehr als einem?


So, genug Fragen, erst mal schöne Ostern!

VE.Directrs485
19 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.

johnny-brusevold avatar image johnny-brusevold commented ·

@lenny.cb

I have had some of the same errors that you describe here. Did not put down as much work in figuring it out, but think the chips were damaged by ground fault, since I used not insulated.

Switched to this and it has worked fine since.

0 Likes 0 ·
lennycb avatar image lennycb johnny-brusevold commented ·

@Johnny Brusevold well, that doesn't look bad. Thanks for the information!

One more question about that:

I don't have to do anything else for VE.direct. How about RS485? Then an additional UART<->RS485 converter must be in between?!


Oh, I only found one shop that sells this module. And they no longer send to the EU.

#############

Na das sieht nicht schlecht aus. Danke für die Info!

Noch eine Frage dazu:

Für VE.direct muss ich nichts weiter tun. Wie wäre es mit RS485? Dann muss noch ein zusätzlicher UART<->RS485 Konverter dazwischen?!

0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold lennycb commented ·

@lenny.cb

Duppa is in Italy and you can shop directly on the page I linked to

For 485 I use RS485 too ethernet-modbus converter, but so far only for energy meters.

0 Likes 0 ·
olafd avatar image olafd johnny-brusevold commented ·

Hello @Johnny Brusevold , Hello @lenny.cb ,


in my opinion this has nothing to do the chipsets. As long as VenusOS supports the specific chipset.

(FTDIs with serial number are working OK)


--> VenusOS 2.73 is OK:

In VenusOS 2.73 more then two RS485-Adapters should work OK.


--> VenusOS 2.8.2-large only one RS485-Adapter is working OK:

In VenusOS 2.82-large the 2nd one gets somewhere in conflict with the 1st one, with the result that none of them are working.


But in VenusOS 2.82-large one can start the 2nd, 3rd and so on manuelly.


If you manage to let the WatchDog do this, It would be restarted if there is an error.


After a restart you have to start the additional RS485-Adapters again.


Hope that helps


P.S.

At my side, I need to manage at least 3x RS485 connections, but up to now, haven’t found a working automated solution for this.


1st - EM24

2nd - JBD-BMS

3rd - JBD-BMS

0 Likes 0 ·
lennycb avatar image lennycb olafd commented ·

Hello @OlafD, yes, I had also read about it that it no longer works well or not at all from a certain firmware.

I had just tried that with 2.73. Unfortunately didn't work either. Only the ET112 is visible. The JBD BMS remains gone.


..."After a restart you have to start the additional RS485-Adapters again."...

How do you mean? Do you have the console commands for this?


Thanks very much!

0 Likes 0 ·
olafd avatar image olafd lennycb commented ·

@lenny.cb

Maybe I can assist you a little.

What's the output of this command.

cat /data/etc/dbus-serialbattery/service/run

0 Likes 0 ·
lennycb avatar image lennycb olafd commented ·

@OlafD OK thank you.

Only the two rs485 converters are currently connected. The two USB/TTL converters are unplugged for the tests.


Only the converter from the grid meter is found. The JBD does not.


root@raspberrypi4:~# cat /data/etc/dbus-serialbattery/service/run
#!/bin/sh
exec 2>&1
exec /opt/victronenergy/dbus-serialbattery/start-serialbattery.sh TTY PRODUCT
root@raspberrypi4:~#
0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold olafd commented ·

@OlafD

If the linux kernel recognizes the devices and loads the driver correctly, the error must be in programs that communicate with the external device, or that a program initiates the port and an incorrect value is set for the respective port.

Does everything work properly if you test 4 x RS485 devices with the Raspberry Pi OS?

0 Likes 0 ·
olafd avatar image olafd johnny-brusevold commented ·

Hi @Johnny Brusevold,


currently I can’t test this - sorry for that.

I’ve only one Raspberry PI 3B+ with VenusOS 2.82 large running.

0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold olafd commented ·

Hi @OlafD

Now I have tested a bit on VenusOs 2.82 Lage and rs485 devices, and can state that with my devices based on ch341 usb to rs485 it works as you explain, but somewhat more random. If I stop the serial-starter daemon is all as it should be, with full control on 6 x rs485 devices. I can configure everyone as I want and send and receive data on all of them.

I have not checked much in the serial-battery program, but does your /etc/venus/serial-starter.conf contains 'include /data/conf/serial-starter.d' and 'serial-starter.d' is in place in /data/conf/ ?

edit

there was a typo 6 x 485 is correct

0 Likes 0 ·
olafd avatar image olafd johnny-brusevold commented ·

Hi @Johnny Brusevold,


8 working rs485-Devices, that sounds good.


Yes serial-starter.conf; serial-starter.d and /data/conf/serial-starter.d it’s all there.

How do you stop the serial-starter deamon?

0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold olafd commented ·

@OlafD

Just for fun on pi4 I plugged in 3 pcs more total 9 x rs485 and linux detects everyone and everyone works. So it is clear that the error lies in the software a place. Tested on pi3b + with 4 x usb to rs485 + 4 x usb to ttl which also works fine

stop: svc -d /service/serial-starter

start: svc -u /service/serial-starter

You can try editing /etc/venus/serial-starter.conf and remove

/data/conf/serial-starter.d to begin troubleshooting.

I do not know if it is the right way, but may be worth a try

serial-starter.conf should then look something like this

service sbattery    dbus-serialbattery
service cgwacs      dbus-cgwacs
service gps         gps-dbus
service modbus      dbus-modbus-client.serial
service modem       dbus-modem
service mkx         mk2-dbus
service vedirect    vedirect-interface
service fzsonick    dbus-fzsonick-48tl
service imt         dbus-imt-si-rs485

alias rs485         sbattery:cgwacs:fzsonick:imt:modbus
alias default       sbattery:gps:vedirect
0 Likes 0 ·
lennycb avatar image lennycb johnny-brusevold commented ·

Hello, I tried your solution. Works immediately.

Even if I plug in an RS485 during operation, it is correctly recognized.

Thanks a lot for this!

I am considering canceling my order for the original cables. :-)


Oh, what I notice positively, my PI4 doesn't seem to be that busy anymore. I previously had sluggish behavior on the remote console and in Path Browser. Virtually stuck in the flow display and also in the menu. Everything is great now!

0 Likes 0 ·
Show more comments
lennycb avatar image lennycb olafd commented ·

where have my answers gone? @OlafD deleted?

0 Likes 0 ·
olafd avatar image olafd lennycb commented ·

Hi @lenny.cb ,


one of two post of mine, an answer for you, has some code snippets included.

After posting, there was a massage containing ‘has to be moderated’.

I don’t know why, and waiting for release here.

0 Likes 0 ·
2 Answers
lennycb avatar image
lennycb answered ·

@OlafD @Johnny Brusevold

now you've lost me.

I tested with a USB/TTL (CP2104) --> device is not found.

I tested with a USB/TTL (FTDI) --> device is not found.

What worked right away was the org. Victron VE.direct cable.


So and now it's getting strange. I put my setup back the way it was before. 2x USB/TTL (CH340) + 2x USB/RS485 (FTDI) + 1x MK3.

After restarting, all devices were found except the JBD. Short USB off and on again, all devices there.


I don't trust myself to restart now, because I don't know what it will look like then.


One thing I noticed, the PI is quite sluggish in the remote console.

My test PI (same model, same software version) doesn't show such a delay between input and reaction.


Can this all be explained?

2 |3000

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

lennycb avatar image
lennycb answered ·

Hello @Johnny Brusevold @OlafD

so i give up. The whole thing can no longer be explained in normal words. Sometimes it works, sometimes not. I still think the code is poorly executed here. Imagine if every manufacturer of a jukebox or whatever only works with their own USB adapter. Terrible.


I now buy (against my conviction) all original cables.


However, I still have 2 questions:


1. Is it maybe the PI4???

2. How many USB-RS485 would I need for an EM112 and a JBD BMS? RS485 is normally a BUS system. But I could imagine that the Venus OS does not process this and wants its own adapter for each device.


Thank you!

2 |3000

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

Related Resources

VE.Direct protocol FAQ

Additional resources still need to be added for this topic