Skip to content
Of Ash and Fire Logo

OPC UA vs MQTT: Choosing the Right Protocol for Factory Floor Data

A technical comparison of OPC UA and MQTT for industrial data communication. Understand security models, scalability, use cases, and when to use each...

9 min read
OPC UAMQTTindustrial protocolfactory automationIIoTmanufacturing dataprocess automation

When designing Industrial IoT (IIoT) architectures, one of the most consequential decisions is selecting communication protocols. The two dominant standards—OPC UA and MQTT—take fundamentally different approaches to industrial data exchange.

OPC UA (Open Platform Communications Unified Architecture) is the industrial automation standard, designed specifically for factory floor and process control environments. MQTT (Message Queuing Telemetry Transport) is a lightweight publish/subscribe protocol originally developed for constrained devices and unreliable networks.

Both have their place in modern IIoT systems. The question isn't which is "better," but which fits your specific requirements—and when using both together makes the most sense.

This article provides a technical comparison to help you make informed protocol decisions.

OPC UA: The Industrial Standard

Architecture and Design Philosophy

OPC UA was designed by the OPC Foundation specifically for industrial automation. It's a comprehensive specification covering:

  • Client/server and publish/subscribe communication patterns
  • Rich data modeling (variables, methods, events, historical data)
  • Built-in security (authentication, encryption, authorization)
  • Platform independence (works on Windows, Linux, embedded systems)
  • Vertical integration (field devices to enterprise systems)

OPC UA is not just a protocol—it's an entire framework for industrial data exchange.

Key Capabilities

Rich Data Models: OPC UA represents industrial data as an information model with defined relationships. A motor isn't just a collection of values (speed, temperature, vibration); it's an object with properties, methods (start, stop), and alarms.

This semantic richness means applications understand what the data represents, not just its raw value.

Type Safety: OPC UA enforces data types. A temperature reading is defined as a Float with engineering units (°C or °F), not just a string that might be "72.3" or "offline" depending on device state.

Built-In Security: OPC UA mandates security:

  • Application authentication via certificates
  • User authentication (username/password, certificates, tokens)
  • Message signing to detect tampering
  • Encryption for confidentiality

Security isn't bolted on; it's fundamental to the specification.

Discovery and Browsing: Clients can discover OPC UA servers on the network and browse their information models dynamically. This self-describing capability simplifies integration—you don't need to hard-code every tag address.

Historical Data Access: OPC UA defines standard interfaces for querying historical data, not just real-time values. This is critical for analytics and reporting.

When to Use OPC UA

SCADA and MES Integration: If you're connecting PLCs, DCS systems, or HMI software, OPC UA is the expected standard. Most industrial automation vendors (Siemens, Rockwell, Schneider Electric) provide OPC UA servers.

Complex Device Modeling: When device relationships and capabilities need to be expressed (e.g., a packaging line with multiple stations, each with sensors and actuators), OPC UA's information modeling excels.

Vertical Integration: OPC UA is designed to span from field devices to enterprise systems. If data flows from sensors to PLCs to MES to ERP, OPC UA provides a consistent protocol throughout.

Security Requirements: Regulated industries (pharmaceuticals, food processing) with strict data integrity and authentication requirements benefit from OPC UA's comprehensive security model.

OPC UA Limitations

Complexity: OPC UA's richness comes with complexity. Implementing a full OPC UA server is non-trivial. Libraries and SDKs help, but there's still a learning curve.

Resource Requirements: OPC UA requires more memory and processing power than lightweight protocols. This is fine for PLCs and industrial PCs but can be prohibitive for constrained edge devices.

Bandwidth: The comprehensive information models and security overhead mean OPC UA messages are larger than minimal protocols. This matters on low-bandwidth networks (cellular, LoRaWAN).

MQTT: The Lightweight Alternative

Architecture and Design Philosophy

