8297 questions

9760 answers

15547 comments

13864 members

0 votes
536 views 3 comments
by
Dear Sirs,

We are trying to integrate the TRB145 gateway in one of our applications.

For  this we need to be able to initiate a connection to our server to a port.

When the server accepts the connection, it sends out a modbus read, wiich should be received by the gateway and transferred trough the RS485 port to the PLC attached ro it.

We tested the RS485 Modbus gateway  function and it is working fine in  server mode

but in this case the gateway has to have routable IP or  DDNS... Not to mention that we would have to rewrite the central application.

So, we need a client mode for RS485 modbus gateway.

Just as it is in the "Over IP" serial type, where there is a "Mode"...

Is it possible?

Thanks!

1 Answer

0 votes
by

Hello,

From the information which you have provided, it seems that you want to get data from PLC device via Modbus, it that correct? If so, then I recommend using Modbus Serial Master and Data to Server features.

- Modbus Serial Master, allows TRB145 to read certain Modbus data from Modbus slave devices;

- Data to Server, allows TRB145 to send collected Modbus data to remote servers via HTTPs or MQTT.

Before configuring Modbus Serial Master and Data to Server features, please make sure TRB145 is using the latest available firmware version, firmware can be found here: https://wiki.teltonika-networks.com/view/TRB145_Firmware_Downloads

Once you upgrade TRB145 firmware, login to webUI and follow this steps:

1. Enable Advanced mode, to do this simply click on Mode section in the top left corner where the FW version is displayed.

2. After enabling Advanced mode, navigate to Services -> Modbus -> Modbus Serial Master here set serial settings to match your PLC settings. After configuring serial settings click Add to add RS485 slave device, once added click Edit (pencil icon) here you can enable, enter slave name, slave ID etc, but main configuration should be request configuration. To configure it, enter any name for easy management and click Add when added you should be able to select:

- Data type

- Function

- First Register

- Register count / values

Here you need to configure Modbus data, which will be pulled from the PLC device, once configured click Save & Apply.

3. Now to configure Data to Server feature navigate to Services -> Data to Server click Add then a configuration window should pop-up where you can select protocol in which data will be sent, JSON format how you would like to receive data (you can only add those values which are mentioned just below), URL/Hots... the IP or domain name of your server were to send data.

If everything configured correctly, TRB145 should collect Modbus data from Modbus slave device (PLC) and send that data to remote server.

More information can be found here:

- https://wiki.teltonika-networks.com/view/TRB145_Modbus

by
Thanks for the answer!

Yes, we are using Modbus.

Unfortunately we need to read and write registers as well. Mostly write actually...

In this case the  Modbus Serial Master + Data to Server combination is not useful.

We really need the RS485 Modbus Gateway function with TCP Client mode.

Is there a way to add TCP client mode to the RS485 Modbus Gateway with SDK? Or to do it with a User Script?

Thanks!
by
Hello,

Currently, TRB145 does not have this kind of feature, I will consult with RnD to see what we can suggest.
by

Hello,

This part:

  • When the server accepts the connection, it sends out a modbus read...

I assume this is a MODBUS TCP read command, is it not?

If you could make this a MODBUS RTU read command (without the MODBUS TCP header) and also be able to to parse a MODBUS RTU response (not MODBUS TCP response) you could use one of many available general gateway programs that do not perform any form of input/output conversion: socat (not installed in base firmware as of yet) and sodog (already installed in base firmware) come to mind. These programs do not perform the conversion from MODBUS TCP to MODBUS RTU (when sending a request) and vice-versa (when receiving a response).

If you could make this adjustment in your server and perform the conversions yourself, you could use the existing Serial over IP functionality.

Another option, using socat (which you have to install and configure manually yourself), is to implement the following setup:

Your server with public IP <-> socat <-> modbusgateway socket <-> RS485.

In this setup the socat program would have to initiate a bidirectional communication between your server and internal modbusgateway socket.

Let us know.