Key Terms
| Term | In one line |
|---|---|
| MQTT | Lightweight pub/sub over TCP — the default IoT protocol |
| MQTT QoS | 0 at-most-once · 1 at-least-once · 2 exactly-once (expensive, rarely needed) |
| CoAP | REST-like over UDP — for the most constrained devices and lossy links |
| AMQP | Richer broker semantics over TCP — routing, transactions, heavier |
| Device shadow / twin | Cloud-side copy of device state, readable and writable while the device is offline |
| Fleet provisioning / JITP | Bootstrapping device identity at scale without pre-baking per-device secrets |
| Edge runtime | Greengrass / IoT Edge — run compute and inference on the device side |
| OTA | Over-the-air update — signed, staged, and rollback-capable or it’s a fleet-bricking risk |
Numbers That Matter
| Network | Range | Use |
|---|---|---|
| NFC | <10 cm | Tap-to-pair |
| Bluetooth LE / Zigbee | 10–100 m | Personal/building area |
| WiFi | ~50 m | High bandwidth, high power |
| LoRaWAN | 2–15 km | Low power, tiny payloads, long range |
| NB-IoT / LTE-M | Cellular wide | Carrier-managed, no gateway needed |
| Sigfox | 10–50 km | Ultra-narrowband, very low rate |
| Figure | Value |
|---|---|
| Scale check | 10,000 machines × 10 sensors × 1 msg/s = 100,000 msg/s |
| Identity | X.509 certificates per device, never a shared key |
Decision Rules
- MQTT by default; CoAP when the device is too constrained or the link too lossy for TCP; AMQP when you need broker-grade routing semantics. HTTP only for infrequent, low-volume reporting.
- Pick QoS by consequence, not by instinct. QoS 0 for high-frequency telemetry where the next reading is a second away; QoS 1 for commands and events that matter, with idempotent handlers; QoS 2 almost never — the handshake cost rarely justifies it.
- Process at the edge when bandwidth is expensive, latency must be local (safety interlocks can’t round-trip to a region), or connectivity is intermittent. Send aggregates and anomalies upstream, not raw samples.
- Per-device X.509 identity, always. A shared credential means one extracted device key compromises the entire fleet, and you cannot revoke a single device.
- OTA needs signature verification, staged rollout, and an automatic rollback path. A bad update pushed to a whole fleet at once is the incident you cannot fix remotely — because the devices that would receive the fix are the ones that are bricked.
- Do the volume arithmetic before choosing ingestion. Devices × sensors × frequency gives messages per second, which selects the stream service and its shard/partition count.
- Device shadow decouples the app from connectivity. The application reads and writes desired state; the device reconciles when it next connects. Without it, every feature has to handle “device is asleep.”
Say This Out Loud
“I’d default to MQTT for device-to-cloud, and the interesting decision is QoS rather than protocol. High-frequency telemetry goes at QoS 0 — if I drop one reading, the next one arrives in a second and nothing is lost that matters. Commands and state changes go at QoS 1 with idempotent handlers on the device, because at-least-once plus idempotency gets you exactly-once semantics far more cheaply than QoS 2’s four-way handshake.”
“Every device gets its own X.509 certificate, provisioned through fleet provisioning rather than baked into the firmware image. The reason is revocation: with a shared credential, one device pulled off a shelf and dumped compromises the entire fleet and you have no way to revoke just that one. Per-device identity means the blast radius of a compromised device is exactly one device.”
“OTA is where I’d spend the most design attention, because it’s the one failure you can’t remote into and fix — the devices that need the repair are the ones that are bricked. So: signature verification on the device before applying, staged rollout to a canary cohort first, health check after boot, and an automatic rollback to the previous image if the device doesn’t report healthy inside a window.”