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: 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: Whole-system 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.
  • Explain: 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.
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.

  • The third panel moves from a written baseline to one hardware change and a new reading; the fourth shows a higher battery level with a working radio.
  • Optimization without evidence is guesswork.
Dynamic-voltage scaling changes the race-to-sleep decision because voltage enters the dynamic-power term as a square, not as a small linear adjustment.
Dynamic-voltage scaling changes the race-to-sleep decision because voltage enters the dynamic-power term as a square, not as a small linear adjustment.
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)

whole improvement is limited by the fraction you actually improve

  • 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 a task is only a small part of the measured cycle, making it dramatically faster may barely change the total.
  • If a state dominates the current trace, a modest improvement there can matter more than a dramatic improvement elsewhere.
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
BInvestigate sleep-state configuration and wake-source behavior.
CIncrease the sampling rate so more data is collected per day
DEnable a compiler optimization preset to reduce active execution time
Show answer

Answer: B 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
BUse a trade-off ledger and test radio energy, decoder compatibility, log tooling, and failure recovery
CReject the binary payload because readable field logs reduce the time needed to diagnose failures
DMeasure only CPU time because the payload encoder runs on the microcontroller
Show answer

Answer: B Optimization is multidimensional.

iotclass.org

Retrieval practice

Recall check 3 of 5

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

Q3What proves an optimization gain under the same workload and guardrails as baseline?

ASuccess Contract
BComparable Evidence
CBaseline
DTrade-off
Show answer

Answer: B Verification belongs after the change because the same workload and guardrails must show the gain is real, repeatable, and free of unacceptable regressions.

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

AIt cannot; higher task current means higher total charge.
BIt saves energy by remaining awake longer at lower speed.
CIt finishes sooner and returns to low-power sleep sooner.
DUse peak power alone to set battery use because peak draw represents the full operating duration.
Show answer

Answer: C 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 uses 2.20 mA-s of charge at 16 MHz and 1.53 mA-s at 48 MHz. Which part of the energy made the faster clock cheaper?

ADynamic task energy necessarily falls as clock rises.
BThe sleep current itself drops at the higher clock.
CThe fixed active overhead lasts less time at 48 MHz.
DThe measured 2.20 and 1.53 mA-s charges are equal.
Show answer

Answer: C Dynamic charge 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?

AHigher clocks always save energy, so the trace is wrong.
BThe sleep floor must rise whenever CPU clock rises.
CFixed overhead grows because execution finishes sooner.
DHigher core voltage raises dynamic energy roughly with V².
Show answer

Answer: D 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. B · Optimization should be tied to the measured bottleneck and a clear target.
  2. B · Optimization is multidimensional.
  3. B · Verification belongs after the change because the same workload and guardrails must show the gain is real, repeatable, and free of unacceptable regressions.
  4. C · Energy is current times time.
  5. C · Dynamic charge 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. D · When faster requires more voltage, the square-law dynamic term can exceed the linear time saving.
iotclass.org