Data aquisition via Modbus to Server

I am trying to implement the RUT901 as a gateway for data gotten via MODBUS from a plc and sending the data to different endpoints in a REST API. I configured the RUT as a Modbus master but when sending the data to the server I was not able to filter the data accordingly. For clarification I have the PLC configured as a slave with one Slave ID but the PLC holds different data in different registers, in the Teltonika Data to Server config I cant filter the data from the Modbus by requests (you can define different request to read different registers on the PLC). So my question is is there I way where i can configure the RUT to send to different endpoints(edpoints refering to different URLs) data from 1 Slave that has data read from different registers.For ex. Slave ID : 1 has requests for ex. temperature, humidity read from different registers, while the config in Data to Server is from the same ID but dfifferent rgisters in different configurations.

Hello,

Apologies for the delayed response.

Currently, if you are reading data from one Modbus server, the only option is to filter the data on Modbus requests. Since Data to Server collection does not allow multiple data inputs of the same data source type (those that use Databases, i.e. Modbus, DNP3), you are limited to filtering only one Modbus request per data collection. Thus, you can create multiple collections and filter on requests, but if you have a lot of requests, this is not really feasible.

The RnD team is aware that there are clients who would like to have more flexible filtering options. There are plans to add improvements to the filtering functionality in the future, but there is currently no information on when these improvements will be implemented.

Right now, I will suggest one workaround, but please keep in mind that this is just a workaround and I cannot guarantee that it will work properly.

Let’s say your router has a LAN IP of 192.168.65.1. The Modbus server has an IP address of 192.168.65.100.

What you can do is create multiple Modbus TCP devices in Services β†’ Modbus β†’ Modbus TCP client. Each of those devices will be configured with different IP addresses and, for instance, port 5502.

192.168.65.101
192.168.65.102
192.168.65.103

Those devices can be configured with different Modbus requests, and the rest of the Modbus settings will be the same.

Afterwards, in the Data to Server configuration, you can filter Modbus data (and thus, multiple requests) based on Modbus Server IP.

Then, since you have only one real server (in this example, 192.168.65.100), you can add additional iptable rules to forward packets with a destination of 192.168.65.101-103 towards your actual server:

iptables -t nat -A OUTPUT -p tcp --dport 5502 -d 192.168.65.101 -j DNAT --to-destination 192.168.65.100:502
iptables -t nat -A OUTPUT -p tcp --dport 5502 -d 192.168.65.102 -j DNAT --to-destination 192.168.65.100:502
iptables -t nat -A OUTPUT -p tcp --dport 5502 -d 192.168.65.103 -j DNAT --to-destination 192.168.65.100:502

These rules can be added directly from the CLI/SSH (username β€˜root’). However, IPtable rules that are added from the command line do not persist and are lost on device reboot. Firstly, I would suggest trying these rules from CLI/SSH. If it works, you can add them to Network β†’ Firewall β†’ Custom Rules. This will ensure that those rules persist even if you reboot the device.

Basically, you will be able to filter requests on the Modbus Server IP filter, but all the requests will actually be forwarded to the single 192.168.65.100 Modbus Server.

If you decide to try this, please let me know about the results.

Kind Regards,

2 Likes

This topic was automatically closed after 15 days. New replies are no longer allowed.