Energy & Power · Study deck

Measure-First Optimization

Picture a battery sensor that dies early even after its code was made faster.

Battery Bruno is your guide for this deck.

optimization
Battery Bruno, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: A processor generation can leapfrog its predecessor before a comparable battery generation ships, which is why a design that assumes "the next chip will just be more efficient" is gambling on the wrong curve.
  • Explain: The transition explains the caption's core point — bar comparison of dominant, secondary, and minor contributors to a measured budget, with notes on hidden contributors and the Amdahl limit on whole-system gain.
  • Explain: More devices and services should make the system's decisions more useful without letting security, privacy, energy, or management cost grow faster than the benefit.
iotclass.org

Major section

Start With One Measured Bottleneck

Firmware means the software stored on the device that controls sensing, sleep, radio use, and recovery.

  • Duty cycle means the share of time a device spends active instead of resting.
  • This proves one change improved one measured budget, not every device goal; the deeper sections compare bottlenecks, trade-offs, constraints, and verification.
  • Optimization without evidence is guesswork.
iotclass.org

Major section

Four Optimization Dimensions · Speed

Most IoT optimization decisions can be described with four dimensions.

  • If Speed cannot be connected to latency trace, the surrounding conclusion is premature.
  • Speed is about time to complete work or respond to an event.
Optimization trade-off map showing speed, size, power, and energy as separate design dimensions with different evidence sources.
Optimization trade-off map showing speed, size, power, and energy as separate design dimensions with different evidence sources.
iotclass.org

Major section

Energy · Checkpoint: Name The Target Dimension

Energy is power accumulated over time.

  • The same change can improve one dimension while harming another.
  • Compressing a packet may reduce radio airtime but add compute time.
  • Deep sleep may lower average energy but add wake latency.
  • The right choice depends on the product target and measured workload.

Why it matters

For example, caching a lookup result may reduce CPU time but use more RAM.

iotclass.org

Major section

Why Energy Becomes the Constraint

More devices and services should make the system's decisions more useful without letting security, privacy, energy, or management cost grow faster than the benefit.

  • Device count does not automatically make an IoT system more valuable.
  • The desired curve is different.
  • A desktop processor can dissipate tens or hundreds of watts with a heat sink and fan.

Why it matters

A change that saves 5 ms of CPU time but forces a radio retry, raises sleep current, increases support tickets, or exposes more household behavior may reduce the product's real value.

iotclass.org

Major section

Why Energy Becomes the Constraint (continued)

The optimization record should therefore name the physical limit as well as the software change.

  • A fleet that adds sensors faster than it adds trustworthy decisions can flatten out: each new device brings battery service, credential rotation, firmware updates, privacy review, support load, and failure modes.
  • A phone may have only about a watt of comfortable thermal headroom.
  • For IoT, the practical conclusion is direct: value, privacy, support, and energy are coupled.
iotclass.org

Major section

Why Energy Becomes the Constraint (continued)

A processor generation can leapfrog its predecessor before a comparable battery generation ships, which is why a design that assumes "the next chip will just be more efficient" is gambling on the wrong curve.

  • A wearable sensor may live in the uW-mW range, where an always-on radio, LED, regulator, or debug bridge can dominate the budget.
  • As features shrink, the same chip area can try to do more work, but the heat has to leave through a package, enclosure, skin surface, or nearby air.
  • A defensible optimization proves that the full system improves, not only that one number moved.
iotclass.org

Major section

Power, Energy, And Switching Reality · Checkpoint: Include The Whole Device

It sets heat, regulator, and capacity limits.

  • For a transactional workload, throughput and average power may dominate the review.
  • For a non-transactional job, completion time and total energy may matter more.
  • The comparison with biological systems is a useful warning, not a product requirement.

Key terms

Energy
Energy is power accumulated over time.
Energy proportionality
Energy proportionality is the missing property in many systems.

Why it matters

Circuit choices can use slower or higher-threshold devices where timing slack allows it, because faster devices are often larger and leak more.

iotclass.org

Major section

Measurement-First Loop · Optimization Record

Optimization should be treated as a controlled loop, not a collection of tricks.

  • Their pairing demonstrates that cyclic optimization loop through target, profile, select the bottleneck, change, verify, and re-profile, one change per pass.
  • Latency, lifetime, memory limit, current limit, reliability target, or update size.

Why it matters

This record prevents the team from keeping changes that only look faster in one narrow test.

Measurement-first optimization loop: target, profile, select the bottleneck, change one thing, verify, and re-profile before repeating.
Measurement-first optimization loop: target, profile, select the bottleneck, change one thing, verify, and re-profile before repeating.
iotclass.org

Major section

Bottlenecks And Limits

A bottleneck is the part of the system that dominates the resource you care about.

  • If a function consumes most of the active time, a speed optimization there may matter.
  • If sleep current dominates the energy budget, rewriting a fast function may not change battery life.
  • Its Dominant and: Secondary labels identify the conditions that must be checked together.

Key terms

If a task
If a task is only a small part of the measured cycle, making it dramatically faster may barely change the total.
Bottleneck analysis: a dominant contributor deserves optimization effort first, while minor contributors have limited whole-system impact; hidden contributors and the Amdahl limit constrain the gain.
Bottleneck analysis: a dominant contributor deserves optimization effort first, while minor contributors have limited whole-system impact; hidden contributors and the Amdahl limit constrain the gain.
iotclass.org