MQTT was designed for unreliable, low-bandwidth networks connecting resource-constrained devices. Its design goals:

  • Minimal overhead (2-byte header minimum)
  • Publish/subscribe pattern (decoupled senders and receivers)
  • Quality of Service levels (fire-and-forget, at-least-once, exactly-once)
  • Last Will and Testament (automatic notification when clients disconnect unexpectedly)

MQTT is simple by design. It doesn't define data formats, information models, or semantics—just a reliable way to move bytes between publishers and subscribers.

Key Capabilities

Publish/Subscribe Decoupling: Publishers send messages to topics (e.g., factory/line1/motor/temperature). Subscribers listen to topics. Publishers and subscribers don't need to know about each other, simplifying dynamic systems.

Quality of Service (QoS):

  • QoS 0: Message delivered at most once (fire-and-forget, lowest overhead)
  • QoS 1: Message delivered at least once (may be duplicated)
  • QoS 2: Message delivered exactly once (highest overhead)

Choose the QoS that matches your requirements. Sensor readings might tolerate occasional loss (QoS 0), while alarm notifications require guaranteed delivery (QoS 1 or 2).

Lightweight: MQTT clients can run on microcontrollers with 64KB of RAM. This makes MQTT ideal for battery-powered sensors, embedded devices, and edge gateways.

Broker-Based: The MQTT broker (server) handles routing, persistence, and QoS guarantees. Popular brokers include Mosquitto (open-source), HiveMQ, and AWS IoT Core.

Scalability: MQTT brokers can handle millions of concurrent clients and topics, making it suitable for large-scale deployments (thousands of sensors across multiple facilities).

When to Use MQTT

Edge-to-Cloud Communication: MQTT is ideal for sending data from factory edge gateways to cloud platforms (AWS IoT, Azure IoT Hub, Google Cloud IoT). Its lightweight nature minimizes cellular bandwidth costs.

Resource-Constrained Devices: Battery-powered sensors, low-cost microcontrollers, and embedded devices benefit from MQTT's minimal footprint.

Unreliable Networks: MQTT was designed for intermittent connectivity. It handles network interruptions gracefully, buffering messages during outages and resuming when connectivity returns.

Many-to-Many Communication: When multiple publishers send data to multiple subscribers (e.g., dozens of sensors feeding several analytics applications), MQTT's pub/sub model simplifies architecture.

Rapid Prototyping: MQTT's simplicity accelerates development. You can have a working prototype in hours rather than days.

MQTT Limitations

No Built-In Security: While MQTT 3.1.1 supports TLS encryption and username/password authentication, it doesn't mandate them. Many deployments skip encryption, leaving data vulnerable.

MQTT 5.0 improves this with enhanced authentication mechanisms, but it's still less comprehensive than OPC UA's security model.

No Defined Data Models: MQTT just moves bytes. You must define your own data formats (JSON, Protobuf, binary). There's no standard way to describe what a topic represents or what data types it contains.

No Discovery: Clients must know topic names in advance. There's no standard mechanism to browse available topics or understand their structure.

Limited Querying: MQTT provides real-time data streaming but doesn't define interfaces for historical data access. If you need to query "What was the temperature at 3 PM yesterday," you need a separate time-series database.

Technical Comparison

Feature OPC UA MQTT
Communication Pattern Client/server + Pub/sub Publish/subscribe
Data Modeling Rich information models None (just byte payloads)
Security Mandatory certificates, encryption Optional TLS, basic auth
Message Size Larger (richer metadata) Minimal (2-byte header)
Resource Requirements Moderate to high Very low
Discovery Built-in browsing None
Historical Data Standardized access Not defined
QoS Reliable TCP 3 levels (0, 1, 2)
Typical Use Case SCADA, MES, device integration Sensor data, edge-to-cloud
Maturity Industrial standard (20+ years) Proven (MQTT 3.1.1), evolving (MQTT 5.0)

Hybrid Architectures: Using Both

Many modern IIoT systems use both protocols:

