FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
1,110 views 4 comments
by anonymous

Hi guys, 

I have an application where I have a series of Modbus RTU data being polled from the TRB 145 operating as a Modbus RTU Master. 

This part is working well and now I am planning to map those data reads over to the TCP interface so I can pull them from Modbus TCP on the SIM 4G interface. 

Is there a way to link the Modbus TCP Slave data to access the Modbus RTU Master data? 

To My application is as follows:

  • SCADA system (via 4G connection) polling as a Modbus TCP master -> 
  • TRB145 (on cellular) acting as Modbus TCP slave serving data to incoming Modbus TCP Master polls -> 
  • TRB145 (internal mapping?) serving that Modbus TCP Slave data using RTU Master data collected via RS485 polls ->
  • TRB145 (serial) as Modbus RTU master polling local RS485 Modbus address.->
Thanks in advance!

2 Answers

+2 votes
by anonymous

Hi Craig,

You want to use Modbus TCP/IP on your SCADA Modbus master to query information from the power meter, which uses an RS485 connection. Is that correct?

You can configure your TRB145 as a Modbus gateway.

How this works is that your SCADA system will send Modbus TCP/IP queries to your TRB145 and TRB145 will be able to query your power meter over serial according to the Modbus slave ID. TRB145 will receive a response and forward it over TCP/IP to your SCADA system. Slave IDs can be configured manually or obtained automatically from Modbus headers. Since you are using a cellular connection to establish a communication channel with TRB145, you will need a public IP address. This will depend on your mobile operator. Sometimes there are different APNs available that grant public IP addresses, but you need to consult your operator if you do not have a public IP address. 

More information about Modbus Gateway can be found HERE.

A few words:

  • Ensure that the 'Listening IP' is your public IP address.
  • Ensure that the port is the same on the devices.
  • Ensure identical settings are set on both devices. Baud rate, data bits, parity, stop bits, flow control.
  • In IP filter options on the RS485 configuration page, add IP addresses that will be allowed to reach your Modbus gateway/devices.
  • Modbus Gateway has to be turned on only in RS485 settings. If you are using Modbus Serial Master or any other options, please, turn them off.

I tested this myself with RUT955, but this is identical to TRB145.

Diagslave simulator software running as RTU Slave on a PC via RS485 serial connection to RUT955. Software configuration (command at the top) and the running window:

Next, RUT955 is configured to use a specific APN that provides a public IP address for my RUT955 mobile interface. For information on how to configure APN refer to the section 'How can I set a custom APN?' on the FAQ page.

RUT955 has the RS485 section configured and set as a Modbus gateway. 

RS232, Modbus Serial Master, and other serial/ Modbus settings are turned off.

I used 'Poll Modbus' application on my phone to establish Modbus TCP/IP connection with my RUT955 using a public IP and request Modbus data from my Diagslave simulator software on a PC.

I was able to successfully read data from and write data to the RTU slave.

Wiring:

Kind Regards,

Andzej

Best answer
by anonymous

Dear Andzej,

Thank you very much for your detailed response. 

This was super helpful and allowed me to get it all working. 

I now have my SCADA application, polling the data via 4G over Modbus TCP and able to see the data being served by the meter. 

It was a huge achievement and I'm so grateful for your support!

FYI since my IP address is dynamically assigned I set the listening port to 0.0.0.0 and i was able to reach it without needing to lock the listening port to the address which will change. 

Thank you again!

by anonymous

Hi Craig,

Happy to hear that everything is working and you have achieved what you wanted. If there will be any questions or issues, you can always ask them. Happy to help you. Have a great day!

By the way, could you please mark the answer as 'best answer' so that the issue can be seen as resolved? Thank you.

Kind Regards,
Andzej

by anonymous
I have marked it as Best Answer, hope it worked ok. Please let me know if not.
by anonymous
Very cool.
My configuration is slightly different.
I do not have a SCADA system polling for data.
I want the RUT955 to operate in a standalone mode in which it will poll the RTU device RS485

and then push that data to our thingsboard portal.

This works OK for the "native" modbus registers in the RUT955, and also for the custom modbus registers

which I create by processing the pulse signals with shell scripts and writing data to  /tmp/regfile

I assumed that when I configured the RS485 as Modbus Gateway, then queries on that port (503)

from ModbusTCP master would be routed to Modbus RTU Slave device through Gateway

Weird!!!
I keep getting clobbered with the message

Message length must be <12000 characters.
I have nowhere near that
I was able to submit this post a few lines at a time even though posting it as a whole message wouldn't work.
Some bug in this site...
0 votes
by anonymous
Providing second answer so I can assign other answer as "Best Answer"