Modbus, OPC UA and MQTT: Connecting Industrial Equipment to the Cloud

Factory equipment is rarely designed with the cloud in mind. A typical site has PLCs, drives and meters speaking Modbus, newer machines offering OPC UA, and a growing number of systems publishing over MQTT. Connecting them is less about any one protocol than how the three fit together: what reads the equipment, what gives the data meaning, and what carries it off site. This article covers each role.

At a glance

502
The TCP port registered for Modbus TCP. Modbus RTU runs over serial lines, usually RS-485.
16-bit
The size of a Modbus register. Larger values and floats span two or more registers.
4840
The port registered for OPC UA over its binary TCP protocol.
IEC 62541
The international standard series that defines OPC UA.

The problem

Modbus is simple and everywhere, but it carries only numbers at addresses. Whether holding register 40010 is a temperature in tenths of a degree or a fault code lives in a manual, and word order for 32-bit values differs between vendors. Classic Modbus has no authentication or encryption.

Sending raw register values to the cloud moves the problem rather than solving it. Every consumer then needs the device map, and a firmware change on one machine silently corrupts downstream dashboards.

Read with the protocol the machine speaks, model the data once at the edge, and publish it with meaning attached.

A common architecture

An edge gateway polls Modbus devices and reads OPC UA servers on the plant network, converts raw values into named, scaled tags with units and timestamps, and publishes them over MQTT with TLS. The plant keeps its existing protocols, and the only external link is one encrypted session opened from inside.

OPC UA already carries an information model, security and certificates, so it can serve as the semantic layer, and its PubSub specification can run over MQTT. For plain MQTT, the Eclipse Sparkplug specification defines topics, payload encoding and device state, avoiding a new naming scheme per project.

What good looks like

Survey the equipment: protocol, physical interface, register map or OPC UA address space, and how often each value is really needed.

Define the tag model once: names, units, scaling, data types and quality flags, and map every source to it at the gateway.

Agree network security with site IT and OT staff: segmentation, outbound-only connections and certificate management for OPC UA and MQTT.

Three protocols, three roles
ProtocolTransportData modelSecurity
Modbus RTUSerial, usually RS-485Coils and 16-bit registersNone built in
Modbus TCPTCP, port 502Coils and 16-bit registersNone built in; a TLS variant exists
OPC UATCP, port 4840; also PubSubTyped, structured information modelBuilt in: certificates, signing, encryption
MQTTTCP, port 8883 with TLSUser defined, or SparkplugTLS and broker authentication
Registered default ports. Sites may use others.
The Modbus data model
ObjectSizeAccessTypical use
Coil1 bitRead and writeOutputs, enable flags
Discrete input1 bitRead onlyDigital inputs, status bits
Input register16 bitsRead onlyMeasurements
Holding register16 bitsRead and writeSetpoints, configuration, often measurements too
From the Modbus application protocol specification. How devices use each table varies by vendor.

What it changes

Meaningful Data

Cloud systems receive named, scaled values rather than raw register numbers.

Plant Safety

Control networks stay segmented, with no inbound connections from outside.

Scalability

New machines are added by mapping them to the existing tag model.

Vendor Neutrality

Open protocols keep data usable across equipment brands and platforms.

Where to go next

Poll Modbus devices only as fast as the data changes. Many serial devices respond slowly, and aggressive polling on a shared RS-485 bus delays everything on it.

Where equipment supports it, prefer OPC UA to Modbus. It carries data types, units and structure that otherwise must be documented by hand.

Problems this prevents

  • Register maps that live only in a manual
  • Inbound connections into the control network
  • Scaled values misread downstream
  • A serial bus overloaded by polling

Discuss your project

Email support@aavico.com or use Get in Touch when the website finishes loading.