IoT and Smart Systems Engineer · Focus area 3: Device-to-cloud communication
IO7: Device-to-cloud messaging: MQTT and CoAP
Goal: choose a protocol for devices on weak networks, use MQTT's topics, QoS levels, retained messages, last wills and keepalives, design topics and payloads, know when CoAP suits better, and secure the connection with per-device identity.
You'll need: IO1, IO3, Module 4 (Computer Networks), Module 5 (IP Addresses and Ports), Module 25 (APIs and JSON), Module 76 (API
and Network Security), and the JalSetu practice kit (lib/mqtt.py, sim/broker.py, tools/broker.py, docs/FORMATS.md).
Where this is used: MQTT carries messages for smart meters, factory sensors, connected cars, home devices and many cloud IoT platforms. CoAP is used where devices are very small or on low-power networks.
How it differs: a web app asks a server and waits for an answer. IoT devices sleep, wake briefly and push small messages over connections that drop; servers need to know which devices are alive and send them commands when they next appear.
Time: reading about 3 hours · practice (the Try it tasks) about 3 hours · assignment about 4 hours.
Lessons
- 1Why not HTTP for everything?Reading 15–25 minutes, plus practice✓
- 2MQTT: topics, QoS, retained messages, wills and keepaliveReading 15–25 minutes, plus practice✓
- 3Designing topics and payloadsReading 15–25 minutes, plus practice✓
- 4CoAP and UDP for the smallest devicesReading 15–25 minutes, plus practice✓
- 5Securing the connection and the brokerReading 15–25 minutes, plus practice✓
🛠️Assignment: JalSetu's messaging
- Design JalSetu's topics for readings, status and commands, general to specific.
- Write the reading format with
seq,tsand units in field names. - Implement QoS 1 publishing, a retained status, an "asleep" status and a retained last will.
- Watch it with
tools/broker.pyand a standard MQTT client. - Write the security plan: TLS, per-device credentials and ACLs.
- Run
pytest tests/test_buffer.pyand note which tests pass (6 and 8 at least).
Self-check before you finish:
- [ ] A standard client receives readings in the agreed format (test 6).
- [ ] The will says offline; the last status before sleep says asleep (test 8).
- [ ] No personal data appears in any topic.
- [ ] The security plan is marked not verified in the kit.
✅Module check
Explain in a few sentences, in your own words:
How should a device send data to the cloud?
Show a good answer
A good answer mentions: publish and subscribe through a broker rather than polling, with one small connection; MQTT topics from general to specific with IDs, QoS 1 with sequence numbers for data that matters, retained status, a last will and keepalive; compact, versioned payloads with units and time; CoAP over UDP with confirmable messages and observe for the smallest devices; and TLS with per-device credentials, ACLs per device and credentials kept out of code.
📚Official references
Official documentation and guidance for this module's topics, chosen on 2 November 2026. Tools, laws and standards change, so check the current version before you rely on a detail. If a link has moved, search the same site.
📝Module quiz
10 questions · 10 marks each · 100 marks in all · pass mark 70% · retry as often as you like ·