Factory Floor: OPC UA

  • PLCs and SCADA systems communicate via OPC UA
  • Rich data models describe equipment and processes
  • Local HMI and MES systems use OPC UA clients to interact with devices

Edge-to-Cloud: MQTT

  • An edge gateway subscribes to OPC UA servers and extracts relevant data
  • The gateway publishes to MQTT topics on a cloud broker
  • Cloud analytics, dashboards, and AI/ML services subscribe to MQTT topics

This architecture leverages each protocol's strengths:

  • OPC UA for local control, semantic richness, and SCADA integration
  • MQTT for scalable, lightweight cloud communication

Example: Manufacturing Line Monitoring

  1. PLCs on a packaging line expose data via OPC UA servers (motor speeds, conveyor sensors, quality inspection results)

  2. Edge Gateway (industrial PC or embedded device) runs an OPC UA client that subscribes to relevant tags

  3. Data Transformation: The gateway converts OPC UA data to JSON and publishes to MQTT topics:

    • factory/line1/motor1/speed
    • factory/line1/quality/defect_count
  4. Cloud Subscribers:

    • Real-time dashboard subscribes to MQTT topics for live visualization
    • Analytics service processes data for predictive maintenance
    • ERP integration subscribes to production count topics

This hybrid approach provides local control and rich semantics where needed (OPC UA) and scalable, cloud-friendly communication where appropriate (MQTT).

Real-World Decision Framework

Ask these questions to guide protocol selection:

1. What Are You Connecting?

  • Industrial equipment (PLCs, SCADA): OPC UA is the standard
  • Custom sensors or edge devices: MQTT offers simplicity and low overhead

2. Where Is the Data Going?

  • Local systems (HMI, MES): OPC UA
  • Cloud platforms: MQTT (or OPC UA over MQTT for MQTT 5.0)

3. How Complex Is Your Data Model?

  • Rich relationships and semantics: OPC UA's information modeling is valuable
  • Simple sensor readings: MQTT with JSON is sufficient

4. What Are Your Security Requirements?

  • Regulated industries with strict compliance: OPC UA's comprehensive security
  • General monitoring and analytics: MQTT with TLS is adequate

5. What Are Your Network Constraints?

  • Reliable, high-bandwidth local network: Either protocol works
  • Cellular or unreliable connections: MQTT's efficiency and resilience

6. What's Your Team's Expertise?

  • Industrial automation background: OPC UA will feel familiar
  • Web/cloud development background: MQTT's simplicity accelerates development

Standards and Interoperability: MQTT Over OPC UA

Recognizing the value of both protocols, the OPC Foundation has defined OPC UA PubSub over MQTT. This allows OPC UA's rich information models to be transported via MQTT's efficient publish/subscribe mechanism.

This emerging standard combines:

  • OPC UA's semantic data modeling
  • MQTT's scalability and efficiency

Adoption is still growing, but it represents a promising convergence of the two approaches. For more on implementing IIoT architectures, see our comprehensive guide: Industrial IoT for Manufacturing: A Practical Implementation Guide.

Conclusion

OPC UA and MQTT are complementary, not competing. OPC UA excels at industrial device integration, semantic richness, and comprehensive security. MQTT excels at lightweight edge-to-cloud communication, scalability, and simplicity.

Successful IIoT deployments often use both:

  • OPC UA for local factory floor communication and SCADA integration
  • MQTT for streaming data to cloud analytics and enterprise systems
  • Edge gateways to bridge between the two

The protocol you choose should match your specific requirements—devices, data models, network constraints, and security needs. Don't force-fit a protocol because it's "modern" or "standard." Understand your use case and choose accordingly.

Designing an IIoT architecture and unsure which protocol fits your requirements? Contact Of Ash and Fire to discuss a tailored approach for your manufacturing environment.

Ready to Ignite Your Digital Transformation?

Let's collaborate to create innovative software solutions that propel your business forward in the digital age.