46
Design and Testing for longer battery life in Android Devices & Applications Moe Tanabian

Design and Testing for longer battery life in Android and other Mobile Devices & Applications

  • Upload
    mometan

  • View
    2.665

  • Download
    1

Embed Size (px)

DESCRIPTION

Design and Testing for longer battery lifein Android and other Mobile Devices & Applications

Citation preview

Page 1: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Design and Testing for longer battery life in Android Devices & Applications

Moe Tanabian

Page 2: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Batteries in Mobile Devices – Why are they important? Battery life: second most important purchase decision factor for tablets

Based on 3,835 US online customers who would consider buying a tablet (multiple responses accepted, Source: North American Technologies, Customer Technology Survey 01/2011

Cost of the device Battery Life

Operating System(Apple iOS, Android, Windows) Compatibility with other eq. you own

Cost/Contract flexibility of 3G service Large screen size (i.e. the size of an iPad) Positive reviews (e.g. other users, CNET)

Weight How it looks , feels

Number of available apps The brand of manufacturer

Manufacturer’s tech support Number of ports (e.g. USB, headphone jack, etc.)

Ability to play Adobe Flash content Accessories available

Has camera(s) Ability to watch HD video

Has slide-out keyboard Ability to hold in one hand

65% 51%

40% 32% 32% 31% 31%

28% 26%

23% 22% 21%

19% 19%

16% 15%

13% 13%

12%

2

Page 3: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Outline

3

What influences Battery Life? Objective power consumption measurement Predictive methods to measure power consumption Areas to optimize power consumption Setting up a power measurement lab Hands-on Demo

Page 4: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

The 3 influencing elements on Battery Life – The Battery, The Hardware, and The Software

4

1 2 3

BATTERY HARDWARE SOFTWARE

Page 5: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

The Battery

5

1

Source: http://www.ifixit.com/

Page 6: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Batteries in Mobile Devices – Evaluating batteries

When we describe a battery and how appropriate it is for a particular device and application, we use three metrics to define the battery:

n  Energy density (Power per weight unit, e.g. mA hour per Pound)

n  Number of charging cycles the battery can take

n  Charge rate n  Discharge rate

6

Page 7: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Batteries in Mobile Devices – Battery Chemistry

There are three types of batteries that are extensively in use today, and each provides certain strengths and weaknesses for different type of devices:

n  Nickel Cadmium (NiCd): Strength: mature battery technology, has been around for long.

Weakness: low energy density (Wh/Kg).

Application: long battery life, high discharge rate and price economy are priority.

n  Nickel Metal Hybrid (NiMH): Strength: more advanced Nickel based battery technology,

compared to NiCd has higher energy density Weakness: shorter cycle life

Application: Larger portable devices, Military

7

Page 8: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Batteries in Mobile Devices – Battery Chemistry

n  Lithium Ion (Li-ion): Strength: The newest and fastest growing battery technology.

Li-ion batteries are smaller and lighter (higher energy density)

Weakness: they are more expensive

Application: the main type of battery used in mobile devices and handsets today

- Li-ion battery with steady current within its dominated C can provide 700 charge

Lithium Ion Polymer (Li-ion Polymer):

A lower version of Li-ion battery with smaller profile and more simplified packaging. It has the same energy density as Li-ion batteries.

8

Page 9: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Batteries in Mobile Devices – Battery Chemistry comparison chart

Gravimetric Energy Density(Wh/kg)

45-80 60-120 110-160 100-130

Internal Resistance 100 to 2001 200 to 3001 150 to 2501 200 to 3001

(includes peripheral circuits) in mΩ 6V pack 6V pack 7.2V pack 7.2V pack

Fast Charge Time 1h typical 2-4h 2-4h 2-4h

Overcharge Tolerance moderate low very low low

Self-discharge / Month (room temperature)

20%4 30%4 10%5 ~10%5

Cell Voltage(nominal) 1.25V6 1.25V6 3.6V 3.6V

Load Current- peak 20C 5C >2C >2C

- best result 1C 0.5C or low er 1C or low er 1C or low er

-40 to -20 to -20 to 0 to

60°C 60°C 60°C 60°C

Maintenance Requirement 30 to 60 days 60 to 90 days not req. not req.

Commercial use since 1950 1990 1991 1999

Cycle Life (to 80% of initial capacity)

15002 300 to 5002,3 500 to 10003

Operating Temperature(discharge only)

300 to 500

NiCd NiMH Li-ion Li-ion polymer

Source: Batteries in a portable world by Isidor Buchmann

9

Page 10: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Batteries in Mobile Devices – Discharge profiles of NiCd and NiMH batteries

Source: Batteries in a portable world by Isidor Buchmann

10

Page 11: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Batteries in Mobile Devices – Discharge characteristics of Li-ion battery

Source: Batteries in a portable world by Isidor Buchmann

11

Page 12: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Batteries in Mobile Devices – An electric model for a battery

Source: Batteries in a portable world by Isidor Buchmann

Voc

Ri

Cl Rl

Battery Voc: open circuit voltage Ri : internal resistance Cl : load capacitance Rl : load resistance

12

Page 13: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Batteries in Mobile Devices – Smart Battery packs

Source: Batteries in a portable world by Isidor Buchmann

Smart battery pack should be able to report:

-  Battery’s State of Charge (SoC)

-  State of Health

-  Battery’s chemistry

They come in different complexities: -  Single Wire Bus Terminal

-  SMBus based on a bi-directional two wire I2C data communication

13

Page 14: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

The Hardware

14

2

Source: http://www.ifixit.com/

Page 15: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Power consumption measurement approaches – component, device level

15

n  In this method, the device power consumption is the aggregate of measured power consumption of each subsystem

n This method is more accurate, and the results are more reproducible; it is often used by device OEMs

n  It take more effort and it is more expensive

n Detailed device HW and SW documentation is needed

Component level

n The power is measured at the aggregate point of battery connection in this method; power consumption is measured for different device use cases

n This method is easier, and more practical for most cases; it is widely used by network operators

n Since the results may vary from run to run, it is necessary to repeat the test runs to achieve statistical significance and stability

Device (Application) level

Page 16: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Power consumption measurement approaches – component level

16

For component level measurement, power is measured in relevant device main states: Idle, Suspended and Active

Power is measured at every important component: RF, Processors, Mem, Screen (An LTE device)

Application Processor

Baseband

FDD/TDD LTE 1X / EVDO HSPA(+)

10* X Power Amp Bank

10 X LPF Bank

RF Transceiver

PowerAmp

LPF Bank

RF Transceiver

RF Frontend for other globally supported bands (*assumed 10 bands)

Audio Codec

Accelerometer

Magnetic sensor

Memory (Flash, RAM)

Wi-Fi, Bluetooth

Transceivers

GPS Receiver

Gyroscope

MDM 96XX LTE DC-HSPA, DOrB, EDGE

Graphics Display

Very High Power user

High Power user Moderate Power user

Page 17: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

The Software

17

3

Source: http://www.ifixit.com/

Page 18: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Design for power efficiency – Android Power Management

18

Application 1 Application 2 Application 3 Applications Wl = newWakeLock(…) Wl.acquire() Wl.release()

APP Framework

POWER MANAGER Android.os.PowerManager

Android.os.Power Android.Server.PowerManagerService

LIBRARIES /lib/hardware/power.c

Linux Power Management

Libraries (User Space)

Linux Kernel Power Manager

Source: http://www.kandroid.org/online-pdk/guide/power_management.html

Page 19: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Android Power Manager states – Suspended, Idle, Active

19

A modern mobile device can be in one of the three

power consumption states

Suspended

Active

n All device states written to RAM / Application processor is idle

n Communication processor on low level activity only to receive calls, SMS, etc

n Other components are tuned off by power manager n A device spends significant amount of time in Idle state

n Device is fully awake but no application is active n Main power consuming components in this state are:

Cellular radio, Graphics module, display and CPU

n At least one application is running n Device battery consumption depends on what usage

scenario it is being used under (web browsing, email, voice call, etc)

Idle

Page 20: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Outline

20

What influences the battery life? Objective power consumption measurement Predictive methods to measure power consumption Areas to optimize power consumption Setting up a power measurement lab Hands-on Demo

Page 21: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Power consumption profiling for different subsystems – test cases

21

Display subsystem

Network subsystem

CPU and RAM

Audio subsystem

n  Measurement of backlight at minimum and maximum intensity in mW n  Complete WHITE screen n  Complete BLACK screen n  White noise screen for benchmarking different Graphics chip sets and LCDs

n  A good test: Downloading a file with random data content via HTTP n  Shielded device test to benchmark effect of signal strength on power consumption and throughput - a 2mm think metal shielded box that can drop the signal strength by 10dBm for cellular and 2dBm drop for Wi-Fi

n  A benchmark that causes a good spectrum of utilization of the CPU and the memory from highly CPU bound to highly memory bound e.g. SPEC CPU2000 n  A series of READ and WRITE operations for measuring power impact of internal NAND flash and SD card. E.g. copying a file with random data

n  Audio playback of a music file: e.g. a sample of 12.3MiB, for 10 minutes at 44.1 KHz MP3 file stored on internal NAND flash and SD card n  Need to include cellular radio power into account since the device needs to be ready to receive calls, SMS

GPS n  Different scenarios: device Idle, device running a GPS app, Satellite acquisition, navigation and guidance n  In smartphones, the GPS power consumption is minimal compared to other subsystems and can be skipped

Page 22: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Power consumption profiling for different subsystems – test cases

22

Test cases for Display component

Page 23: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Measuring power consumption – multi-core devices

23

Multi-core devices can be more power efficient than single core devices

Page 24: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

24

Video call test case: a capture all test for device level benchmarking power consumption and benchmarking of several devices

Multi-device benchmarking

For multi device benchmarking, video call application utilizes many of important components of a mobile device, given that:

n Hardware specifications of the devices under test are similar

n Same application is used for video calling, or at least call features are close or identical such as video resolutions, bandwidth utilization, etc

n Test conditions need to be standardized and similar for every device to make the results reliable and reproducible

Device (Application) level

Page 25: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Power consumption measurement approaches – device level

25

Device (Application) level

Number of tests runs required

N = t x f x nt

N : The total number of required power readings (Rule of thumb for stable test results N >= 10K)

t : Duration of sample collection (min) f : number of samples collected per second nt : Number of test runs

Page 26: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

26

Power consumption measurement – the cloud effect

The cloud effect can hinder power consumption measurement accuracy

Issue: Cloud services can change their behavior and these changes have significant implications on power consumption of the device: Example: when playing a YouTube™ video, the server often adjusts the resolution based on the client’s capabilities and the connection throughput

Issue: Many smartphone applications constantly and in an ad-hoc way exchange data with backend servers that are not user driven or user controllable. Example: Google Map

Solution: Re-create the use scenario in a controlled lab environment

In Android: To recreate the input sequence of actions, while running the real cloud based test, use captured user input interactions traces: /dev/input/event* Android kernel can re-run the sequence by reading this information

Device (Application) level

Page 27: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Outline

27

What influences the battery life? Objective power consumption measurement Predictive methods to measure power consumption Areas to optimize power consumption Setting up a power measurement lab Hands-on Demo

Page 28: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

28

Predictive methods– Two Predictive methods are based on building mathematical Power Consumption models for each major component of the device

n A formula is built to predict Device Power consumption as a function of power consumption of each component

n Through a series of measurements, power consumption factor of each component is determined and the model is calibrated

n The model then can be used to estimate device power consumption of an application or task based on the time periods each component is “ON”

Models based on real device

measurements

n The Discharge behavior of the battery is determined

n Each component’s power consumption factor is determined based on its the % it decreases energy level of the battery for a period of time e.g. 15min – and the model is calibrated based on this factor

n  The model then can be used to estimate device power consumption of an application or task based on the time periods each component is “ON”

Models Training based on Battery Discharge states

Page 29: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

29

Predictive methods– Model calibration based on real device measurement

1.  Identify major components to be included in the model e.g. Display

2.  Identify the System Variable (SV) corresponding to each component e.g. screen brightness intensity

3.  Build the device power consumption model as a function of all the SVs

4.  In a series of measurements, isolate each major component and measure the power consumption factor directly

5.  Use the model to predict power consumption of the different use cases and tasks in your applications

Σ SV x βsv β: System Variable factor SV: System Variable value

Current sensing resistor

Stabilizing Capacitor

Battery / Power supply

Device Source: Google, U. of Michigan

Page 30: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

30

Predictive methods– Model calibration based on battery Discharge State

∆ 1.  Identify major components to be included in the model e.g. Display

2.  Identify the System Variable (SV) corresponding to each component e.g. screen intensity

3.  Build the device power consumption model as a function of all the SVs

4.  In a series of measurements, isolate each major component and determine the power consumption factor based on the battery SoC (vi)

5.  Use the model to predict power consumption of the different use cases and tasks in your applications

P x (t1-t2) = E x (SOC(V1) – SOC(V2)) P: AVG Power consumption in time t1-t2 E: Rated battery energy capacitySOC(Vi): Battery State of Charge at voltage Vi

Source: Google, U. of Michigan

(Delta E)

Page 31: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Outline

31

What influences the battery life? Objective power consumption measurement Predictive methods to measure power consumption Areas to optimize power consumption Setting up a power measurement lab Hands-on Demo

Page 32: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

32

Design for power efficiency – GUI

Making GUI more power efficient

GUI facilitates most of the user interactions, and since it fully utilizes the screen, it’s a major power consuming part of the device software.

GUI provides INPUT, OUTPUT and HYBRID UI functions.

Here are factors that design can take into consideration:

n  Cognitive latency

n Perceptual capacity

n Hot keys

n User input cache

n Direct GUI power reduction

n Backlight control

n Frame buffer compression

Page 33: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Design for power efficiency – GUI – Cognitive latency

33

n Reducing Cognitive Latency makes GUI more power efficient:

n Cognitive latency is the time that the user needs to understand the number of GUI elements present on the screen.

If N is the number of element to choose, then:

(Hick-Hayman Law)

reaction time (sec) = a + b log2N (a, b constant)

Cognitive Latency

Page 34: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Design for power efficiency – GUI – Cognitive latency

34

A very effective way to reduce cognitive latency is decreasing the number of options from which the user can make a selection. Split menu is a good example of a GUI element with low cognitive latency. Cognitive

Latency

Number of choices on screen

Tim

e ta

ken

to re

spon

d (s

ec)

3

Page 35: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Design for power efficiency – GUI – Perceptual capacity

35

n Better visibility of the GUI elements being presented to the user lowers required user interaction time

n font type

n font size

n color,

n GUI component size

n color and optimal contrast ratio

Perceptual Capacity

Page 36: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Design for power efficiency – GUI – other stuff

36

n Hot keys

n User input cache

n Direct GUI power reduction

n Backlight control

n Frame buffer compression

Other stuff

Page 37: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Design for power efficiency – proper use of wakelock(), wifilock()

37

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);

