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.
| Protocol | Transport | Data model | Security |
|---|---|---|---|
| Modbus RTU | Serial, usually RS-485 | Coils and 16-bit registers | None built in |
| Modbus TCP | TCP, port 502 | Coils and 16-bit registers | None built in; a TLS variant exists |
| OPC UA | TCP, port 4840; also PubSub | Typed, structured information model | Built in: certificates, signing, encryption |
| MQTT | TCP, port 8883 with TLS | User defined, or Sparkplug | TLS and broker authentication |
| Object | Size | Access | Typical use |
|---|---|---|---|
| Coil | 1 bit | Read and write | Outputs, enable flags |
| Discrete input | 1 bit | Read only | Digital inputs, status bits |
| Input register | 16 bits | Read only | Measurements |
| Holding register | 16 bits | Read and write | Setpoints, configuration, often measurements too |
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.