66  Edge Quiz: Power & Optimization

Quiz mastery targets are easiest to plan with threshold math:

\[ C_{\text{target}} = \left\lceil 0.8 \times N_{\text{questions}} \right\rceil \]

Worked example: For a 15-question quiz, target correct answers are \(\lceil 0.8 \times 15 \rceil = 12\). If a learner moves from 8/15 to 12/15, score rises from 53.3% to 80%, crossing mastery with four additional correct answers.

In 60 Seconds

Power optimization at the edge involves deep sleep modes (5.6x battery life improvement), multi-factor quality scoring for data filtering, priority-based processing that separates critical from massive IoT, tiered storage achieving thousands-fold efficiency, and fail-closed security with MAC address whitelisting. TCO analysis must account for setup, operations, and replacement costs to justify edge deployments.

66.1 Learning Objectives

Edge data acquisition is about collecting and pre-processing sensor data right where the devices are, before sending it to the cloud. Think of a smart mailroom that sorts and summarizes incoming letters instead of forwarding every piece of junk mail to the CEO. This local filtering saves bandwidth, reduces costs, and speeds up responses.

~35 min | Intermediate | P10.C09.U03

Key Concepts

  • Duty cycle: The fraction of time a device or component operates in its active (high-power) state; a 1% duty cycle on a radio transmitter reduces average transmission power by 99×.
  • Deep sleep mode: A very low-power state for microcontrollers where most peripherals are powered off and current draw drops to microamps, extended by waking only on timer interrupt or external sensor trigger.
  • Power gating: Completely cutting power to unused circuit blocks (sensors, radio, display) using a transistor switch rather than putting them into a low-power standby mode, achieving near-zero leakage current.
  • Wake-on-threshold: A technique where a low-power comparator monitors a sensor signal and wakes the main processor only when the signal crosses a threshold, eliminating unnecessary active periods.
  • Transmission energy cost: The energy consumed per bit transmitted wirelessly, which is typically the dominant energy expense in IoT edge nodes and scales with distance (path loss), data rate, and radio protocol overhead.

By the end of this chapter, you will be able to:

  • Analyze Power Trade-offs: Calculate battery life improvements from deep sleep optimization
  • Evaluate Data Quality: Compute multi-factor quality scores for edge processing decisions
  • Design Priority Systems: Architect dual-path processing for critical vs massive IoT
  • Calculate TCO/ROI: Perform total cost of ownership and return on investment analysis
  • Plan Storage Architecture: Design tiered storage strategies for data accumulation
  • Implement Security: Apply whitelist-based access control with fail-closed policies

66.2 Quiz: Power and System Optimization

### Deep Sleep vs Sleep Mode Calculator

Adjust the parameters below to explore how deep sleep affects battery life for different IoT scenarios.

Scenario: A smart agriculture deployment has 500 soil moisture sensors across 50 hectares. Each sensor must operate for 3+ years on a single 3,000 mAh battery.

Current Design (Failing):

  • Sample soil moisture every 5 minutes
  • Transmit via LoRaWAN immediately after each reading
  • Power profile:
    • Active (sensing): 30 mA for 2 seconds
    • Transmit: 40 mA for 1 second
    • Sleep: 1 mA between readings

Battery Life Calculation:

Per 5-minute cycle (300 seconds):

  • Active: 2 s \(\times\) 30 mA = 60 mA-s
  • Transmit: 1 s \(\times\) 40 mA = 40 mA-s
  • Sleep: 297 s \(\times\) 1 mA = 297 mA-s
  • Total: 397 mA-s per 300 s cycle

Average current: \(397 \div 300 = 1.32\) mA

Battery life: \(3{,}000 \div 1.32 = 2{,}273\) hours = 95 days (fails 3-year requirement)

Optimized Design (Edge Processing + Deep Sleep):

  • Sample locally every 5 minutes
  • Edge gateway aggregates 10 sensors
  • Transmit only hourly aggregates (1 transmission per hour instead of 12)
  • Use deep sleep: 0.01 mA

