We have 4 devices which we want to connect to TRB245 through RS485 and send the data through MQTT to a cloud server. TRB245 will act as Modbus RTU Master.
- Does TRB245 support Modbus Multidrop to connect to multiple devices?
- If it does how many RS485 devices can connect to one TRB245?
We will use the internal MQTT broker in TRB245 and the cloud server as MQTT subscriber.
- So we have to create “Data to Server” and add host 127.0.0.1 and set a topic to which the cloud server will subscribe, right?
Yes, you can have multiple Modbus Slave devices connected via RS485. RS485 as a standard supports up to 32 devices. If you are daisy-chaining devices, make sure to use termination resistors.
If you are using the broker on TRB245, you can send the data to itself and subscribe to TRB245 broker from your server. However, since you are using MQTT on your server, and want to read Modbus data from the slave devices, I would suggest taking a look at Modbus MQTT gateway functionality. Basically, this would allow you to bypass data to server and the broker on TRB245, and would allow you to query Modbus devices directly from your server using MQTT. Another benefit would be that you will not need to store a lot of data on TRB245 (TRB245 has only a few MB of memory available). You can find more information about Modnus MQTT gateway functionality on our wiki page here.
If we use Modbus MQTT gateway I suggest we have to install MQTT broker on our server and then the Modbus MQTT gateway will act like a MQTT publisher right? But what if the network has been disconnected for some time, will the Modbus MQTT gateway store the messages and publish them when the network is up?
My idea is that if we use the internal broker of TRB245, it will store that messages if the subscriber(with the proper MQTT settings) is disconnected for some reason. Could you suggest another Teltonika device with more memory then? I saw TRB145 has 512MB memory and 128MB RAM.
It would act as a publisher and a subscriber. It would listen for MQTT messages (requests), send Modbus Requests to the appropriate devices (based on what is requested in MQTT message), and publish Modbus data to the topic.
If you are concerned about data loss due to connectivity issues, I believe that the best approach would be to simply use data to server functionality with an external MQTT broker, such as HiveMQ or Flespi. Also, data to server has an option called ‘retry on fail’ which will essentially allow the device to accumulate collected Modbus data if the connection to the broker is lost. Once the connection is restored, the device will send all accumulated data to the broker. This way, you will have a single central broker, there will be no need to configure brokers on different devices and everything will be availbe on that broker. The configurations will also be simpler, and new devices can easily be added into your solution.
This topic was automatically closed after 15 days. New replies are no longer allowed.