54 Data Formats for IoT
54.1 Overview
Data formats determine how IoT devices encode and exchange information. The choice of format impacts bandwidth usage, battery life, parsing speed, and development complexity. This series covers everything from human-readable JSON to ultra-compact custom binary encodings.
In one sentence: Choose your data format based on bandwidth constraints and debugging needs - JSON for prototyping and high-bandwidth networks, CBOR for most IoT deployments, and custom binary only when every byte matters.
Remember this rule: CBOR gives you 80% of custom binaryโs efficiency with 20% of the engineering effort - itโs the sweet spot for most constrained IoT applications.
54.2 Chapter Guide
This topic has been organized into four focused chapters:
54.2.1 1. IoT Data Formats Overview
Difficulty: Foundational | Time: ~20 minutes
Start here to understand why data formats matter. Covers:
- Why format choice impacts bandwidth, battery, and development
- JSON as the universal default
- The format spectrum from human-readable to binary
- Real-world size comparisons (62-byte JSON vs 17-byte custom binary)
- Common misconceptions about JSON in IoT
Best for: Beginners, anyone starting a new IoT project
54.2.2 2. Binary Data Formats
Difficulty: Intermediate | Time: ~25 minutes
Deep dive into efficient binary encodings. Covers:
- CBOR: Binary JSON with 47% size reduction
- Protocol Buffers: Schema-based with 77% reduction
- Custom Binary: Maximum efficiency patterns
- Type systems, encoding details, and performance benchmarks
- Library recommendations by platform
Best for: Developers implementing bandwidth-constrained systems
54.2.3 3. Data Format Selection
Difficulty: Intermediate | Time: ~20 minutes
Decision frameworks for choosing the right format. Covers:
- Step-by-step decision tree
- Real-world application mapping (12 use cases)
- Detailed cost analysis scenario (soil moisture network)
- Fleet tracking quiz with calculations
- Total cost of ownership considerations
Best for: Technical leads, architects making format decisions
54.2.4 4. Data Formats Practice
Difficulty: Intermediate | Time: ~30 minutes
Hands-on scenarios and assessments. Covers:
- Smart meter deployment scenario (10,000 devices)
- Agricultural sensor design (LoRaWAN constraints)
- Format migration strategy (50,000 deployed sensors)
- Industrial monitoring (two-tier format strategy)
- Worked example: LoRaWAN payload design with battery calculations
- Knowledge check questions
Best for: Students preparing for assessments, practitioners validating knowledge
54.3 Quick Reference
| Format | Typical Size | Best For |
|---|---|---|
| JSON | 95 bytes | Wi-Fi, prototyping, debugging |
| CBOR | 50 bytes | LoRaWAN, NB-IoT, CoAP |
| Protobuf | 22 bytes | High-volume, gRPC, stable schemas |
| Custom Binary | 16 bytes | Sigfox, ultra-low-power, extreme constraints |
54.4 Prerequisites
Before starting this series, you should be familiar with:
- Data Representation: Binary and hexadecimal encoding
- Networking Basics: Basic idea of packets and payload size constraints