Per 5-minute cycle:

  • Active: 2 s \(\times\) 30 mA = 60 mA-s
  • Transmit: 1 s \(\times\) 40 mA \(\times\) (1/12) = 3.33 mA-s (only 1 of 12 cycles transmits)
  • Deep sleep: 297 s \(\times\) 0.01 mA = 2.97 mA-s
  • Total: 66.3 mA-s per 300 s

Average current: \(66.3 \div 300 = 0.221\) mA

Battery life: \(3{,}000 \div 0.221 = 13{,}575\) hours = 566 days = 1.55 years (still short)

Final Optimization (Event-Driven):

  • Monitor moisture threshold locally (10% change trigger)
  • Typical field: significant change 2 times per day
  • Deep sleep 99.9% of time

Per day:

  • Active monitoring: negligible (comparator circuit, 0.001 mA)
  • 2 events: 2 \(\times\) (2 s \(\times\) 30 mA + 1 s \(\times\) 40 mA) = 2 \(\times\) 100 = 200 mA-s/day
  • Deep sleep: 86,400 s \(\times\) 0.01 mA = 864 mA-s/day
  • Total: 1,064 mA-s/day

Average current: \(1{,}064 \div 86{,}400 = 0.0123\) mA

Battery life: \(3{,}000 \div 0.0123 = 243{,}902\) hours = 27.8 years (far exceeds 3-year requirement)

Note: This is the theoretical maximum. Real-world factors (battery self-discharge of 2–5% per year, temperature effects, aging) typically reduce this to roughly 8–10 years of practical life.

Cost-Benefit Analysis:

Approach Battery Life Batteries/Year (500 sensors) Cost @ $8/battery 5-Year Total
Original 95 days 500 \(\times\) 3.84 = 1,920 $15,360/year $76,800
Optimized periodic 1.55 years 500 \(\times\) 0.65 = 325 $2,600/year $13,000
Event-driven 8+ years practical 500 \(\times\) 0.06 = 30 $240/year $1,200

Edge gateway cost: 50 gateways @ $500 = $25,000 (one-time)

5-year savings: $76,800 - $1,200 - $25,000 = $50,600 (66% reduction)

Additional benefit: Reduced technician visits to remote fields (50 sites \(\times\) 2 hours/visit \(\times\) $75/hour = $7,500/year saved)

Use this table to choose the optimal power mode for your IoT device:

Factor Deep Sleep (0.01 mA) Light Sleep (0.5 mA) Active Sleep (1–5 mA) Always Active
Sampling Interval > 5 minutes 30 s – 5 min 10–30 seconds < 10 seconds
Wake-Up Latency Can tolerate 2–5 s Need < 500 ms Need < 100 ms Instant response
Duty Cycle < 0.1% 0.1% – 1% 1% – 10% > 10%
Battery Target Multi-year 1–2 years 3–12 months Days/weeks
Peripheral State Lost (must reinit) Some retained Most retained Always available
Wake-Up Triggers Timer, interrupt Timer, interrupt, serial Any event N/A
Example Use Cases Environmental monitoring Motion detection Industrial control Video streaming
Battery Life (3,000 mAh) 300,000 hrs (34 yrs theoretical) 6,000 hrs (250 days) 3,000 hrs (125 days) 100 hrs (4 days)

Decision Algorithm:

