EOFFJM
Posts: 22
Joined: Thu Jan 24, 2019 6:23 pm

OPCUA, Modbus TCP, or MQTT for controller

Tue Feb 05, 2019 3:01 pm

Hi

I would like to establish communciation between a rasppi used as a controller and 4 other rasppi as interfaces to digital input/outputs. The communication between the interface rasppis and the digital I/Os will be done via I2C.
What do you recommend I use for the communiation between controller rasppi and the interface rasppis?
OPCUA, Modbus TCP, or MQTT?
Is it normal to use OPC UA for controllers? I heard it was used mostly for monitoring data in the plant and not for controls.

Thanks.

Andyroo

Re: OPCUA, Modbus TCP, or MQTT for controller

Tue Feb 05, 2019 4:30 pm

The simplest way is to use MQTT - very little set up required for testing, easy to follow and data can be accessed on other PC / Macs for debugging without impacting the live system.

Things to think about though:

1) By default you have one broker - if this is down you are in deep do-do - see this post for info
2) Neither MQTT or the Pi are 100% suitable for time critical application - the messages run at network speeds on a multi-user operating system. This may give you issues
3) QOS - this could be vital - depends how things fail. i.e. are there fail safe states you need?
4) MODBUS was originally serial and could be driven a long long distance - do you have network ports everywhere with resilient links?
5) OP CUA and MODBUS may give you an option to talk directly with controllers where as MQTT is more computer to computer - is this going to be an issue long term?

EOFFJM
Posts: 22
Joined: Thu Jan 24, 2019 6:23 pm

Re: OPCUA, Modbus TCP, or MQTT for controller

Tue Feb 05, 2019 6:38 pm

Andyroo wrote:
Tue Feb 05, 2019 4:30 pm
The simplest way is to use MQTT - very little set up required for testing, easy to follow and data can be accessed on other PC / Macs for debugging without impacting the live system.

Things to think about though:

1) By default you have one broker - if this is down you are in deep do-do - see this post for info
2) Neither MQTT or the Pi are 100% suitable for time critical application - the messages run at network speeds on a multi-user operating system. This may give you issues
3) QOS - this could be vital - depends how things fail. i.e. are there fail safe states you need?
4) MODBUS was originally serial and could be driven a long long distance - do you have network ports everywhere with resilient links?
5) OP CUA and MODBUS may give you an option to talk directly with controllers where as MQTT is more computer to computer - is this going to be an issue long term?
Thanks.
I think I won't use MQTT because I want more than 1 broker.
Which do you recommend between OPCUA and Modbus TCP? Is one of them better for time critical application? I have network ports everywhere with resilient links.

Andyroo

Re: OPCUA, Modbus TCP, or MQTT for controller

Tue Feb 05, 2019 9:13 pm

Depends what development tool / language you have skills in.

I know Python has a MODBUS TCP module for reading and writing https://pypi.org/project/pyModbusTCP/ BUT:
a) I have never tried it
b) I do not know if it lets you emulate a MODBUS device

There is https://github.com/FreeOpcUa/python-opcua for PO CUA but:
1) I have never tried it
2) It says it is is 'quasi complete'

To be honest I've just about completed conversion to MQTT at anything equal to or better than a Pi zero - if I was worried about the stability of brokers I would ask here or look at a professional broker from Hive and run it on something other than a Pi.

If I was bothered I would put my MQTT publish into one function and if the write to the first broker failed switch over to the second (and vice-versa). If both failed I would pack up and go home.

EOFFJM
Posts: 22
Joined: Thu Jan 24, 2019 6:23 pm

Re: OPCUA, Modbus TCP, or MQTT for controller

Tue Feb 05, 2019 9:48 pm

Andyroo wrote:
Tue Feb 05, 2019 9:13 pm
Depends what development tool / language you have skills in.

I know Python has a MODBUS TCP module for reading and writing https://pypi.org/project/pyModbusTCP/ BUT:
a) I have never tried it
b) I do not know if it lets you emulate a MODBUS device

There is https://github.com/FreeOpcUa/python-opcua for PO CUA but:
1) I have never tried it
2) It says it is is 'quasi complete'

To be honest I've just about completed conversion to MQTT at anything equal to or better than a Pi zero - if I was worried about the stability of brokers I would ask here or look at a professional broker from Hive and run it on something other than a Pi.

If I was bothered I would put my MQTT publish into one function and if the write to the first broker failed switch over to the second (and vice-versa). If both failed I would pack up and go home.

Thanks for the reply and the links. I will try one of the options.

Return to “Automation, sensing and robotics”