Every IoT sensor reading undergoes a 7-stage transformation journey: physical phenomenon to electrical signal to digital value to processed data to formatted payload to protocol packet to radio transmission. Network transmission dominates both latency (60-70%) and energy consumption (80-90%) in most IoT systems, which means the biggest optimization gains come from reducing transmissions through edge processing and shrinking payloads with binary formats rather than speeding up local computation. Understanding this pipeline is essential for diagnosing why readings are delayed, why battery life is poor, or why data arrives corrupted.
18.1 Learning Objectives
By the end of this chapter series, you will be able to:
Trace the Data Journey: Follow sensor data through all seven transformation stages from physical measurement to network transmission
Identify Pipeline Stages: Distinguish each transformation step from analog signal to network packet and specify inputs and outputs
Compare Data Formats: Evaluate the trade-offs between JSON, CBOR, and binary encoding in terms of payload size, energy cost, and battery life
Design Data Pipelines: Architect efficient sensor-to-network workflows for IoT applications using edge aggregation and protocol selection
Analyze Energy Budgets: Calculate how each pipeline stage contributes to total energy consumption and pinpoint where transmission dominates
Apply Signal Processing: Implement filtering, sampling, and conditioning techniques appropriate to analog and integrated digital sensors
Key Concepts
Stage Boundaries: Each reading crosses seven engineering boundaries, and most debugging becomes easier once you identify the exact stage where corruption, delay, or cost appears.
Transmission Dominance: Stage 7 usually dominates the budget, often contributing 60-70% of latency and 80-90% of total energy in battery-powered nodes.
Digital Sensor Collapse: Integrated I2C and SPI sensors often hide Stages 1-3 inside the package, so firmware starts with a digital value instead of a raw analog waveform.
Format Choice Matters: Stage 5 decisions such as JSON vs CBOR directly change Stage 7 airtime, duty-cycle pressure, and battery life.
Edge Aggregation: Stage 4 is where filtering, averaging, thresholding, and compression can turn many raw readings into one useful transmission.
Packet Overhead: Stage 6 adds addressing, integrity, sequencing, and security bytes, so the “real” transmitted size is always larger than the payload alone.
Optimization Order: Measure the pipeline first, then reduce transmission count and payload size before spending time on micro-optimizing local computation.
18.2 MVU: Sensor-to-Network Pipeline in 60 Seconds
Core Concept: Every IoT sensor reading undergoes a 7-stage transformation journey: Physical Phenomenon to Electrical Signal to Digital Value to Processed Data to Formatted Payload to Protocol Packet to Radio Waves. Understanding this pipeline is essential for debugging, optimization, and system design.
Why It Matters: When your temperature sensor shows “25.6C” in the cloud dashboard, that number traveled through 7 distinct transformations - each adding latency, consuming energy, and potentially introducing errors. Engineers who understand this pipeline can diagnose why readings are delayed, why battery life is poor, or why data is corrupted.
Key Takeaway: Network transmission dominates both latency (60-70%) and energy consumption (80-90%) in most IoT systems. Optimizing the pipeline means reducing transmissions (edge processing) and shrinking payloads (binary formats) rather than speeding up local processing.
Read on for the full picture, or jump directly to a specific chapter below.
Connect with Learning Hubs
Explore Further:
Knowledge Map: See where sensor pipelines fit in the IoT landscape at Knowledge Map
Sensor Squad Adventures: Following the Temperature’s Journey
Meet the Sensor Squad Characters!
Sammy the Sensor - A curious temperature sensor who loves asking questions
Lila the Light - A bright and cheerful light sensor who’s always positive
Max the Motor - An energetic actuator who loves action and movement
Bella the Button - A helpful input device who’s always ready to respond
Sammy says: “Hey friends! Today I’m going to show you how I send a temperature reading all the way to the cloud! It’s like a super exciting relay race!”
Lila asks: “But Sammy, when you feel that it’s warm, how does that number end up on someone’s phone?”
Sammy explains: “Great question! Let me show you my 7-step journey!”
18.3.1 The Amazing 7-Step Data Relay Race
Step
What Happens
Relay Race Analogy
1
I feel the heat!
Runner 1 starts with a baton
2
Heat becomes electricity
Baton passed to Runner 2
3
Electricity becomes a number
Runner 3 counts the baton
4
Number gets cleaned up
Runner 4 polishes the baton
5
Number put in an envelope
Runner 5 wraps it nicely
6
Envelope gets an address
Runner 6 adds the shipping label
7
Zoom! Off to the cloud!
Helicopter delivers the package!
18.3.2 Sammy’s Journey Story
Max shouts: “Tell us the whole adventure!”
Sammy tells the story:
It was a sunny day, and I could feel the warmth - 25.6 degrees Celsius!
First, the heat made me produce a tiny bit of electricity - like squeezing a lemon makes juice!
Then my friend ADC (the number counter) turned that electricity into the number 2560.
After that, the smart microcontroller divided by 100 to get 25.6 - the real temperature!
“But wait!” said Lila. “You can’t just yell a number into space!”
“That’s right!” I replied. “So I wrapped my number in a JSON package: {”temp”: 25.6}.”
Then the network helper added addresses - like putting stamps on a letter!
Finally, WHOOOOSH! The radio sent it flying through the air to the cloud!
18.3.3 Bella’s Fun Fact!
Bella says: “Did you know? The wireless sending part (step 7) uses 80% of all the battery power! That’s why smart sensors try to send fewer messages - it’s like taking the stairs vs. riding a helicopter. The helicopter is faster but uses way more energy!”
18.3.4 Key Words for Kids
Word
What It Means
Pipeline
Steps that data follows, like a water slide with different sections
ADC
Analog-to-Digital Converter - turns electricity into numbers
Payload
The actual message (like the present inside a wrapped box)
Latency
How long the whole journey takes
18.3.5 Try This at Home!
Max challenges you: “Play the telephone game with your friends! Whisper a message through 7 people. Did it arrive correctly? That’s like data going through the pipeline - each step needs to be accurate!”
18.4 The 7-Stage Pipeline
Every IoT sensor reading passes through up to 7 transformation stages:
Integrated digital sensors (e.g., BME280, SHT40) with I2C or SPI interfaces handle Stages 1-3 internally — the sensor chip performs measurement, conditioning, and ADC conversion on-die and outputs a digital value directly. In these cases, firmware interacts starting at Stage 4.
Figure 1: Chapter-specific pipeline overview showing all seven transformations, the domains they belong to, and why transmission usually dominates the system budget.
18.4.1 Quick Stage Map
Stage 1. Physical Measurement: input is a real-world phenomenon such as heat, light, pressure, or vibration; output is a small analog change at the sensing element. Covered in Overview.
Stage 2. Signal Conditioning: input is a weak analog signal; output is an amplified, filtered, or level-shifted waveform ready for conversion. Covered in Overview.
Stage 3. ADC Conversion: input is conditioned analog voltage; output is a binary sample or digital register value. Covered in Overview.
Stage 4. Digital Processing: input is raw counts; output is a calibrated value, filtered trend, threshold decision, or aggregate. Covered in Processing.
Stage 5. Data Formatting: input is processed engineering data; output is JSON, CBOR, or compact binary payload. Covered in Processing.
Stage 6. Packet Assembly: input is formatted payload; output is a complete protocol packet with headers, security fields, and checksums. Covered in Processing.
Stage 7. Network Transmission: input is a finished packet; output is radio energy or wired bits delivered to the network. Covered in Transmission.
18.5 Key Takeaway
Network transmission typically dominates latency (60-70%) and energy consumption (80-90%) — so optimize for fewer transmissions (edge processing) and smaller payloads (binary formats) before optimizing local processing speed.
Concrete example — a LoRaWAN temperature sensor: ADC conversion ~0.1 ms, processing ~2 ms, formatting ~1 ms, transmission ~50 ms. Transmission accounts for 50/53.1 ms = 94% of total pipeline time.
Interactive: Pipeline Latency Calculator
Adjust the time spent in each pipeline stage to see how transmission dominates total latency:
html`<div style="background: var(--bs-light, #f8f9fa); padding: 1rem; border-radius: 8px; border-left: 4px solid #16A085; margin-top: 0.5rem;"><p><strong>Total Pipeline Time:</strong> ${pipeline_total.toFixed(2)} ms</p><p><strong>Transmission Dominance:</strong> ${transmission_percentage}% of total time</p><p><strong>Local Processing:</strong> ${local_percentage}% of total time</p><p style="margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid #ddd;"><em>Key Insight:</em> Even with fast local processing, transmission typically accounts for 60-95% of total latency in IoT pipelines.</p></div>`
Check your understanding of why transmission dominates the pipeline energy budget:
For Beginners: The Sensor-to-Network Journey
When a temperature sensor measures 25.6°C, that number doesn’t magically appear in a cloud database. It goes through a remarkable transformation journey:
Physical World: Heat affects the sensor material
Electrical Signal: Material change creates a voltage (e.g., 2.56V)
Digital Number: ADC converts voltage to binary (110001101010)
Processed Value: Firmware calculates temperature = 25.6°C
Formatted Data: Value becomes JSON: {"temp": 25.6}
Network Packet: Data gets wrapped with headers for transmission
Cloud Storage: Finally stored in a database
Simple Analogy: It’s like sending a letter. You write a message (sensor reading), put it in an envelope (data format), add an address and stamp (packet headers), and mail it (network transmission).
18.6 Incremental Example Set: Building Pipeline Understanding
Beginner Example: Single Temperature Sensor with JSON
Scenario: A DHT22 temperature/humidity sensor on a NodeMCU (ESP8266) sends data to a cloud dashboard over Wi-Fi every 60 seconds.
Pipeline Flow:
Stage 1: DHT22 measures 23.4°C, 65% humidity
Stage 2-3: (Internal to DHT22 - outputs digital values via single-wire protocol)
Stage 4: ESP8266 reads digital values: temp=234, hum=650
Stage 5: Format as JSON: {"temp":23.4,"hum":65}
Stage 6: Wrap in HTTP POST with headers (~120 bytes total)
Stage 7: Wi-Fi transmits packet (~2 ms at 54 Mbps)
Key Learning: Even this simple case has 7 stages. Most beginners only think about “read sensor, send to cloud” (Stages 1 and 7), missing the crucial formatting and processing steps in between.
Intermediate Example: Multi-Sensor Array with Edge Processing
Scenario: 10 soil moisture sensors in a greenhouse, sampled every 5 minutes. Instead of sending 10 individual readings, the edge gateway aggregates and computes statistics before transmitting.
Pipeline Flow:
Stage 1-3: Each of 10 sensors measures moisture (outputs 0-1023 ADC value)
Stage 4: Edge gateway applies calibration: ADC → % moisture
Sensor 1: 512 → 45%, Sensor 2: 678 → 62%, ... Sensor 10: 423 → 38%
Stage 4 (cont): Compute aggregates:
- Average: 49.3%
- Min: 38%
- Max: 67%
- Variance: 8.2%
Stage 5: Format as compact CBOR array (18 bytes vs 120 bytes for 10 individual JSON objects)
Stage 6: LoRaWAN packet assembly (31 bytes total with headers)
Stage 7: Transmit once over LoRaWAN (~200 ms air time)
Key Learning: Edge processing (Stage 4) reduces 10 transmissions to 1 transmission. Network energy savings: 90%. This is why edge computing matters in IoT pipelines.
Compare: If each sensor transmitted individually: - 10 transmissions × 200 ms = 2000 ms total air time - 10 transmissions × 120 mA = 1200 mA-ms = 0.333 mAh - Aggregated: 1 transmission × 200 ms × 120 mA = 24 mA-ms = 0.0067 mAh - Energy savings: 98%
Advanced Example: Multi-Protocol Gateway with Format Translation
Scenario: Industrial facility with mixed sensor types: Modbus RTU temperature sensors, BLE beacons for asset tracking, and LoRaWAN environmental sensors. A gateway collects from all three and forwards to cloud via cellular.
Pipeline Flow:
Path A (Modbus sensors):
Stage 1-3: (Internal to Modbus sensor)
Stage 4: Gateway polls Modbus registers every 10 seconds (16 sensors)
Stage 5: Translate Modbus registers → JSON array
Stage 6: Buffer in gateway memory
Path B (BLE beacons):
Stage 1-7: BLE beacons broadcast every 1 second
Stage 4: Gateway BLE scanner receives advertisements
Stage 5: Parse BLE payload (Eddystone format) → Extract UUID, RSSI, battery
Stage 6: Buffer in gateway memory
Path C (LoRaWAN sensors):
Stage 1-7: LoRaWAN devices transmit every 15 minutes
Stage 4: Gateway receives LoRaWAN uplinks
Stage 5: Decrypt, verify MIC, extract payload
Stage 6: Buffer in gateway memory
Unified Path (Gateway → Cloud):
Stage 4 (gateway edge): Every 60 seconds, aggregate all buffered data:
- 16 Modbus readings
- ~60 BLE beacon sightings
- ~4 LoRaWAN packets
Stage 5: Format as single MQTT message with JSON payload (~800 bytes)
Stage 6: MQTT packet with QoS 1 + TLS overhead (~1200 bytes total)
Stage 7: 4G LTE transmission (~15 ms)
Key Learning: Multi-protocol gateways perform protocol translation (Stage 5) and temporal aggregation (Stage 4) to reduce cellular data costs. Without aggregation, this gateway would send 140 messages/min instead of 1 message/min = 99.3% reduction in cellular transmissions.
18.8 Worked Example: Comparing JSON vs CBOR Pipeline
Worked Example: Energy and Latency Impact of Data Format Choice
Scenario: A battery-powered temperature sensor transmits readings every 60 seconds over LoRaWAN (SF9, 125 kHz BW, 10 km range). Battery: 2000 mAh at 3.3V. Let’s compare JSON vs CBOR encoding across the full pipeline.
For SF9, BW=125kHz, CR=4/5: - JSON (89 bytes): 26 symbols → 157 ms air time - CBOR (54 bytes): 17 symbols → 120 ms air time - Air time savings: 37 ms (24% reduction)
Energy Consumption (per transmission):
LoRaWAN module (e.g., RFM95W) power consumption: - TX at +20 dBm: 120 mA during transmission - MCU processing: 15 mA during encoding/formatting (assume 10 ms) - Sleep mode: 0.2 µA (negligible)
JSON path:
Encoding (Stage 5): 15 mA × 10 ms = 15 mA × (10/3600000) h = 0.000042 mAh
Transmission (Stage 7): 120 mA × 157 ms = 120 mA × (157/3600000) h = 0.00523 mAh
Total per message: 0.00527 mAh
CBOR path:
Encoding (Stage 5): 15 mA × 8 ms = 15 mA × (8/3600000) h = 0.000033 mAh
Transmission (Stage 7): 120 mA × 120 ms = 120 mA × (120/3600000) h = 0.00400 mAh
Total per message: 0.00403 mAh
Energy savings: 0.00124 mAh per message (23.5% reduction)
Stage 5 (formatting) impact: 49% payload reduction (72→37 bytes) directly reduces Stage 7 transmission time and energy
Stage 7 dominance: Transmission uses 99.2% of total energy (0.00523 mAh transmission vs 0.00004 mAh formatting)
Optimization priority: Reducing payload size (Stage 5) has 10x more impact than optimizing local processing (Stages 1-4)
Real-world benefit: 31% battery life extension = ~3 months longer field deployment before battery replacement
Duty cycle: CBOR’s shorter air time leaves more room for retransmissions under EU868’s 1% duty cycle limit
Lesson: In the sensor-to-network pipeline, format choice at Stage 5 directly impacts battery life at Stage 7. The 23.5% energy savings from CBOR comes almost entirely from reduced transmission time, not from faster encoding. This validates the chapter’s key principle: optimize for fewer, smaller transmissions.
Common Pitfalls
1. Optimising the Sensor Front-End While the Radio Dominates
Teams often spend days tuning ADC timing or filter coefficients while transmission still consumes 80-90% of the energy budget. Profile the full path first, then target transmission frequency, payload size, and retry behaviour before micro-optimising local compute.
2. Forgetting That Integrated Digital Sensors Already Collapse Stages 1-3
When a BME280 or TMP117 is used, the firmware is not dealing with a raw analog waveform anymore. Treating those parts like discrete analog chains leads to unnecessary circuitry, duplicated calibration logic, and misleading debugging assumptions about where an error originates.
3. Sending Every Raw Reading Instead of Aggregating at Stage 4
Shipping each sensor sample individually makes packet overhead and radio airtime dominate cost. Aggregate, threshold, or summarize at the edge whenever the application allows it, especially for slow-changing environmental data.
🏷️ Label the Diagram
Code Challenge
18.9 Summary
The sensor-to-network pipeline describes the up-to-7-stage transformation that every IoT reading undergoes — from a physical phenomenon (heat, light, pressure) through analog conditioning and digitisation, into processed, formatted, and packetised data, and finally across a wireless link to the cloud. Integrated digital sensors collapse the first three stages into one chip, but the later stages remain the same.
The single most important optimisation insight is that network transmission dominates both latency and energy. Reducing the number of transmissions (via edge processing and aggregation) and shrinking payload size (via binary formats like CBOR) yields far greater savings than speeding up local computation.
Concept Relationships: Sensor to Network Pipeline
7-Stage Pipeline -> Integrated Digital Sensors: Digital sensors collapse Stages 1-3 into one package, so the firmware-visible pipeline begins with a digital value instead of an analog signal.
Network Transmission -> Energy Consumption: Stage 7 usually sets the battery budget because radio airtime dwarfs ADC and formatting costs.
Data Formatting -> Payload Size: JSON, CBOR, and binary encodings all describe the same measurement differently, but their byte counts directly change packet size and airtime.
Edge Processing -> Transmission Reduction: Stage 4 is where filtering, thresholding, and aggregation reduce how often Stage 7 runs.
Pipeline Latency -> Real-time vs Periodic Sensing: Systems that need fast feedback care about Stage 7 technology choice more than tiny optimizations in local math.
Cross-module connection: This pipeline connects to Protocol Selection via transmission characteristics. See Protocol Selection Framework for choosing protocols based on Stage 7 requirements.