0
votes

I will be creating a connection between my Linux server and a cellular modem where the modem will act as a server for serial over TCP.

The modem itself is connected to a modbus device (industrial protocol) via an RS232 connection.

I would like to use pymodbus to facilitate talking to the end modbus device. However, I cannot use the TCP modbus option in PyModbus as the end device speaks serial modbus (Modbus RTU). And I cannot use the serial modbus option in Pymodbus as it expects to open an actual local serial port (tty device) on the linux server.

How can I bridge the serial connection such that the pymodbus library will see the connection as a local serial device?

2

2 Answers

0
votes

There is no straightforward solution to trick your linux server into thinking that a MODBUS RTU is actually of MODBUS TCP connection.

In all cases, your modem will have to transfer data from TCP to serial (and the other way around). So I assume that: 1) somehow you can program your modem and instruct it to do whatever you want 2) the manufacturer of the modem has provided a built-in mechanism to do that.

If 1): you should program your modem so that it can replace TCP ADUs by RTU ADUs (and the other way around) when copying data from the TCP connection to the RS link.

If 2): simply provide your RTU frame to whatever API the manufacturer devised.

0
votes

I actually was working on something similar and decided to make my own Serial/TCP bridge. Using virtual serial ports to handle the communication with each of the modems.

I used the minimalmodbus library although I had to modify it a little in order to handle the virtual serial ports.

I hope you solved your problem and if you didn't I can try to help you out.