Message Queuing Telemetry Transport (MQTT) is a lightweight, publish-subscribe network protocol designed for efficient machine-to-machine communication in constrained environments with low bandwidth, high latency, or unreliable networks. It operates over TCP/IP and uses a central broker to route messages between clients, which publish messages to topics or subscribe to them to receive updates. This decoupled architecture minimizes network overhead and power consumption, making it ideal for microcontroller-based Internet of Things (IoT) and TinyML deployments where devices transmit sensor telemetry or receive model updates.
Glossary
Message Queuing Telemetry Transport (MQTT)

What is Message Queuing Telemetry Transport (MQTT)?
A core protocol for machine-to-machine communication in constrained environments, essential for TinyML deployment pipelines.
In TinyML MLOps, MQTT facilitates over-the-air (OTA) updates and remote monitoring by enabling microcontrollers to publish inference results or system health metrics and subscribe to channels distributing new model binaries or configuration files. Its Quality of Service (QoS) levels guarantee message delivery, which is critical for reliable fleet orchestration. The protocol's minimal packet size and persistent session support align with the offline-first operation and power constraints of edge devices, forming a backbone for scalable, bidirectional communication in distributed intelligent systems.
Key Features of MQTT
MQTT is engineered for constrained environments. Its core features prioritize minimal overhead, reliable message delivery, and efficient network utilization, making it the de facto standard for IoT and TinyML telemetry.
Publish/Subscribe Pattern
MQTT uses a publish/subscribe messaging pattern, decoupling data producers (publishers) from consumers (subscribers) via a central broker. Devices publish messages to topics (e.g., sensor/device123/temperature), and clients subscribe to topics of interest. This enables:
- One-to-many distribution: A single message can be efficiently delivered to many subscribers.
- Dynamic scalability: New subscribers can join without reconfiguring publishers.
- Network efficiency: Clients only receive data they explicitly request, reducing wasted bandwidth.
Quality of Service (QoS) Levels
MQTT defines three Quality of Service (QoS) levels to guarantee message delivery across unreliable networks:
- QoS 0 (At most once): Fire-and-forget. No acknowledgment. Lowest overhead, potential for message loss.
- QoS 1 (At least once): Acknowledged delivery. The sender stores and retransmits the message until an acknowledgment (PUBACK) is received. Guarantees delivery but may cause duplicates.
- QoS 2 (Exactly once): Assured delivery. A four-step handshake ensures the message is delivered precisely once. Highest reliability but greatest overhead. This allows developers to trade off reliability for latency and bandwidth based on use case.
Lightweight Packet Structure
The protocol uses a compact, binary packet format with a minimal 2-byte fixed header. This extreme efficiency is critical for:
- Low-bandwidth networks (e.g., cellular LPWAN, satellite).
- High-latency connections where large headers add significant delay.
- Battery-powered devices where every transmitted byte consumes energy. For example, a simple publish message can be as small as 10-20 bytes, compared to hundreds of bytes for an HTTP request with headers.
Persistent Sessions & Last Will and Testament
MQTT supports persistent sessions where the broker stores subscriptions and missed messages (for QoS 1/2) for a disconnected client. Upon reconnection, the session resumes. The Last Will and Testament (LWT) is a critical feature for device health monitoring. When a client connects, it can define a pre-configured LWT message and topic. If the client disconnects ungracefully (e.g., network failure), the broker automatically publishes the LWT message, alerting the system to the device's offline state.
Topic Wildcards
Topic subscriptions support two wildcards for flexible filtering:
- Single-level (
+): Matches any name in a single topic level. Example:sensor/+/temperaturesubscribes tosensor/device1/temperatureandsensor/device2/temperaturebut notsensor/device1/humidity/temperature. - Multi-level (
#): Matches all subsequent levels. Must be the last character in the subscription. Example:sensor/device1/#subscribes to all subtopics underdevice1. This allows a single client to efficiently subscribe to data from entire device fleets or sensor hierarchies.
Keep Alive & Clean Session
The Keep Alive interval is a heartbeat mechanism. The client sends periodic PINGREQ packets to inform the broker it's alive. If the broker receives no packet within 1.5x the interval, it assumes the client is dead and can trigger its LWT.
The Clean Session flag controls persistence. If true, the broker creates a new, transient session for the client (no state preserved). If false, the broker attempts to resume a previous persistent session, delivering any queued messages. This is essential for stateful TinyML deployments where inference results must be guaranteed.
How MQTT Works: The Publish-Subscribe Mechanism
Message Queuing Telemetry Transport (MQTT) is a lightweight, publish-subscribe network protocol designed for efficient machine-to-machine communication in constrained environments with low bandwidth and high latency.
MQTT operates on a publish-subscribe (pub/sub) architecture, decoupling data producers (publishers) from consumers (subscribers) via a central broker. Devices publish messages to specific topics (e.g., sensor/temperature/room1), and the broker routes these messages to all clients that have subscribed to those topics. This model eliminates the need for direct point-to-point connections, enabling efficient one-to-many communication and dynamic scaling. The protocol uses a small header and accepts binary payloads to minimize network overhead, making it ideal for TinyML and IoT deployments on microcontrollers.
The protocol ensures reliable message delivery through Quality of Service (QoS) levels: QoS 0 (at most once), QoS 1 (at least once), and QoS 2 (exactly once). It maintains persistent sessions with Last Will and Testament (LWT) messages to notify other clients of an unexpected disconnect. For secure deployments, MQTT can operate over TLS/SSL and supports username/password authentication. Its minimal footprint and efficient handling of intermittent connectivity make it a cornerstone for over-the-air (OTA) updates and telemetry aggregation in distributed edge AI fleets.
MQTT Use Cases in TinyML and IoT
Message Queuing Telemetry Transport (MQTT) is a lightweight, publish-subscribe network protocol designed for efficient machine-to-machine communication in constrained environments with low bandwidth and high latency. Its core principles make it the de facto standard for connecting TinyML devices to the cloud.
Over-the-Air (OTA) Model Updates
MQTT enables secure, targeted model distribution to microcontroller fleets. A model registry service publishes a new model binary to a topic like fleet/device-type-a/model/update. Devices subscribed to that topic receive the update payload. Quality of Service (QoS) levels guarantee delivery:
- QoS 0 (At most once): For non-critical updates in high-loss environments.
- QoS 1 (At least once): Ensures delivery, used for most model updates.
- QoS 2 (Exactly once): For critical firmware or model updates where duplication is unacceptable.
This integrates with canary deployment by publishing updates to a canary subtopic first.
Remote Inference Triggering & Configuration
Instead of continuous streaming, MQTT allows command-and-control messaging to trigger on-device inference or reconfigure models. A cloud application publishes a command to a device-specific command topic (e.g., device/SN12345/command/infer). The device executes its local TinyML model and publishes the result back to a report topic.
- Configuration Management: Publish new model parameters (thresholds, sampling rates) via
configtopics to dynamically tune device behavior without a full OTA update. - Power Optimization: Enables edge intelligence where devices sleep deeply, waking only to check for commands on retained messages, drastically extending battery life.
Health Monitoring & Alerting
TinyML devices use MQTT to publish device telemetry and model performance metrics, forming the backbone of MLOps for microcontrollers. Standard topics include:
$SYS-style topics for broker/client metrics.device/health/battery: Reports state of charge.device/model/confidence: Streams prediction confidence scores for model monitoring.device/alert/anomaly: Publishes immediate alerts when an on-device anomaly detection model triggers.
This creates a real-time audit trail of device and model health, enabling proactive maintenance and detection of model drift in edge conditions.
Federated Learning Coordination
In federated edge learning scenarios, MQTT orchestrates the decentralized training process across a fleet. The central server publishes the initial global model weights to a federated/round/start topic. Devices perform local training on their sensor data and publish only the weight updates (gradients) to a secure, device-specific topic. The server aggregates these updates to improve the global model.
- Privacy-Preserving: Raw sensor data never leaves the device.
- Efficient for Constrained Networks: Only small mathematical updates are transmitted, not large datasets.
- Handles Intermittency: The Last Will and Testament (LWT) feature can notify the server if a device drops out mid-round.
Gateway-to-Cloud Bridge for LPWAN
MQTT acts as the protocol bridge between local Low-Power Wide-Area Network (LPWAN) protocols (like LoRaWAN or Zigbee) and the internet. A gateway device aggregates data from many radios, translates it, and publishes it to an MQTT broker via cellular or Ethernet. This provides:
- Unified Data Plane: Heterogeneous sensor data is normalized into MQTT topics for cloud processing.
- Reliability: The broker's persistent sessions and retained messages ensure no data is lost if the cloud service restarts.
- Interoperability: Decouples the choice of edge radio protocol from the cloud backend architecture.
MQTT vs. Other IoT Communication Protocols
A technical comparison of MQTT against other common protocols used for machine-to-machine communication in constrained IoT and TinyML environments.
| Feature / Metric | MQTT | HTTP/1.1 | CoAP | AMQP |
|---|---|---|---|---|
Primary Communication Pattern | Publish/Subscribe | Request/Response | Request/Response & Observe | Publish/Subscribe & Point-to-Point |
Transport Protocol | TCP/IP | TCP/IP | UDP/IP | TCP/IP |
Header Overhead (Typical) | < 10 bytes |
| < 10 bytes |
|
Quality of Service (QoS) Levels | 3 (0,1,2) | 0 (Relies on TCP) | 2 (Confirmable/Non-confirmable) | 3 (At-most-once, At-least-once, Exactly-once) |
Built-in Last Will & Testament | ||||
Session State Awareness | ||||
Native Support for Binary Data | ||||
Typical Power Consumption | Low | High | Very Low | Medium |
Latency (Typical, LAN) | < 10 ms |
| < 10 ms | < 20 ms |
Standard Port | 1883 (8883 for TLS) | 80 (443 for TLS) | 5683 (5684 for DTLS) | 5672 (5671 for TLS) |
IETF Standard | Yes (v5: RFC 9326) | Yes (RFC 9110-9112) | Yes (RFC 7252) | Yes (v1.0: ISO/IEC 19464) |
Ideal Use Case | Telemetry from constrained devices, bi-directional command/control | Web APIs, device management where HTTP is mandated | Very constrained sensor nodes (e.g., 6LoWPAN), simple GET/POST | Enterprise messaging, complex routing, financial transactions |
Frequently Asked Questions
Message Queuing Telemetry Transport (MQTT) is a foundational protocol for machine-to-machine communication in constrained environments. These FAQs address its core mechanics, security, and role in TinyML deployment pipelines.
Message Queuing Telemetry Transport (MQTT) is a lightweight, publish-subscribe messaging protocol designed for efficient machine-to-machine (M2M) communication in constrained environments with low bandwidth, high latency, or unreliable networks. It operates on a central broker model where clients connect as publishers, subscribers, or both. A publisher sends a message (a payload) to a specific topic (a hierarchical string like sensor/device123/temperature). The broker receives the message and forwards it to all clients that have subscribed to that topic. This decouples the data producers from the consumers, enabling scalable and flexible communication for IoT and edge computing systems.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
MQTT is a core protocol for device communication in TinyML systems. These related concepts define the operational pipeline for managing microcontroller fleets.
Over-the-Air (OTA) Update
A method for wirelessly distributing new firmware or machine learning models to remote microcontroller fleets. In TinyML, OTA updates are critical for deploying model improvements and security patches without physical recall.
- Key Mechanism: Uses protocols like MQTT to push update packages and receive confirmation.
- Challenge: Must be robust for low-bandwidth, intermittent connections common in IoT.
- Security Imperative: Updates must be cryptographically signed to prevent malicious code execution.
Real-Time Operating System (RTOS)
An operating system designed for deterministic, time-critical applications on resource-constrained hardware. For TinyML, an RTOS provides the scheduling and task management needed to run inference loops alongside sensor polling and MQTT communication.
- Determinism: Guarantees task completion within a defined timeframe, essential for real-time sensor processing.
- Memory Footprint: Typically requires only kilobytes of RAM, fitting microcontroller constraints.
- Integration: Often includes built-in MQTT client libraries and network stacks.
Device Authentication
The process of verifying the identity of a microcontroller or IoT device before it is allowed to connect to a network and publish/subscribe via MQTT. This is a foundational security layer for TinyML fleets.
- Common Method: Uses X.509 certificates or pre-shared keys embedded in device firmware.
- Prevents Spoofing: Ensures telemetry data originates from a trusted source.
- Broker Enforcement: The MQTT broker validates credentials during the CONNECT packet handshake.
Offline-First Operation
A system design principle where a TinyML device is built to perform its core functions (e.g., inference, local logging) without a network connection. MQTT is used for synchronization when connectivity is restored.
- Core Logic: Inference and decision-making run locally on the microcontroller.
- Queue-and-Forward: Telemetry data is stored in a local buffer and published via MQTT when a connection is available.
- Resilience: Critical for applications in areas with poor or intermittent cellular/Wi-Fi coverage.
Digital Signature
A cryptographic mechanism used to verify the authenticity and integrity of software, firmware, or machine learning models. In TinyML MLOps, digital signatures secure OTA updates and model artifacts transmitted over MQTT.
- Process: The sender signs the data with a private key; the device verifies it with a corresponding public key.
- Guards Against Tampering: Ensures an update package has not been altered in transit.
- Non-Repudiation: Provides proof of the update source, which is vital for audit trails.
Remote Diagnostics
The capability to monitor, analyze, and troubleshoot deployed TinyML devices from a central location. MQTT topics are commonly used to stream diagnostic telemetry (e.g., heap memory, inference latency) and to receive remote commands.
- Telemetry Channels: Devices publish health metrics to dedicated MQTT topics.
- Command & Control: The backend can subscribe to send commands (e.g., reset, change log level) to specific devices.
- Proactive Maintenance: Enables detection of issues like memory leaks or sensor drift before they cause failures.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us