AdvancedTopic 87 of 104Electronics & Embedded
MQTT
Lightweight publish-subscribe protocol for IoT.
In depth
MQTT is a publish-subscribe protocol over TCP with brokers, topics, QoS 0/1/2, retained messages and last-will. Minimal overhead suits constrained devices and unreliable networks. Use TLS and authentication.
Key points
- Topic hierarchy home/room/temp
- Keep-alive
- Brokers: Mosquitto, EMQX
ExampleA sensor publishes 23.5 to farm/field1/temp; the dashboard subscribes.
What is MQTT?
Lightweight publish-subscribe protocol for IoT.
Why is it important to understand MQTT?
MQTT is a lightweight messaging protocol that suits sensors and devices with limited bandwidth and power.
What is a broker?
A server that receives messages from publishers and forwards them to subscribers that have registered interest in a topic.
What is a quality of service level in MQTT?
A setting that controls message delivery guarantees, from at most once up to exactly once, which trades reliability for overhead.
How is MQTT used in practice?
Typical applications include publishing sensor readings from many devices to a central broker, subscribing a dashboard to temperature topics for live charts and sending commands to a device using a topic it listens to.
What should I learn before MQTT?
Study "Internet of Things" first (topic 86 of 104 in Electronics & Embedded). It covers the groundwork this topic builds on.
What are the key points of MQTT?
Topic hierarchy home/room/temp. Keep-alive. Brokers: Mosquitto, EMQX.
Can you give an example of MQTT?
A sensor publishes 23.5 to farm/field1/temp; the dashboard subscribes.
What comes after MQTT?
The next topic is "Edge computing", which builds directly on this one.
How difficult is MQTT?
It is classed as Advanced in Electronics & Embedded (topic 87 of 104). It is an advanced topic. It assumes you are comfortable with the intermediate topics in Electronics & Embedded.