FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14151 questions

16804 answers

27630 comments

54049 members

0 votes
2,699 views 2 comments
by
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

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

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
Could I have more details on the third option, please?