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
3,139 views 2 comments
by anonymous
Is there a command line utility on the modem to grab Modbus values from slaves connected to the RUT955 via RS485 ?

I need the flexibility of polling Modbus values within a bash script which will run on the RUT955.

A similar question was asked here, but not fully answered:

https://community.teltonika-networks.com/5496/internal-script-accessing-both-internal-rs485-slaves-modbus

1 Answer

0 votes
by anonymous

Hello,

There is no straight forward command, which can be used to request data from connect Modbus slave device. If you want to read Modbus data from terminal you can do this in several ways:

  1. Configure Modbus serial master in WebUI to read slave device registers and then with Lua script and sqlite3 library read database with collected data which can be found /tmp/.modbus_tcp_master_db
  2. Configure Modbus gateway in Services -> RS232/RS485 and then you can read connected serial device registers using Modbus TCP requests
  3. If you want to read Modbus data from slave using serial communication using router terminal, then you will have to use stty to configure serial port parameters and with printf, echo, commands you will have to send hex request to device and with cat you will have to listen response from it
  4.  Lastly you can write program with C using <termios.h> header
by anonymous

Hi.
A question about the option 2 of your answer.
If I use "modbus read" from a Linux terminal (like in this tutorial: Monitoring via Modbus),
could I retrieve the router slave device's resgisters?
By default the command only reads the router's own internal registers.
Thanks.

by anonymous
Could I have more details on the third option, please?