Send RS485 to remote MQTT broker using TRB245

Hi, my use case is as follows: I have a QR code scanner connected to RS485 on a TRB245. Whenever a scan is done, the data should be sent in realtime to a remote MQTT broker. How can I do this? I’ve tried all combinations of modbus client/server/ setups but nothing is working. I have confirmed using CLI that the device is working correctly and I am receiving the data in the console.

Hello,

Apologies for the delayed response.

Would it be possible for you to explain what kind of scanner are you using? What protocols does it support?

You mentioned Modbus. Does you scanner support it?

Can the scanner be configured in any way?

Kind Regards,

Currently using the CLI command ‘cat /dev/RS485’ whenever I scan a qr code it displays the result as a text string - which is what I want. So my console configuration is correct. But now how to publish this text string to an MQTT Broker, this is the question.

Hello,

Could you please tell me the model of the scanner?

Does it just output data/strings? Its not Modbus RTU, is it?

Kind Regards,

its the NEDAP Nvite, and on the datasheet it says:

I think it’s only RS485 over serial.

actually it can be configured to output hex or decimals if needed:

Hello,

Apologies for the delayed response.

In this case, functioalities like Modbus, MQTT broker/publisher, or Data to Server will not be an option.

I would suggest writing a script that will get data from /dev/rs485 and send it via MQTT to your broker. To send data to MQTT within your script, you can use mosquitto. Please, take a look at this post here. You can also find different script examples on this forum using search functionality (ChatGPT can also help!). Make sure to disable all RS485 services that you may have configured on the device so that it can be used in your script

Another option is to send data to some other server over TCP, and then forward it your MQTT broker from that server. For this, you can use the Serial over IP fucntionality. This will allow you to forward all data from RS485 towards your server via TCP/IP.

Kind Regards,