MQTT vs OPC UA vs Modbus: Choosing a Factory IoT Protocol
A plain-English comparison of Modbus, OPC UA and MQTT for factory IoT: how each works, where each fits, and how they combine in one architecture.
By CrimsonEdge Systems team
If you are connecting machines on a factory floor, you will quickly run into three names: Modbus, OPC UA and MQTT. They are often presented as competitors, but in a well-designed system they usually work together, each at a different layer.
Here's what each one does and how to choose.
The short answer
| Modbus | OPC UA | MQTT | |
|---|---|---|---|
| Best at | Reading simple values from existing devices | Rich, standard machine data models | Moving messages from many devices to many consumers |
| Pattern | Request/response (client polls server) | Client/server, plus PubSub | Publish/subscribe through a broker |
| Data model | Numbered registers, no meaning attached | Typed, self-describing information model | Up to you (or Sparkplug B) |
| Security | None built in | Built in: certificates, signing, encryption | TLS plus broker authentication |
| Typical place | Sensor, drive, meter, PLC | PLC, CNC, SCADA, MES | Gateway to plant or cloud |
Modbus: simple, everywhere, old
Modbus dates from 1979 and is still one of the most widely supported industrial protocols. It comes in two common forms:
- Modbus RTU over serial lines such as RS-485.
- Modbus TCP over Ethernet.
A client asks a device for the values in specific registers, and the device replies. The protocol defines coils, discrete inputs, input registers and holding registers, but it says nothing about what a register means. Register 40001 might be a temperature on one meter and a flow rate on another, so you always need the device's register map.
Use Modbus when you need to read values from existing PLCs, drives, energy meters or sensors that already support it.
WarningModbus has no authentication or encryption. Anyone on the same network can read, and potentially write, values. Keep Modbus on an isolated segment behind a gateway.
OPC UA: rich, secure, standard
OPC UA (IEC 62541) is the modern successor to classic OPC. Its main strength is the information model: a server doesn't just expose numbers; it exposes structured objects with types, units, and relationships, such as a machine with spindles, each with a speed and temperature. Industry groups publish standard models, called companion specifications, for many types of equipment.
It also has security built in, with application certificates, message signing and encryption.
Use OPC UA when you are connecting modern PLCs, CNCs, SCADA and MES systems that need to understand each other's data, or when a machine builder already provides an OPC UA server.
MQTT: lightweight, scalable messaging
MQTT is an OASIS standard publish/subscribe protocol. Devices publish messages to topics on a broker, and any application can subscribe to those topics. Publishers and subscribers never talk to each other directly.
Features that make it a good fit for IoT:
- Very small overhead, good for constrained devices and unreliable networks.
- Quality of service levels 0, 1 and 2 to trade speed against delivery guarantees.
- Retained messages and "last will" messages to signal when a device disconnects.
- Easy to scale: adding a new dashboard or database is just one more subscriber.
On its own, MQTT doesn't define what goes inside a message. Sparkplug B, an Eclipse Foundation specification, adds a standard topic layout, payload encoding and device state management for industrial use.
Use MQTT when you need to move data from many machines or sites to many consumers: dashboards, databases, cloud platforms and alerting tools.
How they fit together
In practice, a common architecture uses all three:
[Meters, drives, sensors] --Modbus--> [Edge gateway] --MQTT/TLS--> [Broker] --> Dashboards, database, cloud
[Modern PLC / CNC] --OPC UA--> [Edge gateway]
- Modbus reads values from simple or older devices.
- OPC UA reads structured data from modern controllers.
- The edge gateway translates both into a consistent format.
- MQTT distributes the data across the plant and to the cloud.
This keeps insecure protocols on the shop floor, gives every consumer one consistent data source, and lets you add new machines without rewiring everything above them.
TipAgree on a topic naming scheme before the first machine goes live, such as
site/area/line/machine/signal. Renaming topics after dashboards and reports depend on them is painful.
Questions to ask before you choose
- What do your existing devices support? Check manuals for Modbus or OPC UA before buying converters.
- Who consumes the data? One SCADA system or many tools across sites?
- How reliable is the network? MQTT and store-and-forward gateways handle flaky links well.
- What are your security requirements? Plan network segmentation and certificates from the start.
Need a hand?
CrimsonEdge Systems designs industrial IoT architectures and builds the gateways that connect Modbus and OPC UA devices to MQTT, dashboards and the cloud. Read our guide to retrofitting legacy machines, see our hardware integration services, or contact us.
Frequently asked questions
Is MQTT better than OPC UA?
They solve different problems. OPC UA describes machine data in a rich, standard information model and is strong for machine-to-machine and machine-to-SCADA communication. MQTT is a lightweight way to move messages from many devices to many consumers. Many systems use both.
Is Modbus still used?
Yes. Modbus is simple, open and supported by a huge number of PLCs, drives, meters and sensors. It is often the easiest way to read data from existing equipment, even when MQTT or OPC UA is used further up the stack.
Is Modbus secure?
Standard Modbus RTU and Modbus TCP have no built-in authentication or encryption. Keep Modbus devices on an isolated network segment and let a gateway translate the data into a secured protocol such as MQTT over TLS or OPC UA.
What is Sparkplug B?
Sparkplug is an Eclipse Foundation specification that runs on top of MQTT. It defines a standard topic structure, payload format and device state handling so that MQTT data from different vendors is consistent and self-describing.
- #industrial-iot
- #mqtt
- #opc-ua
- #modbus
- #manufacturing