PowerManager.WakeLock wl = pm.newWakeLoc(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");

wl.acquire();

..screen will stay on during this section..

wl.release();

Flag value CPU Screen Keyboard

PARTIAL_WAKE_LOCK On Off Off

SCREEN_DIM_WAKE_LOCK On DIM Off

SCREEN_BRIGHT_WAKE_LOCK On Bright Off

FULL_WAKE_LOCK On Bright Bright

ACQUIRE_CAUSES_WAKEUP Forces screen and/or KB to illuminate without waiting for user interaction

ON_AFTER_RELEASE User activity timer will be reset. Screen, KB will stay ON a bit longer

Source: http://developer.android.com/reference/android/os/PowerManager.html

Page 38: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Design for power efficiency – proper use of wakelock(), wifilock()

38

n wakelock()

n Device battery life significantly affected by the use of wakelock()

n Do not acquire wakelock()s unless you ABSOLUTELY need them

n When you acquire wakelock()s, use minimum level possible

n Make sure you release the lock when you’re done

n wifilock()

n When syncing with the server, use longer periods (less frequent: 1 every hr instead of 1 every 5min)

n Release the lock when you’re done

n  Example: A good justification for wifilock() is when downloading large files

wakelock(), wifilock()

use best practice

Page 39: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Outline

39

What influences the battery life? Objective power consumption measurement Predictive methods to measure power consumption Areas to optimize power consumption Setting up a power measurement lab Hands-on Demo

Page 40: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Setting up a power measurement lab – Lab functions

40

n System to sample voltage, current and power at high sampling frequency rates

(1000 sample per second and above)

n System to host simulated cloud services

n Equipment to measure ambient light

n Equipment to measure ambient noise

Lab functions

Page 41: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Setting up a power measurement lab – Voltage, current & power measurement

41

Page 42: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Setting up a power measurement lab – Voltage, current & power measurement

42

National Instrument USB-4065 USB DMM

National Instrument LabView Software

Monsoon Power Monitor

Page 43: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Setting up a power measurement lab – Measuring ambient light, noise

43

Sound level Meter Lux Meter

Page 44: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Setting up a power measurement lab – Connecting to the device

44

Current sensing resistor

Stabilizing Capacitor

Battery / Power supply

Copper Conductive adhesive tape

Battery adapter

Page 45: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

Outline

45

What influences the battery life? Objective power consumption measurement Predictive methods to measure power consumption Areas to optimize power consumption Setting up a power measurement lab Hands-on Demo

Page 46: Design and Testing for longer battery life in Android and other Mobile Devices & Applications

46

Thank You!

Moe Tanabian @motanabian