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.
+1 vote
1,429 views 4 comments
by anonymous
Hi,

I would like to send data from my TRB245 RS485 connected Modbus device via MQTT to cloud broker.

This would be one way communication so there won't be any MODBUS register writes - only reads.

Should I use MQTT gateway or use a Data to Server (MQTT) feature ?

Not sure If I can use MQTT gateway ? Couldn't get this working - it does not take data from my MODBUS Serial Master service.

If yes, how do these features differ ?

How often does MQTT gateway send data? Is data queued if there is a problem with cloud broker connection?

I assume if using a Send data to Server feature data is written and purged when successfully sent depending on the Data to Server settings?

Thanks,

Robert
by anonymous

You write:
I would have my RUT956 poll my serial modbus device for x registers (successfully accomplished), then configure the RUT956 to publish that data to an external broker over the modem connection....At first I thought that would be set up using the modbus gateway function until I realized that that was to actually poll devices from an MQTT client/broker directly, not publish/subscribe to IO for the modbus registers.

I've been farting around all day and have not been able to read from a 485 device.
I saw one blip on the rs485 adapter LEDs and that's it.
I get a lot of "connection refused" "unexpected length of response"  (seems goofy not to show an actual byte count...  is the length zero ? is it too long ?)
Does the modbus TCP slave need to be disabled ?

by anonymous

Now I'm getting a bizzarre 12000 character limit message

on comments which are 11500 characters short of that limit

OK, I observed some late-stage "developments"
I switched the 485 connection polarity. (always a crap shoot whether A is - and B is + or reverse)

I configured RS485: as Over TCP Master

I am getting this traffic on the 485 wires as reported by ModbusSlave:

Rx:000229-00 23 00 00 00 06 02 03 1B 5D 00 02

Rx:000230-00 24 00 00 00 06 02 03 1B 5E 00 02

Rx:000231-00 25 00 00 00 06 02 03 03 E8 00 02
For some reason ModbusSlave is not replying to the queries
I tried RawMode on/off.

Because I am using non-standard port 503 for the RTU traffic,
I am not seeing any of the other TCP traffic on the 485

So it seems it is semi sort of almost working.
I'll connect the actual device and see if it responds 
and figure out ModbusSlave's brain damage later...

I notice that I can do the Test Configuration on the ModTCP connections and get data immediately.
 

I would prefer to change the "internal" ID to 11 and let the RTU devices use ID 1 but there seems to

be some mystery dependency on ID1 for the other modbus stuff to keep working.

If I can't resolve it I'll just cave and change the 485 device ID to 11 or 2

1 Answer

0 votes
by anonymous
Hello,

We do not have a option which will allow you to write back to serial modbus slave using MQTT gateway, but I have a work around which will solve the problem for you.
Navigate to services>rs232/rs485 and configure serial type to modbus gateway.
Now instead of polling modbus data from serial slave you can poll from modbus TCP master as gateway converts modbus rtu to modbus TCP.
And then use modbus gateway to write back to your slave which is modbus tcp slave now.

What wil be IP of my slave ?
It is trb245 IP address.

Test and let me know if this solves the issue.
by anonymous
The solution seems very convoluted for a typical use case.

I had the same idea as the initiator here when buying my RUT956 for testing;

I would have my RUT956 poll my serial modbus device for x registers (successfully accomplished), then configure the RUT956 to publish that data to an external broker over the modem connection....At first I thought that would be set up using the modbus gateway function until I realized that that was to actually poll devices from an MQTT client/broker directly, not publish/subscribe to IO for the modbus registers.

So, my next assumption then was that I would need to use any of the MQTT broker/client settings to accomplish this, but they had no referal to the modbus at all...so I was lost. Then I saw that the Data to Server had an MQTT option with Modbus data as the source...and tried that (MQTT package installed yes), but it never sends anything (a separate story is that the LTE modem gets kicked offline all the time as well even though the SIM works flawlessly on other 4G routers, but awaiting a solution to that I have been using LAN/WAN to test the MQTT option).

<Rant alert>
I think the GUI of the device would benefit from a redesign to fit various use cases. If the user want to publish some modbus registers polled by the serial master e.g. the configuration for that should be possible to find under the Modbus menu. The gateway functionality is OK in cases where you might need and want to actually expose the modbus inetrface from the MQTT side, but as long as you are really only interested in exposing in/out *values* that should be a separate "MQTT Publish/Subscribe from/to registers" option.

And for all types of connectivity it would have helped tremendously to have event/communication logs under each option. So when I try to figure out whether an MQTT publisher is actually trying to publish anything and why it fails I can look at that under the MQTT publish option...And when the modem is unable to keep a connection I would have a link under that modem interface that told me what is going on with that link :-)

With neither the modem nor the Modbus to MQTT publish functionality working I am about to move on to some other alternative device... :-(
by anonymous

You write:
I would have my RUT956 poll my serial modbus device for x registers (successfully accomplished), then configure the RUT956 to publish that data to an external broker over the modem connection....At first I thought that would be set up using the modbus gateway function until I realized that that was to actually poll devices from an MQTT client/broker directly, not publish/subscribe to IO for the modbus registers.

I've been farting around all day and have not been able to read from a 485 device.
I saw one blip on the rs485 adapter LEDs and that's it.
I get a lot of "connection refused" "unexpected length of response"  (seems goofy not to show an actual byte count...  is the length zero ? is it too long ?)
Does the modbus TCP slave need to be disabled ?