Device to cloud: telemetry that survives lesson plan
Telemetry that reaches the server once, in order, through outages: sequence numbers, ArduinoJson payloads, batching, backoff with jitter, an offline queue on SD, device identity and idempotent uploads, on an ESP32-C3.
Objectives and materials
By the end, students can
- What a reading carries, and JSON that says it.
- Batching, and backing off when the cloud fails.
- An offline queue on SD, and an identity the cloud trusts.
- A reliable telemetry node.
Materials for the whole unit
- ESP32-C3-DevKitM-1
- microSD card module
- Pressure, humidity and temperature, BME280
Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.
Messages
What a reading carries, and JSON that says it.
| Lesson | Time | What students do |
|---|---|---|
| Telemetry designWhat a reading must carry to survive the trip: who sent it, a sequence number that is never reused, when it was measured on the device’s own clock, and units in every name. And what a day of it costs. | 50 min |
|
| JSON payloadsBuild payloads with ArduinoJson: nested objects and arrays, exact decimals with serialized(), the size before sending, short keys, and a server reply parsed with every failure checked. | 65 min |
|
Materials
- ESP32-C3-DevKitM-1
- microSD card module
- Pressure, humidity and temperature, BME280
Check for understanding
Each student finishes "JSON payloads" on their own, without opening the hints. The simulator checks 8 of its 8 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Short keys".
Sending well
Batching, and backing off when the cloud fails.
| Lesson | Time | What students do |
|---|---|---|
| BatchingOne request for many readings: a JSON array with a sequence number in each entry, sent a batch at a time, kept whole when the post fails, and the trade between requests and delay. | 50 min |
|
| BackoffWhen the cloud fails: exponential backoff to a cap, full jitter so a thousand nodes do not retry in step, a reset on success, and never retrying a request the server called wrong. | 60 min |
|
Materials
- ESP32-C3-DevKitM-1
- microSD card module
- Pressure, humidity and temperature, BME280
Check for understanding
Each student finishes "Backoff" on their own, without opening the hints. The simulator checks 7 of its 7 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Backoff in RAM is not enough".
Surviving
An offline queue on SD, and an identity the cloud trusts.
| Lesson | Time | What students do |
|---|---|---|
| An offline queueReadings on the SD card first, uploads second: a JSON Lines queue file, a marker of how much is sent, the oldest first, nothing marked sent before a 2xx, and a sequence number that survives a reboot. | 65 min |
|
| Device identityWho is this node? An id from a config file on the card or from the chip’s MAC, an API key that never lives in the code, an Idempotency-Key that makes a retried upload safe, and what to do when the key is refused. | 60 min |
|
Materials
- ESP32-C3-DevKitM-1
- microSD card module
- Pressure, humidity and temperature, BME280
Check for understanding
Each student finishes "Device identity" on their own, without opening the hints. The simulator checks 7 of its 7 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Provisioning".
Boss project
A reliable telemetry node.
| Lesson | Time | What students do |
|---|---|---|
| Boss: a reliable telemetry nodeEvery idea at once: readings queued on SD with a persistent sequence number, idempotent batches with the node’s identity, backoff with jitter through an outage, a reboot in the middle, and a stop on a refused key. | 65 min |
|
Materials
- ESP32-C3-DevKitM-1
- microSD card module
- Pressure, humidity and temperature, BME280
Check for understanding
Each student finishes "Boss: a reliable telemetry node" on their own, without opening the hints. The simulator checks 8 of its 8 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "The promise".
Teach this unit as a class
Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.
The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.