%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#2C3E50', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#7F8C8D'}}}%%
flowchart LR
subgraph Supply["Power Supply"]
PS["3.3V"]
end
subgraph Shunt["Measurement"]
R["Shunt R<br/>1Ω - 100Ω"]
V["Voltage<br/>Measurement"]
end
subgraph DUT["Device Under Test"]
D["IoT Device"]
end
PS --> R
R --> D
V -.->|"V = I × R"| R
style Supply fill:#16A085,stroke:#2C3E50
style Shunt fill:#E67E22,stroke:#2C3E50
style DUT fill:#2C3E50,stroke:#2C3E50
1601 Energy Measurement and Profiling
1601.1 Learning Objectives
By the end of this chapter, you will be able to:
- Select appropriate tools for power measurement at different current ranges
- Set up measurement circuits for accurate current profiling
- Interpret power measurement data to identify optimization opportunities
- Use oscilloscopes and power analyzers for IoT development
- Validate battery life predictions through testing
1601.2 Energy Measurement and Profiling
Theoretical calculations provide estimates, but actual measurement is essential for validating designs and identifying unexpected power drains. Many IoT projects fail to meet battery life targets because developers rely solely on datasheet values.
1601.2.1 Why Measurement Matters
| Source | Typical Sleep Current Claimed | Measured Current |
|---|---|---|
| ESP32 Datasheet | 10 µA | 10-20 µA (matched) |
| ESP32 + Dev Board | 10 µA (ESP32 only) | 5-50 mA (USB chip, LDO, LEDs) |
| nRF52840 Datasheet | 1.5 µA | 1.5-3 µA (matched) |
| nRF52840 DK | 1.5 µA | 300-500 µA (LEDs, regulators) |
Key insight: Development boards are NOT representative of final product power consumption. Design custom PCBs for accurate measurement, or measure the MCU chip directly with peripherals disabled.
1601.2.2 Measurement Tool Selection
| Current Range | Measurement Tool | Resolution | Cost |
|---|---|---|---|
| 1 A - 10 A | Benchtop DMM | 1 mA | $50-500 |
| 1 mA - 1 A | DMM with shunt | 10-100 µA | $20-200 |
| 1 µA - 100 mA | Precision shunt + scope | 1-10 µA | $200-1000 |
| 100 nA - 100 mA | Power profiler (Nordic/Qoitech) | 100 nA | $300-1000 |
| 1 nA - 10 mA | SMU (Keithley, Keysight) | 1 nA | $2000-20000 |
1601.2.3 Shunt Resistor Method
The simplest measurement approach uses a shunt resistor in series with the power supply:
Shunt Resistor Selection:
| Current Range | Shunt Value | Voltage Drop at Max | Consideration |
|---|---|---|---|
| 1-100 µA | 1 kΩ | 100 mV @ 100 µA | May affect sleep modes |
| 100 µA - 10 mA | 100 Ω | 1 V @ 10 mA | Significant drop |
| 10 mA - 100 mA | 10 Ω | 1 V @ 100 mA | Heat dissipation |
| 100 mA - 1 A | 1 Ω | 1 V @ 1 A | Low value needed |
| 1 A - 10 A | 0.1 Ω | 1 V @ 10 A | Must handle power |
Challenge: Wide dynamic range (µA sleep to mA active) requires multiple shunts or automatic ranging.
1601.2.4 Dedicated Power Profilers
Modern power profilers solve the dynamic range problem:
| Tool | Current Range | Resolution | Features | Price |
|---|---|---|---|---|
| Nordic PPK2 | 200 nA - 1 A | 100 nA | 100 ksps, logic capture | $99 |
| Qoitech Otii Arc | 1 µA - 5 A | 200 nA | 100 ksps, scripting | $600 |
| Joulescope JS220 | 10 nA - 10 A | 10 nA | 2 Msps, autorange | $1000 |
| Keysight N6705C | 1 nA - 150 A | 1 nA | Lab grade, GPIB | $8000+ |
1601.2.5 Power Profiling Workflow
Step 1: Establish Baseline
1. Remove development board peripherals (LEDs, USB-serial)
2. Power device from profiler, not USB
3. Verify device enters expected sleep mode
4. Measure sleep current (should match datasheet)
Step 2: Profile Each State
1. Configure device for single state (always active, always sleep)
2. Measure current for 60+ seconds
3. Record average, peak, and minimum values
4. Repeat for each power state
Step 3: Profile Full Duty Cycle
1. Configure device for normal operation
2. Capture at least 10 full cycles
3. Calculate average current: I_avg = ∫I(t)dt / T
4. Compare to theoretical calculation
Step 4: Identify Anomalies
Look for:
- Unexpected current spikes during sleep
- Longer-than-expected active periods
- Periodic background activity
- Slow current decay after active phase
1601.2.6 Interpreting Power Profiles
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#2C3E50', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#7F8C8D'}}}%%
timeline
title Typical IoT Power Profile
section Wake-up
0ms : Sleep (10 µA)
1ms : Wake + Init (20 mA)
section Sensing
5ms : Sensor Power-on (15 mA)
50ms : Sensor Reading (5 mA)
section Processing
60ms : Data Processing (30 mA)
section Transmission
100ms : Radio Init (50 mA)
150ms : TX Active (200 mA)
250ms : TX Complete (100 mA)
section Return to Sleep
300ms : Radio Off (20 mA)
350ms : Sleep Entry (10 µA)
1601.2.7 Common Problems and Solutions
| Observed Issue | Likely Cause | Solution |
|---|---|---|
| Sleep current 10× expected | Pull-up on floating GPIO | Configure as output or pull-down |
| Current spikes during sleep | Watchdog timer activity | Disable watchdog in deep sleep |
| Slow decay after active | Peripheral not disabled | Explicitly power down all peripherals |
| Radio current during sleep | Radio not fully off | Use radio shutdown command, not idle |
| Random high-current events | Background task/interrupt | Check all interrupt sources |
| Higher than expected TX | Low battery voltage | Check voltage drop under load |
1601.2.8 Measurement Setup Best Practices
- Power directly from profiler - USB power includes serial chip current
- Use short, thick wires - Minimize resistance and inductance
- Add bulk capacitor - 100-1000 µF near DUT for current spikes
- Disable debug - JTAG/SWD can add 1-10 mA
- Control temperature - Current varies with temperature
- Long measurements - Capture at least 10 full cycles
- Check at voltage extremes - Fresh battery vs. depleted
1601.2.9 Code for Measurement Debugging
// Add GPIO toggles to correlate with power profile
#define PROFILE_PIN 25
void profile_marker_high(void) {
gpio_set_level(PROFILE_PIN, 1);
}
void profile_marker_low(void) {
gpio_set_level(PROFILE_PIN, 0);
}
void measured_operation(void) {
profile_marker_high(); // Scope trigger
read_sensor();
profile_marker_low(); // End of sensor read
profile_marker_high();
transmit_data();
profile_marker_low(); // End of transmission
}1601.2.10 Validating Battery Life Predictions
Accelerated Life Test:
For 5-year battery life, you can’t wait 5 years to validate. Use accelerated testing:
1. Increase duty cycle 100×
- Normal: 1 reading/hour
- Test: 100 readings/hour (36 sec interval)
2. Run for 1 week
- Simulates 2 years of operation
3. Measure battery voltage decline
4. Extrapolate to target lifetime
Margin Calculation:
Measured average current: 85 µA
Target for 5 years on 2400 mAh: 55 µA
Margin: 55/85 = 65% of target
Action needed: Optimize to reduce current by 35%
1601.3 Knowledge Check
Question 1: Your ESP32 development board shows 15mA sleep current, but the ESP32 datasheet claims 10µA. What is the most likely cause?
Development boards include many components beyond the MCU: USB-serial chips (2-10mA), power LEDs (2-20mA), voltage regulators with high quiescent current (10-100µA), and debug interfaces. The ESP32 chip itself achieves 10µA, but the total board current is much higher. Always measure on custom PCBs designed for low power, or measure the MCU supply rail directly.
Question 2: When using a shunt resistor to measure current from 10µA to 100mA, what is the main challenge?
The 10,000:1 dynamic range is the core challenge. A 100Ω shunt gives 1mV at 10µA (hard to measure accurately) but 10V at 100mA (too high a drop). Multiple shunts with switching or dedicated power profilers with automatic ranging are needed to accurately measure across this range.
1601.4 Summary
Key measurement and profiling principles:
- Measure, Don’t Assume: Datasheet values are best-case; real hardware often differs
- Use Appropriate Tools: Match measurement resolution to expected current range
- Profile All States: Measure each power state independently, then full duty cycle
- Look for Anomalies: Unexpected current during sleep indicates optimization opportunities
- Validate Predictions: Use accelerated testing to verify battery life estimates
- Development Boards Lie: Use custom PCBs or isolate MCU for accurate low-power measurement
1601.5 What’s Next
Continue to Energy Harvesting Design to learn how to supplement or replace batteries with harvested energy.