RS485 to Ethernet to RS485: possible?

I am running two KACO inverters via RS485 and dedicated CAT5 cable to a Selectronic Inverter/charger.

I had this idea to replace the direct RS485 link with Ethernet (over fibre), which has been on my plate since the last major lighting strike in 2017 when one of the comms cards got fried, and subsequently replaced.
Well, another major thunderstorm event happened last night, killing three micro-controllers on the network, one PC, and the inverters are offline again.

I had a look at two of these 1-port RS485 to Ethernet Converters | Ethernet to RS485 Converters | RS485 to TCP IP Converters but do not understand, whether these would fit the problem or not.

The way I think this should work is a client server connection between the two, and I should have a bidirectional RS485 communication?!

I am happy to have a play if someone could point me in the right direction.

I donā€™t understand your intention this smells like XY.
You want to replace the copper cable INBETWEEN two inverters with a fibre so lightning strikes cannot electrically propagate across ?
That problem you should solve in the electrics domain. Insert a UPS or similar device that provides overvoltage protection.

Those devices you can use to connect OH via Modbus/TCP to your RS485 inverter input and have bidirectional comms. But I donā€™t think you can use two of them back-to-back.
You could try 2 Raspis with ser2net but again this smells XY.

I have copper Ethernet between buildings, which I am replacing with fibre. This will solve one problem: immunise the building links against lighting strikes.

The key problem is, the KACO inverters talk RS485 to the Selectronic inverter/charger (which has a 20kWh battery connected to it).
At the time of installation in 2014, I ran an extra CAT6 dedicated to the RS485 connection.
Since this connection has suffered twice now, and costs me 400 dollars every time for the RS485 comms fix. Hence, the idea to convert the RS485 or ā€˜run it overā€™ Ethernet, and the reveres on the other end: Ethernet to RS485.

I thought the linked converters could be configured to establish a client server connection, like so:

        [    192.168.1.50     ]            [    192.168.1.51   ]
KACO -> [ RS485 <--> Ethernet ] -> Cat5 -> [Ethernet <--> RS485] -> Selectronic

I have seen only illustration which take the RS485 and run it over Ethernet to a virtual comm port on a computer. But never where where two RS485 devices talk via Ethernet (without needing to know).

The lighting strikes where direct hits. The grid was disconnected at the time.
Two rPis with ser2net is what I thought the linked devices can be used for.

As replied already, this is XY plus I think it would not work back2back.
Solve this in the electric domain, thereā€™s devices for some $ to protect against overvoltage.

Yes, you can in general use a pair of USR devices to link to each other and provide a serial-over-ethernet bridge.
Not so sure about the low-cost model 304, I think you might need the more sophisticated model 410 for a standalone bridge setup. Look in the manuals.

2 Likes

The issue is not over-volt protection. There are a few underground Ethernet cables, and these are being replaced with fibre, to eliminate the lighting strike problem. The whole property is already connected to a 20kWh UPS.

What I need to achieve here is to get rid of a RS485 cable run, by bringing it into the Ethernet networkā€¦ to simplify the infrastructure.

Thanks. What I thought.
If I may ask (and I looked at the manual, though I do not understand much, as in canā€™t tell why the 410 is better than the 304), what is the difference in capability of the 410, other than having both, a RS232 and 485 interface (and disregarding flow control and power supply input voltage range)?

1 Like

I had a related problem a few weeks ago.
My solar inverter, which expects to talk to its own supplied proprietary Smart Meter with RS-485 Modbus, is in a different building from where my power comes in from the street, and it was not feasible for me to run a cable, especially since I already have ethernet between the buildings, and WiFi, and my own smart meter in the right place.
So, I actually reverse engineered the modbus link between the inverter and its smart meter (took a good few days!) and wrote my own software for ESP8266 to pull the data from my own smart meter through MQTT and then present this data in the correct modbus format when the solar inverter asks for it.
This did take a solid week, but Iā€™m very happy that it works perfectly ā€“ it was the most elegant solution too, I now have three inverters each with an ESP8266 running my software pretending to be the proprietary smart meters, and they are all perfectly happy.

So, as for your problem: Itā€™s certainly possible to receive a packet, forward it, and then send it out at the other endā€¦ but as you do, you will be introducing significant delay, and itā€™s very possible that the requesting (modbus master) unit will not be happy with this.

If, on the other hand, you were to reverse engineer the protocol, then you could cache the correct data in advance in the modbus slave that you make yourself, and then it will be already be there when the master (your inverter) asks for it, so it will be none the wiser.

This is not an easy problem, but it is possible.

I had never done this kind kind of reverse engineering before.
In my case, once I figured out that my inverter was always asking making the SAME request, always requesting the SAME 23 values, then it was just a matter of figuring out what the values were.
To do that, I used an ESP8266 to make the same request that the inverter made, and then I used incandescent lights (power factor 1.0), LED lights (power factor 0.5) as artificial loads, and a whole lot of trial and error, until I knew exactly what each value wasā€¦ 3-phase volts, 3-phase amps + total, 3-phase watts + total, VA, VAr, power factor, frequency, and other things I canā€™t remember now.

Anyway, if youā€™re feeling adventurous, go for it!

1 Like

Wowā€¦ I wouldnā€™t know where to startā€¦
Congrats; nice story. :slight_smile:

In this case the KACO inverters are controlled by a Selectronic inverter/charger. The latter controls the inverters to ramp down once the export limit of 5kW has been reached. It also read production data (DC/AC V, A, etc.) to calculate load, export, import, etc. The link is essential for the system to work properly.