def select_sleep_mode(sampling_interval_sec, latency_requirement_ms,
                      duty_cycle_pct, battery_target_days):
    """
    Recommend optimal sleep mode based on requirements.

    Returns: (mode_name, expected_battery_life_days, justification)
    """
    if sampling_interval_sec >= 300:  # 5+ minutes
        if latency_requirement_ms >= 2000:  # Can wait 2+ seconds
            if duty_cycle_pct < 0.1:
                mode = "DEEP_SLEEP"
                current_ma = 0.01 + (duty_cycle_pct / 100) * 30
                life_days = 3000 / (current_ma * 24)
                reason = (f"Long interval ({sampling_interval_sec}s) "
                          f"and low duty cycle justify deep sleep")
                return (mode, life_days, reason)

    if sampling_interval_sec >= 30:  # 30s - 5 min
        if latency_requirement_ms >= 500:
            mode = "LIGHT_SLEEP"
            current_ma = 0.5 + (duty_cycle_pct / 100) * 30
            life_days = 3000 / (current_ma * 24)
            reason = ("Moderate interval with sub-second "
                      "wake-up needs light sleep")
            return (mode, life_days, reason)

    if sampling_interval_sec >= 10:  # 10-30 seconds
        mode = "ACTIVE_SLEEP"
        current_ma = 2 + (duty_cycle_pct / 100) * 30
        life_days = 3000 / (current_ma * 24)
        reason = (f"Frequent sampling ({sampling_interval_sec}s) "
                  f"requires active peripherals")
        return (mode, life_days, reason)

    mode = "ALWAYS_ACTIVE"
    current_ma = 30  # Continuous operation
    life_days = 3000 / (current_ma * 24)
    reason = (f"Very high frequency ({sampling_interval_sec}s) "
              f"requires continuous operation")
    return (mode, life_days, reason)
Common Mistake: Forgetting Transmission Energy Cost in Battery Calculations

The Mistake: Students calculate battery life based on sensing current (25–30 mA) but forget that radio transmission often dominates the power budget at 120–200 mA for Wi-Fi/cellular.

Real-World Example: ESP32 environmental sensor design:

  • Sensing: 30 mA for 3 seconds every 5 minutes
  • Students calculate: Average \(\approx\) 30 mA \(\times\) (3 s / 300 s) = 0.3 mA
  • They forget Wi-Fi transmission: 150 mA for 2 seconds
  • Actual transmission cost: 150 mA \(\times\) (2 s / 300 s) = 1.0 mA

True average current: 0.3 + 1.0 = 1.3 mA (transmission is 77% of power budget)

Impact:

  • Predicted battery life: 3,000 / 0.3 = 10,000 hours (417 days)
  • Actual battery life: 3,000 / 1.3 = 2,308 hours (96 days)
  • Error: 4.3x overestimation

Realistic Power Budget Breakdown:

Component Current Time per Cycle Energy per Cycle % of Total
Deep sleep 0.01 mA 295 s 2.95 mA-s 0.8%
Sensing 30 mA 3 s 90 mA-s 23.1%
Wi-Fi TX 150 mA 2 s 300 mA-s 76.9%
Total 300 s 392.95 mA-s 100%

Note: The percentage column is calculated from the actual energy values: 2.95 / 392.95 = 0.75%, 90 / 392.95 = 22.9%, 300 / 392.95 = 76.3%. The table values are rounded.

The Lesson: Transmission energy often dominates IoT power budgets. Strategies to reduce transmission power:

  1. Batch transmissions: Send 12 readings once per hour instead of 1 every 5 minutes – 12x less TX time
  2. Use lower-power radios: LoRaWAN (40 mA) instead of Wi-Fi (150 mA) – 3.75x less current
  3. Data compression: Reduce payload size from 200 bytes to 50 bytes – shorter TX time
  4. Event-driven: Transmit only on significant changes – drastically less TX frequency

Optimized design:

  • LoRaWAN transmission: 40 mA for 0.5 s every hour (aggregated data)
  • Energy per hour: 40 \(\times\) 0.5 = 20 mA-s
  • Energy per 5-min cycle: 20 / 12 = 1.67 mA-s
  • New TX contribution: 1.67 / 300 = 0.0056 mA (down from 1.0 mA)

Battery life improvement: 3,000 / (0.3 + 0.0056) = 9,817 hours (409 days – now close to the original prediction)

66.3 Concept Relationships

Core Power Concepts:

  • Deep Sleep Trade-off – 5.6x battery life improvement for 10-minute cycle devices
  • Quality Scoring – Multi-factor assessment (battery, signal, freshness)
  • Priority Processing – Critical IoT (< 100 ms) vs Massive IoT (delay-tolerant)
  • Tiered Storage – Over 1,000x efficiency through progressive aggregation

Security Architecture:

  • Whitelisting (Fail-Closed) – Reject unknown devices before TLS handshake
  • Layered Defense – Whitelist, then TLS, then Encryption, then Physical
  • Industrial IoT – Fail-closed mandatory for safety-critical systems

