IoT and Smart Systems Engineer · Focus area 3: Device-to-cloud communication
IO8: Store-and-forward and edge computing
Goal: keep readings safe on the device until the server confirms them, survive power cuts part-way through a write, reconnect without draining the battery or flooding the server, decide on the device which readings are worth sending, and handle duplicates, gaps and late data on the server.
You'll need: IO3, IO4, IO7, Module 24 (Asynchronous Programming), Module 57 (Transactions and Indexes), Module 94 (Distributed
Systems), and the JalSetu practice kit (firmware/buffer.py, firmware/uplink.py, firmware/edge.py, sim/flash.py,
sim/collector.py, tests/test_buffer.py).
Where this is used: water and energy meters, cold-chain trackers in lorries, farm sensors, vehicle data loggers and factory machines all record while the network is away and send later.
How it differs: a web app that loses its connection shows an error and the person tries again. A device in a field has nobody to press retry; it has to keep its data, survive the battery being pulled, and catch up on its own when the network returns.
Time: reading about 3 hours · practice (the Try it tasks) about 3 hours · assignment about 5 hours.
Lessons
- 1Store first, send laterReading 15–25 minutes, plus practice✓
- 2Surviving power cuts and torn writesReading 15–25 minutes, plus practice✓
- 3Reconnecting without draining the batteryReading 15–25 minutes, plus practice✓
- 4Edge computing: deciding on the deviceReading 15–25 minutes, plus practice✓
- 5The server side: duplicates, gaps and late dataReading 15–25 minutes, plus practice✓
🛠️Assignment: JalSetu's buffer and edge logic
- Build the flash buffer: append-only records with length and CRC32,
seq, andbuf.ackwritten via a temporary file and rename. - Send oldest first with QoS 1 in batches of up to 20, removing readings only after PUBACK.
- Add Wi-Fi timeouts and exponential backoff with a cap, and report readings waiting and dropped in the status.
- Add a deadband, an hourly heartbeat and immediate alarms.
- Write
docs/buffer-design.mdwith the sections the test asks for. - Run
pytest tests/test_buffer.pyuntil all 10 tests pass.
Self-check before you finish:
- [ ] The buffer survives power cuts at any point (tests 1 and 2).
- [ ] A lost PUBACK leads to a resend and one stored copy (test 5).
- [ ] An outage costs at most 12 attempts in 96 wakes, and the backlog clears (test 7).
- [ ] A steady tank keeps at most 60 readings in 192 wakes, and alarms go straight away (test 9).
✅Module check
Explain in a few sentences, in your own words:
How should a device keep and send data when its network comes and goes?
Show a good answer
A good answer mentions: writing each reading to flash first with a sequence number and removing it only after the broker confirms it; append-only records with checksums and write-then-rename so power cuts leave a usable buffer; a capacity with counted, reported drops; timeouts, exponential backoff with a cap and jitter, and batches oldest first; edge filtering with a deadband, a heartbeat and alarms that bypass filters; and a server that stores one copy per device and sequence number, reports gaps, and charts by the reading's own time.
📚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 ·