All I want, is leave it alone, but run the comms between these devices via fibre.

Hi Max - Also a Selectronic owner, and whilst my renewables are DC coupled, but I have a general understanding of the AC coupling approach they use as well, so understand what you are trying to doā€¦
(I also have a remote shed also connected by Fibre, which I mulled throwing an Inverter/Panels on too, but probably not going to do this in the near term, but hence why I did some research in the past on this).

I also use a number of the USR RS485 (and some RS232) devices mentioned above. Whilst I have not tried the USR to USR connection, they seem to be configurable to do soā€¦ I reckon throw one into Server Mode (can receive connections):
image

And throw one into client mode, configured to connect to the Server unit:
image

I presume this is ā€œmodbusā€ like, with the Selectronic acting as a master, and Kaco as slave(s), so if that assumption is correct, my theory (and its just a unproven theory) would be to connect the one in ā€˜Client Modeā€™ to the Selectronic, and the ā€œServer Modeā€ one to the Kaco.

I donā€™t have enough spare ones lying around to run up a quick (basic) test with some other devices for you, sorry, but these units are quite cheap, grab a few and see how you go. Cheaper experiment than another burned out Comms card in a SPPRO I would think? A couple of thoughts for you however:

  • On the Selectronic side, I would treat this proposed setup as an unreliable connection. I assume (and please note this is an assumption) that there are no Hazards or Safety of Life issues resulting from a RS485 comms loss. I know that the earlier versions had some kind of 'Fallback Power" mode configured both in the Kaco and Selectronic, which just meant that Kacoā€™s stopped exporting when the connection was lost (and resumes when it comes back). Any uncertainty, and I would confer with Selectronic around this
  • On the USR side, overall they seem to work well, but there is something with one of the units which gives me some minor trust issuesā€¦ It looks like it is running a continual port scan on the network, from a bogus source address, continually triggering my firewall. Not super-stressed tho, I have these devices segregated onto a vLAN, with only inbound connections allowed from OpenHAB, and PC (for Management/config). Not saying itā€™s a trojan in there, but itā€™s almighty weird.

Iā€™d be keen to know how you get on, in case I win lotto, and want to put an inverter/panels on the shed sooner that I expected, but in all seriousness, if this (comms) part of the puzzle was solved, the only technical hurdle left would be the AC connection - I would need to run another AC connection over to the shed, as the one running over there is upstream to the Selectronic, and the Selectronic AC coupled inverters need to be on the downstream AC sideā€¦,ā€¦

Good luck with getting this config setup, and dodging the next lightning strike :slight_smile:

1 Like

Yes, spot onā€¦ and something to work with. I have two 304s to play with.
I have ordered two KACO comms cards; expecting these to arrive tomorrow (Friday); and replacing them will fix the comms. If so, I follow up straight with configuring the 304 in client/server mode.

Given my setup, where the whole property is run via the SP-PRO. I had a 100% uptime since Dec 2014ā€¦ full seven years :slight_smile: and youā€™re right; no comms no solar PV; however, I am currently running them to go full throttle (aslo exceeding the export limit). with the current rainy weather, this is no issue, as I export less than 5kW/h anyway.

I think to remember a weird Internet address too (canā€™t recall ATM), but believe it can be disabled. Will look at this.

Will definitely report back here how I went.

USR FAQ for what they call ā€œtransparent transmissionā€

Looks like the 304 will support this, itā€™s the available ā€œwork modesā€ that differ between models.
The 410 for example supports true Modbus gateway settings - but you donā€™t need that for a point-to-point bridge, where it doesnā€™t care what data it is shuffling about.

1 Like

Thanks! What a nice find. I emailed these guys; no response, but could have pointed me to this.

I almost ordered the 410sā€¦ but thought I will try out the 304s once the comms cards are up and running as per normal.

This is exactly what I did with my PV inverters with battery storage, while I still had a mechanical meter which literally spun backwards when I over-exported. I canā€™t imagine why the power company didnā€™t let me keep it :grinning_face_with_smiling_eyes:

I only realized that I actually needed to install those smart meters once I had the one-way meter, and by then the houses were mostly finished, no more room to run cables.

Definitely worth trying the USRIOT gear. I used a couple of web relay boards from them before, and I remember having to reverse engineer their tcp protocol too, as didnā€™t get any response from them either ā€“ so itā€™s not just you. Anyway, transparent serial link is what you need so it could very well work perfectly, and itā€™s certainly a lot less work than my original suggestion. :slight_smile:

In my own setup, if I had used transparent serial links, I would have needed three of them, and three additional smart meters clamped onto the same wires for no good reasonā€¦ plus I wouldnā€™t be able to massage the values to control the zero export point, which I now can.

Good luck!

1 Like

A brief updateā€¦

I still havenā€™t received my comms cards; AU Post is slow, even with Express Post; over a week when it was sent from MEL to BNE. :frowning:

I set up two Arduinos with a RS485 board each. A poti on TX and a servo on RX. Works. Turning the poti changes the angle of the servo.

Then connected the 304s via A/B to the RS485 boards, and it works too. :slight_smile:

One 304 configured as server, the other as client, like so:

Server:
image

Client:
image

Now I wait until I have the comms working again between KACO and Selectronic, and then intercept that RS485 comms with the 304sā€¦ and see how that goes.

[Note] For those who read this post before my edit, it wasā€™t working, because I had the local port set to 0 on the client. I noticed this when posting, and thought letā€™s enter the server remote port (8234); and then it worked.[/Note]

Thank you all for your input; much appreciated.

1 Like