TCO Components:

  • Setup – Hardware + installation
  • Operations – Maintenance + monitoring
  • Replacement – Component refresh over 5-year lifecycle

Builds on:

Enables:

  • Real-World Deployments – Agricultural sensors: 95 days to multi-year battery life
  • Security Implementation – Gateway whitelist protecting non-IP devices

66.4 See Also

Power Optimization:

Security Context:

Study Progression:

Interactive Tools:

Common Pitfalls

Reducing MCU sleep current from 10 mA to 1 mA is irrelevant if the radio still consumes 100 mA during transmission. Always optimise the highest-power component first — typically the radio, then sensors, then MCU.

Microcontroller deep sleep requires explicit software configuration (disabling peripherals, setting wakeup sources, calling sleep function). Failing to enter sleep mode because a peripheral keeps the MCU awake is a common firmware bug.

Power optimisation without measuring actual current consumption with a power profiler is guesswork. Always measure before and after each optimisation step to confirm the expected improvement was achieved.

66.5 Summary

  • Deep sleep optimization can extend battery life by 5–6x for low-duty-cycle deployments where sleep current dominates the power budget
  • Multi-factor quality scoring (battery, signal, freshness) enables intelligent data filtering that maintains data veracity while reducing processing overhead
  • Critical IoT requires dedicated processing paths with guaranteed latency, while massive IoT can tolerate adaptive sampling and best-effort delivery
  • TCO analysis must include setup, operations, and replacement costs to accurately calculate ROI and payback periods for edge deployments
  • Tiered storage architectures achieve over 1,000x storage efficiency through progressive aggregation and retention policies
  • Fail-closed whitelisting provides the strongest security posture for industrial IoT by rejecting unknown devices before any other security checks
Key Takeaway

Power optimization transforms IoT deployment economics: deep sleep modes can extend battery life by over 5x (from months to years), quality scoring ensures only trustworthy data influences decisions, and priority-based processing guarantees safety-critical sensors get sub-100ms response while non-critical sensors use efficient batch processing. Security at the edge follows a layered defense-in-depth model with fail-closed whitelisting as the first line of defense, and TCO analysis must include all costs to accurately determine ROI.

“Bella’s Big Nap and the Security Guard!”

Bella the Battery had a problem. “I am running out of energy! At this rate, I will only last 95 days – that means someone has to come change me almost four times a year!”

Max the Microcontroller had a brilliant idea. “What if you take a really deep nap between readings? Instead of light sleeping at 1 milliamp, you could deep sleep at just 0.01 milliamps – that is 100 times less energy!”

“But waking up from deep sleep takes 2 whole seconds!” Bella worried. “Is not that a waste?”

“Let me do the math,” Max calculated. “You sleep for about 597 seconds and wake up for only 2 seconds. The tiny wake-up cost is nothing compared to saving energy for almost 10 minutes! You could last for over a year instead of just a few months!”

Meanwhile, a mysterious sensor tried to connect to the factory network. “Hey, let me in!” it said.

“Not so fast!” said Lila the LED, acting as the security guard. “I have a list of 100 approved sensor friends. Your name is not on my list, so you can NOT come in. This is called whitelisting – only my approved friends get through the door.”

“But I could be a good sensor!” the stranger protested.

“Sorry,” Lila said firmly. “In our factory, safety comes first. If I do not know you, the answer is NO. That is called fail-closed security – the door stays locked unless I specifically open it for you.”

Sammy the Sensor added, “And we have a priority system too! Safety sensors get processed IMMEDIATELY – no waiting in line. Regular monitoring sensors can wait a few seconds. It is like an emergency room: heart attacks first, scraped knees can wait!”

What did the Squad learn? Deep sleep saves a lot of battery energy, security whitelists keep strangers out, and priority processing ensures safety-critical data always goes first!

66.6 What’s Next

Current Next
Edge Quiz: Power and Optimization Edge Quiz: Comprehensive Review

Related topics:

Chapter Focus
Edge Quiz: Fundamentals Business case and ROI foundation
Edge Quiz: Data Calculations Data reduction and bundling