Major section

Bottlenecks And Limits (continued)

The transition explains the caption's core point — bar comparison of dominant, secondary, and minor contributors to a measured budget, with notes on hidden contributors and the Amdahl limit on whole-system gain.

  • That point is the next premise in bottlenecks and limits.
  • $$whole\ improvement\ is\ limited\ by\ the\ fraction\ you\ actually\ improve$$.
  • If a task is only a small part of the measured cycle, making it dramatically faster may barely change the total.
iotclass.org

Major section

Worked Review: Duty-Cycled Sensor · Example Review Conclusion

Most of the cycle time is spent asleep, but the measured sleep current is higher than expected.

  • Batch readings and shorten the receive window within protocol limits.
  • Useful candidate, but must be checked against delivery latency and retry behavior.
  • Formatting takes measurable CPU time but is a small fraction of the full cycle.
iotclass.org

Deck summary

Key takeaways

Firmware means the software stored on the device that controls sensing, sleep, radio use, and recovery.

  • Most IoT optimization decisions can be described with four dimensions.
  • Energy is power accumulated over time.
  • More devices and services should make the system's decisions more useful without letting security, privacy, energy, or management cost grow faster than the benefit.
  • The optimization record should therefore name the physical limit as well as the software change.
iotclass.org

Retrieval practice

Recall check 1 of 5

Battery Bruno says: answer from memory, then check your reasoning.

Q1A sensor node spends most of its reporting cycle asleep. A timing trace shows that a formatting function uses a small fraction of the active time, while the current trace shows sleep current is much higher than expected. Which optimization should be investigated first?

AShorten the formatting function to reduce active time
BIncrease the sampling rate so more data is collected per day
CInvestigate sleep-state configuration and wake-source behavior.
DEnable a compiler optimization preset to reduce active execution time
Show answer

Answer: C Optimization should be tied to the measured bottleneck and a clear target.

iotclass.org

Retrieval practice

Recall check 2 of 5

Battery Bruno says: answer from memory, then check your reasoning.

Q2A compact binary payload reduces radio airtime but makes field logs harder for support engineers to inspect. What is the best way to evaluate this change?

AKeep the binary payload because reduced airtime should lower the charge spent sending each report
BReject the binary payload because readable field logs reduce the time needed to diagnose failures
CUse a trade-off ledger and test radio energy, decoder compatibility, log tooling, and failure recovery
DMeasure only CPU time because the payload encoder runs on the microcontroller
Show answer

Answer: C Optimization is multidimensional.

iotclass.org

Retrieval practice

Recall check 3 of 5

Battery Bruno says: answer from memory, then check your reasoning.

Q3Place each optimization record item where it lives so you can improve one metric without hiding a regression in another.

ASuccess Contract
BBaseline
CTrade-off
DComparable Evidence
Show answer

Answer: A Tie the success contract to a measured baseline, an explicit trade-off, and comparable verification so you can distinguish genuine system improvement from a shifted cost.

Q4How can a processor that draws more current use less battery energy for a fixed task?

AIt cannot; more current always means more energy.
BBy staying awake longer at a low clock.
CBecause peak power is the only thing that drains a battery.
DBy running faster it finishes sooner and returns to a low-power sleep.
Show answer

Answer: D Energy is current times time.

iotclass.org

Retrieval practice

Recall check 4 of 5

Battery Bruno says: answer from memory, then check your reasoning.

Q5At constant voltage, an 8 Mcycle task costs 2.20 mA-s at 16 MHz and 1.53 mA-s at 48 MHz. Which part of the energy made the faster clock cheaper?

AThe fixed 2 mA active overhead
BThe dynamic energy fell because the clock was higher.
CThe sleep current dropped at 48 MHz.
DNothing; the two energies are actually equal.
Show answer

Answer: A Dynamic energy for a fixed cycle count is 1.2 mA-s either way. The saving comes from paying the fixed 2 mA awake overhead for one third of the time.

iotclass.org

Retrieval practice

Recall check 5 of 5

Battery Bruno says: answer from memory, then check your reasoning.

Q6A team pushes the clock higher for race-to-sleep, but this part requires a higher core voltage at the top clock, and measured energy gets worse. What explains it?

ADynamic energy scales with voltage squared
BHigher clocks always use less energy, so the measurement is wrong.
CThe sleep floor rose with the clock.
DFixed overhead increased because the task ran faster.
Show answer

Answer: A When faster requires more voltage, the square-law dynamic term can exceed the linear time saving.

iotclass.org

Print reference

Answers 1 of 2

Answer key.

  1. C · Optimization should be tied to the measured bottleneck and a clear target.
  2. C · Optimization is multidimensional.
  3. A · Tie the success contract to a measured baseline, an explicit trade-off, and comparable verification so you can distinguish genuine system improvement from a shifted cost.
  4. D · Energy is current times time.
  5. A · Dynamic energy for a fixed cycle count is 1.2 mA-s either way. The saving comes from paying the fixed 2 mA awake overhead for one third of the time.
iotclass.org

Print reference

Answers 2 of 2

Answer key.

  1. A · When faster requires more voltage, the square-law dynamic term can exceed the linear time saving.
iotclass.org