I am looking for a solution for remote reading of a Modbus-RTU-Master from a MODBUS RTU Smart meter like Carlo Gavazzi EM340 on long distances not having a direct 2-wire connection between both.
Luckily I have a LAN/WLAN network with ethernet switches close to both (RTU-Master and RTU-slave).
I would like to use f.i. two Raspberry Pis as CODECs / tranlaters. The poll of the RTU-Master shall be brigded to MODBUS TP/IP using an RS485-USB conector.
Once the request is transferred to modbus-TCP it should be read by another bridge (f.i. Raspberry-Pi) translating the modbus-TCP-request to modbus-RTU and connecting with another USB-RS485 connector to the smart meter modbus-RTU interface.
I don’t think that’ll work as Modbus/TCP isn’t 100% Modbus/RTU wrapped in IP.
You could try with a tunneling software such as ser2net, but ultimately a more clever approach
would be to install another openHAB instance on the remote RPi (could be a Zero for that single purpose) and to use the remote openHAB binding to access it from your main OH server.
This will save you from lots of potential timing and synchronisation problems.
Why don’t you just use a ModbusTCP-to-ModbusRTU serial gateway?
The Master end (openHAB) talks Modbus-TCP directly to the ethernet, no converters or adaptors.
The Gateway converts ethernet to RS485 Modbus autonomously. Several slaves may share one wired bus/gateway.
Chinese made serial gateways are cheap, but make sure to choose one that handles Modbus corectly.
@gabreitenbach
I use Elfin-EW11 WiFi Modbus TCP to modbus RTU converter I bought from aliexpress for about 10 euros and works fine reading out SDM120 Modbus power meters
I have external 24VDC power supply. There is option that you buy the device with RJ45 connector on one side and screw terminals on the other, I purchased that option.