Hardware-assisted energy monitoring architecture for micro sensor nodes

Hardware-assisted energy monitoring architecture for micro sensor nodes

Journal of Systems Architecture 58 (2012) 73–85 Contents lists available at SciVerse ScienceDirect Journal of Systems Architecture journal homepage:...

2MB Sizes 5 Downloads 35 Views

Journal of Systems Architecture 58 (2012) 73–85

Contents lists available at SciVerse ScienceDirect

Journal of Systems Architecture journal homepage: www.elsevier.com/locate/sysarc

Hardware-assisted energy monitoring architecture for micro sensor nodes Sukwon Choi a, Hayun Hwang a, Byunghun Song b, Hojung Cha a,⇑ a b

Department of Computer Science, Yonsei University, Seodaemun-gu, Shinchon-dong 134, Seoul 120-749, Republic of Korea RFID/USN Convergence Research Center, Korea Electronics and Technology Institute, #68 Yatap-dong, Bundang-gu, Seongnam, Gyeonggi Province 463-816, Republic of Korea

a r t i c l e

i n f o

Article history: Received 1 September 2010 Received in revised form 5 December 2011 Accepted 12 December 2011 Available online 28 December 2011 Keywords: Wireless Sensor Network Energy management Battery monitor IC

a b s t r a c t In this paper, we present a hardware-assisted energy monitoring architecture, HEMA, which provides power information for individual system components in micro sensor nodes. HEMA gives information on how the system components of sensor nodes spend energy while applications are running. To develop a practical runtime monitoring system we used a power monitoring technique based on a battery monitor IC (Integrated Circuit) which is typically used in embedded systems. HEMA uses a software technique to monitor device usage patterns, and combines it with hardware-assisted power information in runtime. However, the battery monitor IC has problems in monitoring individual devices. In this paper, we developed a software technique to supplement its drawbacks. To evaluate the proposed system, we built a micro sensor node with battery monitor IC. We operated real applications on the sensor node and conducted a comparative analysis with a dedicated power monitor. Our experiment results show that HEMA indeed provides a suitable architecture for runtime power analysis with low overhead. Ó 2011 Elsevier B.V. All rights reserved.

1. Introduction Power management is an important issue in Wireless Sensor Networks (WSNs) [1] since micro sensor nodes are typically powered by energy-limited batteries. Although sensor network technology has recently been applied to various applications, battery lifetime is still a major limiting factor for the widespread use of sensor applications. Alternatively, researchers have studied energy harvesting schemes such as solar panels [2], but the amount of harvested energy is limited and the system has similar problems to those found in batteries. Power management to extend battery lifetime, therefore, becomes more important and active research has been done in recent years. An appropriate power management technique for sensor nodes is to detect an idle device operation and change it to reduce unnecessary energy consumption [3]. The energy consumption of a sensor node is affected by node type, deployed environment, and application [4]. In addition, batteries have chemical characteristics that affect battery lifetime of sensor nodes [5]. Runtime energy monitoring is, therefore, an important issue for the efficient power management of sensor nodes, and an essential functionality required for any practical system [6]. Various approaches are found for runtime and off-line energy monitoring of sensor nodes. Dunkels [7] proposed a runtime software-based energy estimation technique and Landsiedel [8]

⇑ Corresponding author. Tel.: +82 2 2123 5711; fax: +82 2 365 2579. E-mail address: [email protected] (H. Cha). 1383-7621/$ - see front matter Ó 2011 Elsevier B.V. All rights reserved. doi:10.1016/j.sysarc.2011.12.001

proposed off-line techniques. These approaches may perform incorrect power profiling due to unstable power models and inaccurate pre-measured power data for individual devices. To overcome the limitations of software-based monitoring, hardware-assisted power monitoring techniques were proposed. Trathnigg [9] and Jiang [10] suggested power measuring hardware that should be connected to sensor node to collect data. An on-board hardware-based power monitoring technique was also proposed. Stathopoulos [11] suggested EndScope using the current monitor IC [12]. EndScope provides real-time energy usage information for individual devices but the system is not suitable for resource-constrained sensor nodes. Fonseca [13] proposed Quanto, which traces the energy consumption of a device using iCount [14] that is combined with a software technique. iCount uses a PFM (Pulse Frequency Modulation)-type DC–DC switching regulator and timer on a microcontroller, which counts the switch cycle of the regulator. For continuous energy monitoring, however, iCount uses a system timer on the microcontroller, which would affect the application performance. Recent advances in CMOS technology have enabled the development of a micro-sized battery monitor IC [15]. The hardware has a small form factor and consumes little power; hence, it can readily be integrated into a sensor node. Using a battery-monitoring IC is a common technique to manage batteries in typical embedded devices. In Wireless Sensor Networks, the conventional belief is that using a hardware IC would involve additional cost, power, and access time overhead. However, the recent widespread use of batteries in micro sensor nodes will accelerate the use of a battery monitor IC [16].

74

S. Choi et al. / Journal of Systems Architecture 58 (2012) 73–85

In this paper, we describe HEMA, a hardware-assisted energy monitoring architecture for micro sensor nodes. Our primary objective is to provide an energy monitoring architecture that monitors power consumption of resource-constrained sensor nodes in real-time. In particular, HEMA is designed to provide a method for monitoring individual devices in sensor nodes. Our system provides a software technique to handle hardware-assisted power monitoring information. For a practical use of the system, we use a battery-monitoring IC, which is commonly used in mobile embedded systems. The software technique provides a power trace of individual hardware components in a sensor node by using incomplete power information from the battery monitoring IC. The remainder of the paper is organized as follows: In Section 2, we describe why we chose a battery monitor IC as a hardware assistant and discuss its limitations. We present the system design of HEMA in Section 3. In Section 4, we show how we implement HEMA in a real sensor network environment. The evaluation results are shows in Section 5. We conclude the paper in Section 6. 2. Backgrounds Runtime power monitoring of non-trivial sensor applications is not easy because of the implementation overhead. Any practical energy management of sensor networks requires an accurate yet efficient power monitoring method in order to acquire detailed power data. We have considered the use of a battery monitor IC for this purpose. 2.1. Motivation Power management for sensor devices typically includes dynamic power management (DPM) [3,17]. The key idea of DPM is to understand the underlying device’s on/off/sleep usage patterns. A DPM algorithm should understand power consumption pattern of devices according to this pattern, and analyze correct timing of power mode transition. A typical DPM mechanism uses pre-defined power consumption information that has been derived from pre-profiling of the underlying system. The pre-profiling information, however, cannot reflect issues such as data bus delay, connection overhead, or the relationship between other devices [18]. If the DPM mechanism uses profile information, sensor device characteristics cannot be detected, and consequently an efficient DPM algorithm is hard to be developed. To construct practical DPM

mechanisms, a continuous and accurate mechanism is necessary to monitor battery power and measure overhead of device power mode change. Therefore, DPM mechanism requires runtime power monitoring of individual devices. Software-based power monitoring is a common technique adopted by many practitioners in the field [7,8]. The method uses the ADC (Analog to Digital Converter) reference voltage from microcontroller for runtime monitoring, which indicates the battery supply voltage. A software-based power monitoring technique changes this data to power-related information. The information is then combined with pre-profiled data and used for prediction of battery residual, current power consumption, and remaining lifetime. Fig. 1 shows the comparison of the software-based power voltage monitoring and hardware-assisted monitoring. Y-Mote (refer Fig. 13) powered by 2AA alkaline battery was used for the experiments. Two types of workloads were used: high-workload (Fig. 1(a)) and 50% duty cycle (Fig. 1(b)). High-workload uses all the sensors device and radio devices actively. The 50% duty cycle turns on the radio device for one second and turns it off for one second repeat. For high-workload, the hardware-assisted monitoring shows a steady decrease in remaining voltage whereas the software method shows fluctuations due to the ADC noise. The 50% duty cycle workload exhibits the similar results, but the fluctuations are becoming noticeable both in hardware and software-based monitoring. Software-based power monitoring uses a battery voltage level as base information to calculate battery residual or to detect the transition time of device’s power status by comparing with the power profile. The lack of accurate information makes it hard to develop an efficient power management algorithm. Power management in most of the previous research was conducted in a limited environment or simulation situation. Real-world sensor applications should require practical lifetime reservation techniques based upon accurate run-time estimation of battery residual as well as the power consumption. 2.2. Why use battery monitor ICs? Power monitors in sensor nodes should operate the microcontrollers independently. However, previous research has typically focused on precise current monitoring and rarely considered microcontroller overhead. One case of an accurate and powerful energy monitoring system is EndScope [11]. The system allowed for a new sensor node design where major devices are connected

Fig. 1. Comparison of the software-based power monitoring and the hardware-based monitoring.

S. Choi et al. / Journal of Systems Architecture 58 (2012) 73–85 Table 1 DS2730 specification [15]. Parameter

Specification

Overhead

Supply voltage ACTIVE current SLEEP mode current

2.5 V 65 lA 1 lA

Accuracy

Voltage resolution Voltage error Current resolution Current gain error

±50 mV 1.56 lV 1.56 lV ±1%

to a current monitor IC for energy monitoring. The current monitor IC provides accurate but momentary energy information about the device. Hence, understanding the power usage pattern of the device is necessary with continuous access to the current monitor IC. The current monitor IC uses the microcontroller’s resources such as ADC (Analog to Digital Converter), I2C bus, and serial bus. Because of this problem, EndScope is designed to use a dual processor: one is the ARM-based application processor, and the other is a microcontroller for energy monitoring. This approach should not be suitable for use with micro sensor nodes. The primary goal of using a battery monitor IC is to provide precise supply voltage and battery residual information to end-users when a mobile device is supplied system power from a lithiumion or lithium-polymer battery. Most battery monitor ICs offer current measurement and accumulation functions in real-time, which potentially provide runtime power-consumption information for embedded devices. We conducted experiments to understand how well a battery monitor IC provides power related information. We used the DS2782 [15] battery monitor IC in a micro sensor node. The hardware specification of the chip is shown in Table 1. We examined how the battery monitor IC monitored electronic current. Four types of workloads were used for the experiments. Low-workload meant all sensor devices and radio devices were turned off except for the microcontroller. High-workload used all of the device and radio devices actively. The other two workloads used radio duty cycles of 8% and 50%. The 8% duty cycle workload turned on the radio device for 250–260 ms, and turned it off for three seconds, repeatedly. The 50% duty cycle workload turned on the radio device for one second and turned it off for one second repeatedly. The results are shown in Fig. 2. The battery monitor IC used in our experiment colleted 150 samples every 3.3 s. Low-workload

75

showed continuous power consumption, and high-workload delivered a comparatively linear change of power consumption. In the case of 50% and 8% duty cycles, fluctuations of current occurred. The results validated the idea that power monitoring based on a battery IC can monitor the on/off usage pattern of a device as well as its power consumption. In addition, the mechanism generated accurate current information, which can be used as a useful input for practical power management. Most battery monitor ICs have on-chip EEPROM (Electrically Erasable Programmable Read-Only Memory) and accumulators to save long-term energy information. These structural features of the battery monitor IC provide the microcontroller an independent power monitoring function by reducing sampling rate. Fig. 3 shows the performance comparison of battery monitor IC-based energy monitoring and the microcontroller-based methods which include iCount, current monitor IC-based, and the pure software-based approach. The monitoring period was approximately 50 ms, which is the minimum period for using software filter (We used the Least Mean Square Method). This is to minimize fluctuations due to the ADC noise shown in Fig. 1. Fig. 3 shows that the microcontroller-based monitoring causes about 10 times more overhead than the battery monitor IC. This is because the battery monitor IC has twofold bus overhead due to structural features, whereas the current monitor IC uses ADC during the monitoring period. This overhead would disrupt sensor operations or cause jitters in sensor-intensive applications. Table 2 also shows a comparison between the battery monitor IC-based power monitoring and other methods. Using a battery monitor IC is shown to be a good choice for an energy monitor for micro sensor nodes.

2.3. Problem In spite of the various advantages mentioned previously, a battery monitor IC has limited adaptability to our target system. To understand the potential and limitations of a battery monitor IC-based energy monitoring technique we conducted preliminary experiments. We obtained the measurement results using a battery monitor IC, a custom-built high-performance measuring instrument, and a software-based energy monitoring technique. We built a high frequency power measurement device, shown in Fig. 4, to handle the dynamic current level of micro sensor nodes. The instrument used an 18-bit ADS8381 ADC [19] and a TMS320f28335 DSP

Fig. 2. Current monitoring data by battery monitor IC.

76

S. Choi et al. / Journal of Systems Architecture 58 (2012) 73–85

Fig. 3. Comparison of microcontroller occupation: microcontroller-based approach and battery monitor IC-based approach. Fig. 4. Experiment Setup. Table 2 Power monitoring techniques. Method

Accuracy

Range

Microcontroller overhead

Energy overhead

Software technique [7,8] iCount [14] Current monitor IC [11] Battery monitor IC

Low

Low

High

Low

High High

High High

High High

Low High

High

Low

Low

Low

(Digital Signal Processor) [20]. The same method was used for the battery monitor IC-based technique we used in Section 2. We also implemented a simple software technique that traces a device’s activity and matches it with pre-measured power information. Three types of workloads were used for the experiments: (1) the sensor is constantly turned on (Sensor-On), (2) the sensor is constantly turned off (Sensor-Off), (3) the sensor is alternately on and off (Sensor-On&Off). We used a gyro sensor in the sensor node to detect workloads. The results are shown in Figs. 5 and 6. In the case of Sensor-On and Sensor-Off, the results for the battery monitor IC-based measurements and the measuring instrument were the same. This is because the battery monitor IC

Sensor-On-Off (BM Trace)

Current (mA)

Sensor-On-Off (S/W Trace)

measures the system current accurately. In the case of SensorOn&Off the battery monitor IC data is represented as a line (BM Trace). This is because the sampling rate of the battery monitor IC is too low to detect the transition timing of the device. Fig. 5 also shows the software-based monitoring results (S/W Trace) for the exact transition timing of the device. However, monitored data by software-based monitoring does not contain the transition overhead shown in Fig. 6. The overhead is shown as an irregular peak power that influences the total power consumption in the micro sensor node. Fig. 6 shows that the battery monitor IC detects the device’s transition overhead rather than the transition timing. This is because the battery monitor IC has a circuit to provide accurate current measurement. This circuit continuously monitors the power consumption of the system and periodically provides the microcontroller with the collected data. For example, DS2782 samples signals with 18.6 kHz rate and updates the current measurement register every 3.515 s. If we use this accurate run-time data for a software-based monitoring technique, we can monitor the power-consumption pattern of micro sensor nodes. In this paper, we will present a concrete software technique for a practical run-time energy monitoring system, based on the accurate power information of battery monitor IC.

Sensor-On

Transition Overhead

Sensor-Off Constant Power

Time (ms) Fig. 5. Drawback of battery monitor IC.

77

S. Choi et al. / Journal of Systems Architecture 58 (2012) 73–85

40

Transition Overhead 35

Current (mA)

30

Sensor-On

25

Sensor-On-Off (H/W Trace) 20 15 10

Sensor-Off Constant Power

5 0 0

1000

2000

3000

4000

5000

6000

7000

8000

9000

Time (ms) Fig. 6. Ideal measurement results using accurate measuring instrument.

3. Hardware-assisted energy monitoring architecture

Software-based Power Monitor

The key concept of HEMA is to provide a technique for combining hardware-based power monitoring with a software-based device utilization tracking technique. To monitor hardware, we chose a battery monitor IC, which has various practical advantages. In the previous section, we showed that the main limitation of a battery monitor IC is caused by its low sampling performance, which is due to long register update time. The software technique to track device utilization in HEMA should, therefore, accommodate this limitation. Fundamentally, HEMA uses a software-based power monitoring technique. The estimated power consumption based on a softwarebased technique is corrected with hardware-assisted power monitoring data. Fig. 7 shows an overview of HEMA. HEMA consists of both software and hardware components. The software-based part is organized with the device utilization monitor, device classifier, energy estimator, and power table. 3.1. Power table Energy consumption of devices is stored as a table. Based on the information in the power table, HEMA dynamically infers the consumed power of devices. The power table contains pre-measured data, which is either electronic current or power stored according to device operation. Software-based power measurement techniques usually use a static table and comprise the following problems. First, sensor nodes normally use a battery as a power source, and the output voltage becomes low as the battery is discharged. Second, nodes are equipped with various sensors and devices, hence often require a voltage regulator to supply constant-voltage. The effect of voltage regulator varies according to the input voltage and the current. In sensor nodes, an input voltage and a current load change as the battery depletes, which causes non-linear behavior in power consumption. This problem is illustrated in Fig. 8. In this experiment, power consumption of a gyroscope equipped in sensor node is estimated with step-up switching regulator and step-down linear regulator. In the figure, the REG output is the estimation of consumed power in output side of the regulator, and the REG input is estimated at power input from the battery to the regulator. No change is observed in consumed power with the REG output of both regulators, whereas with the REG input

HEMA Device Utilization Monitor Runtime Power Coupler

Device Classifier

Energy Calculator

Runtime Power Monitor

Energy Estimator Power Table

Hardware -assisted Power Monitor Fig. 7. Overview of HEMA.

the power consumption varies with different battery voltage. The result indicates that for accurate estimation of power consumption the power table should be dynamically updated as time passes. In this paper, we therefore use a dynamic technique to update the power table according to sensor node and its battery status. To use a dynamic technique in HEMA, a sequence of operations should be performed to create a power table at the initial start-up phase of sensor nodes. Fig. 9 shows the pseudo-code of these operation sequences. When the sensor node is booted all devices are first turned off and power consumption of each device is measured by turning them on one by one. The result is stored in the power table, and updated using the following method. Given the BMIC (battery monitoring IC)’s update interval TBM and monitoring power at this interval, the device power consumption is measured at every k  TBM. k is a constant set by user. Then, the energy consumption EBM of sensor node is estimated as follows:

EBM ¼

Z

PðtÞdt ¼

k X

ðV i  Ii  T BM Þ;

i¼1

where Vi, Ii are the voltage and current at step i respectively. At the same time, the energy consumption ESW of sensor node with a software-based method is estimated using device’s power consumption PD, which is stored in power table, and operation time tD, as follows:

78

S. Choi et al. / Journal of Systems Architecture 58 (2012) 73–85

the problem of regulator and the voltage transition overhead of battery. Thus, by compensating the difference of EBM and ESW, the power consumption of each device ED is estimated accurately, which is expressed as

70 60

Power(mW)

50

ED ¼ PD  t D þ ðEBM  ESW Þ  ðP D  tD Þ=ESW 40

With the dynamic table update technique of HEMA, ED is estimated periodically and the table is updated accordingly, and accurate power consumption can be estimated over the software-based techniques.

30 REG input REG output

20

3.2. Energy calculation

10 0 3.2

3.1

3.0

2.9

2.8

2.7

2.6

2.5

2.4

2.3

2.2

2.1

2.0

1.9

Volt(V)

(a) Switching regulator 70 60

Power(mW)

50 40 30 REG input REG output

20 10 0 4.3

4.2

4.1

4.0

3.9

3.8

3.7

3.6

3.5

3.4

3.3

Volt(V)

(b) Linear regulator Fig. 8. Basic concept of our approach.

ESW ¼

n X ðPD  tD Þ ¼ P a  ta þ Pb  t b þ . . . þ Pn  t n

The runtime power monitor and runtime power coupler are parts of the hardware-assisted component. The data processed by the components are fed to the energy calculator and converted to real energy information. The monitored information is then sent to a device utilization monitor and device classifier. The device utilization monitor measures the device operation time (Fig. 10(a)). The device classifier rearranges the device operation time to an appropriate status for energy calculation (Fig. 10(b)). Based on the rearranged data and power table, the energy estimator expects the energy consumption. The hardware-assisted power monitoring data is collected by a runtime power monitor, which converts the monitored data into electronic current and voltage. Using a runtime power coupler, HEMA arranges the power information to each device. The runtime power coupler calculates individual device’s energy ei in Fig. 10. At this time, the device utilization information from the device utilization monitor is used together. The coupled data is passed to the energy calculator. After energy calculator collects the expected data and coupled data from other components, the energy information of the individual device is derived, based on the formulation set out below. The monitoring period is the update time of the battery monitor IC. To calculate an individual device’s energy ei, the formula given below is used. The total energy used during the monitoring period EP, is calculated as follows:

EP ¼ IP  V P  T P

D¼a

where a, b, c, . . ., n represent the devices in sensor node. In an ideal case, EBM and ESW should be equal. Yet, they are different due to

where IP is the electrical current, VP the supply voltage, and TP the monitoring period. IP and VP are measured with a hardware power monitor, and TP is tracked by software. Therefore, EP is calculated

// PW_TABLE[MAX_DEV_NUM] : Power Table Variable // Get_Energy();

: Energy Monitoring Function using Battery Monitoring IC

Init_Power_Table() { SET MAX_DEV_NUM to Total number of devices in sensor node FOR I=0 TO MAX_DEV_NUM { All_DEVICE_OFF();

ð1Þ

// turn off every devices in sensor node

// turn on current device while monitoring period WHILE one monitoring period { DEVICE_ON(I); } SET PW_TABLE[I] to Get_Energy(); // update power table variable } Fig. 9. Pseudo-code for runtime construction of power table.

79

Current (mA)

Current (mA)

S. Choi et al. / Journal of Systems Architecture 58 (2012) 73–85

Monitoring Period (TP) t0

t1

t2

Time (ms) (a) Software-based Device Utilization Tracking

e0

t1

t0

t2

Time (ms) (a) Software-based Multiple Device Utilization Tracking

Total Idle Time

Real Current

Current (mA)

Current (mA)

Total Working Time

t1

e1 e2 (Ep - EC)

Expected Current

e0

Constant Power (EC)

e1

e2

e4 EC

Time (ms) (b) Energy Calculation based on Hardware-assisted Monitoring

Time (ms) (b) Energy Recalculation based on Hardware-assisted Monitoring

Fig. 10. Basic concept of our approach.

Fig. 11. Technique for multiple devices.

within the first step. In Fig. 10, the energy consumed while the deP vice is working is expressed as ni¼1 ei :

current-matching technique. Fig. 11 illustrates the scheme. The device-grouping technique collects the total operational time of the individual devices during the monitoring period. Because the battery monitor IC is operated independently, the device-grouping technique can be performed at runtime. Fig. 11(b) shows the results after the device-grouping technique has been conducted. The light gray and dark gray colors indicate the relevant device groups. After determining the device groups, HEMA employs an electronic current-matching technique. The technique assigns the total energy to each device’s energy according to the estimated energy consumption ratio. The estimated energy consumption ratio is calculated according to the premeasured energy. Let Pi denote the anticipated current of the ith device; Thus, Eq. (8) will be changed as follows:

n X

ei ¼ EP  EC ¼

i¼0

n X

ðI i  V i  t i Þ

ð2Þ

i¼1

where EC is the constant energy consumption. Ii, Vi, and ti stand for the electronic current, supply voltage, and working time of the ith device, respectively. In single device usage, the following is assumed:

Ii ¼ I 0 ¼ I 1 ¼ . . . ¼ In ¼ IW

ð3Þ

The supply voltage in a single monitoring period is the same, hence it is also assumed that:

Vi ¼ V0 ¼ V1 ¼ . . . ¼ Vn ¼ VP Pn

i¼0 ei

n X

ð4Þ

and ei are calculated by the following formulae:

ei ¼ ðIW  V P Þ 

i¼0

n X

ti

ei ¼ ti  ð5Þ

i¼0

  ei ¼ IW  V p  ti

ð6Þ

Pi  VP ðIP  IC Þ

ð9Þ

The energy information monitored by battery monitor ICs reflects energy losses caused by transition overhead. ðIP PIi C Þ in Eq. (9) calculates this energy loss. Based on Eqs. (8) and (9), HEMA accurately monitors the energy consumption of each individual device.

According to Eq. (3), IW is denoted as:

IW ¼ Ip  I C

ð7Þ

where IC is the constant electronic current, and estimated from the initial measurement. Therefore, ei becomes:

ei ¼ t i  ðIP  IC Þ  V P

ð8Þ

This is considered to be a single device’s operational workload. However, in real sensor network environments, devices are operated concurrently. Therefore, a practical energy monitoring technique for multiple devices should be considered. The major problem for the energy monitoring of multiple devices is that the hardware monitor observes the total system power, and it is hard to tell which devices use energy during the monitoring period. To solve this problem, HEMA uses a device-grouping and electronic

3.3. Case study To clarify that HEMA estimates power consumption correctly, we performed experiment with a gyroscope periodically turning on and off. Three types of measurements were compared: the measuring instrument, software-based energy estimation and HEMA. The results are shown in Fig. 12. HEMA-based energy monitoring contains transition overheads of the gyro sensor, whereas the software-based energy estimation indicates the maximum power. The transition overheads, ðIP PIi C Þ, are reflected in the subsequent monitoring period since HEMA handles the information after monitoring. The result shows that power consumption for each device is correctly estimated with Eq. (9).

80

S. Choi et al. / Journal of Systems Architecture 58 (2012) 73–85

30

25

Pi

Instrument

Current (mA)

20

Ic)

(Ip

S/W Only

HEMA

15

10

5

0 0

1000

2000

3000

4000

5000

6000

7000

8000

9000

10000

Time (ms) Fig. 12. Single device monitoring.

4. Implementation To validate HEMA, we built a battery monitor IC-equipped sensor node and modified the RETOS [21] sensor network operating system appropriately. 4.1. Hardware prototype We developed a prototype sensor node with hardware-assisted power monitoring functionality. Fig. 13 shows the hardware, named Y-Mote, which is equipped with inertial sensors such as an accelerometer and a gyroscope. The inertial sensors used in our board normally require additional power, due to the high-frequency sampling of the devices for the inertial navigation applications. The Ymote uses the newly standardized IEEE 802.15.4a-compatible radio chip [22]. This radio device uses more power than the IEEE802.15.4 radio interface. We used the DS2782 [16] battery monitor IC in the Ymote to implement hardware-based power monitoring. The hardware specifications of the chip are shown in Table 1. The Y-Mote runs the RETOS operating system [21]. 4.2. RETOS modification The RETOS operating system has been designed to satisfy three goals: to support a multi-threading programming environment, to offer a robust system by protecting the kernel from application errors, and to give functional extensibility to the sensor operating system. The RETOS device driver model is flexible enough to meet the various requirements of the sensor hardware, and to support the diverse characteristics of the devices [23]. To support flexibility, three different methods are supported, namely: the user-mode driver, the 2-layer kernel-mode driver, and the single-layer kernelmode driver. All device drivers are managed by the device manager. The system is designed to support simultaneous requests from devices and provides shared access and power management. The device manager was modified to implement HEMA on RETOS. Fig. 14 illustrates the modification. Four components are added to the device manager; that is the battery monitor driver, the micro timer, the device monitor, and the HEMA Core. The battery monitor driver is a device driver for battery monitor IC and provides hardware-assisted power information. The micro timer is a modified system timer to support

Fig. 13. Ymote prototype.

the micro time stamp. The device monitor collects the power stats of a device; power_on and power_off power-control interface in the device manager was modified. The HEMA core is the key component of our system and collects all the information from the other components, and transforms it into energy information. 5. Evaluation Using a hardware IC would involve additional overheads including cost, power, and access time. In this section, we first evaluated the overheads of the system. Then, we evaluated how well HEMA traces the energy consumed by individual devices. The custombuilt measuring instrument and the software-based energy estimation technique were used for the purpose of comparison. Finally, the functionality of HEMA was examined using real applications. 5.1. Overhead Hardware-assisted monitoring certainly incurs overheads in terms of cost and additional power. Hence, the potential overheads of the proposed system should be evaluated with appropriate

81

S. Choi et al. / Journal of Systems Architecture 58 (2012) 73–85

User Application User Mode Device Driver System Calls

Single Layer Device Driver

2- Layer Device Driver

Device Manager

5.2. Artificial workload

HEMA Core Battery Monitor Driver

Micro Timer

150 ms of microcontroller operation, which occurs every 3.3 s. The results show that HEMA has 1% ROM and 10% RAM overheads over the kernel. The ROM overheads are acceptable. Although HEMA requires a large amount of RAM for runtime monitoring, the total RAM size of MSP430 is 10 KBytes, 332 Bytes for HEMA is acceptable considering that MSP430 has 10 KBytes of RAM.

Device Driver Monitor

Hardware Fig. 14. RETOS modification.

experiments. In the following experiment, we measured delay, power and code overheads of HEMA. The delay component of HEMA includes data collection and processing overheads. To measure power consumption and delay overhead of HEMA, we made experimental setup using high frequency power measurement device and Agilent DSO6034A oscilloscope. We measured the execution time and the current drawn via the resistor connected to a battery of sensor node. We excite artificial workload with and without HEMA to compare overhead. Table 3 shows the results. The DS2730 battery monitor IC uses an I2C bus interface to read the battery data and transfers them to the microcontroller. I2C uses two wires: SCL and SDA. SCL is the clock line used to synchronize all data transfers over the I2C bus, whereas the SDA data line is used to transfer data to microcontroller. This two-wired I2C communication has a time delay. Our measurements reveal that 168 ls is required to the read data. Upon receiving the I2C data, microcontroller converts them into useful data and stores them in the memory. This causes an additional delay. In the case of software-based energy estimation, the processing delay is higher than the collection delay. The collection delay is due to the ADC access of the microcontroller. The processing delay occurs when the microcontroller generates various power related data. The voltage monitoring and current monitoring overheads shown in Table 3 are caused by the I2C and microcontroller. The energy calculation is an overhead for the software technique (HEMA Core), whereas HEMA calculates the energy required for each individual device. The overhead is incurred by the utilization monitor, device classifier, and energy estimator. The code overheads means the additional memory size required for HEMA, and consists of a device driver for the battery monitor IC and a software code for making the calculations. In Table 3 the total delay overheads are 441us, approximately equivalent to 176 cycles of the MSP430 microcontroller. The overheads occurred every 3.3 s, and hence generated insignificant system overheads. The total power overheads are equivalent to

To evaluate the per device power estimation accuracy of HEMA, we have carried out experiment with artificial workloads, in which devices are randomly operated. The power consumption is estimated with HEMA and measured with special instrument in parallel. Fig. 15(a) shows the total power consumed, Fig. 15(b)– (d) shows the power consumption of each device such as radio, GPS, and digital compass. The consumed power is estimated using power-measuring instrument and HEMA. The figures indicate that although HEMA cannot provide power consumption of each device as detail as the measuring instrument due to the low sampling frequency, the exact amount of consumed power and power consumption pattern can be learned using HEMA. Especially, the per device power estimation is close to that of measuring devices when the multiple devices operate simultaneously. The results show that the per device power consumption and pattern monitoring is possible using HEMA. 5.3. Real application To evaluate HEMA, a real sensor network application was implemented, as illustrated in Fig. 16. This is an anchor-free mobile node localization system [24] using the Ymote, which is equipped with the IEEE 802.15.4a RF module. The operation consists of three phases: advertisement, ranging and self-positioning. In the advertisement phase, a node periodically broadcasts a beacon message to the neighboring node. A node then periodically measures distance to its neighbors, and estimates its location using the received information. This application requires sensor nodes to use the radio device frequently and randomly, and to collect motion information using the gyro sensor. The system also uses Bluetooth to send information to a cell phone. Fig. 17 shows the application’s power trace using hardware-assisted monitoring data. 300 s of operation were logged, and then the data was analyzed. The results are shown in Fig. 18 and Table 4. Fig. 18 shows the short-term monitoring results. We analyzed the ‘‘short-term monitoring area’’ at Section A in Fig. 17. The application is operated by using three devices simultaneously. The results show the operational effectiveness of the multiple devices monitoring technique. The measuring instrument results are compared with the software-based energy estimation technique and the results from HEMA. The dotted line in Fig. 18 indicates the data estimated by the software-based energy estimation technique, and line in bold indicates the data monitored by HEMA. The softwarebased energy estimation approach cannot exhibit accurate energy

Table 3 Total system overhead. Delay overhead (ls)

Power overhead (lA)

Code overhead

Battery monitor driver

Current monitoring Voltage monitoring

168 188

101 103

324 bytes ROM (12 bytes RAM)

HEMA core

Utilization monitor Device classifier Energy estimator

13 27 45

11 18 75

120 bytes ROM (110 bytes RAM) 200 bytes ROM (135 bytes RAM) 220 bytes ROM (87 bytes RAM)

441

308

864 bytes ROM (332 bytes RAM)

Method

Total overhead

82

S. Choi et al. / Journal of Systems Architecture 58 (2012) 73–85

Fig. 15. Power consumption estimation of individual device using HEMA.

75 74 73

Current (mA)

72

B

A

C

D

E

71 70 69 Short Term Monitoring Area

68 67 66 65 0

50

100

150

200

250

300

Time (s) Fig. 16. Evaluation setup for HEMA in real application.

Fig. 17. Evaluation setup for HEMA in real application.

information, and the total energy for localized operation is detected as being higher than the actual value. This is because the transition overheads of device are not considered in the software-based energy estimation approach. On the other hand, the HEMA monitoring data shows accurate power information that is close to the measuring instrument monitoring data. Especially, device operation trends are very well reflected in the monitored data.

HEMA monitoring data shows that the power characteristics of individual devices are presented accurately. We traced the application’s operation in Fig. 16 and divided the monitoring areas into Section A to E in order to evaluate the medium-term monitoring performance (Fig. 17). We then measured the total energy consumption of each area. Table 4 shows the results. We used the error ratio over the measuring instrument’s

83

S. Choi et al. / Journal of Systems Architecture 58 (2012) 73–85

200 180 160

S/W Only

140

Current (mA)

HEMA 120

Instrument

100 80 60 40

Bluetooth On

Radio On 20

Radio Send

Gyro On

0

Time (ms) Fig. 18. Short term monitoring in real application.

Table 4 Middle-term monitoring error. Method

A area B area C area D area E area

Gyro

Table 5 Long-term monitoring error. Radio

Bluetooth

Method

S/W (%)

HEMA (%)

S/W (%)

HEMA (%)

S/W (%)

HEMA (%)

4.3 7.1 4.3 5.9 7.3

2.1 2.3 2.0 2.1 2.0

7.1 15 8.3 9 12.1

3.3 3.1 3.2 3.1 3.0

2 2.3 2.1 2.2 2.3

1.8 1.7 1.5 1.6 1.7

results. The monitoring data from the measuring instrument and software-based energy estimation was too large to handle in the sensor nodes; hence we logged them on-line and made the relevant calculations off-line. The energy data for HEMA was logged and calculated while on-line due to the characteristics of the battery monitor IC. The results show that the monitored data of the three devices has different levels of accuracy according to the monitoring method. For the Bluetooth case, the monitoring error for both the software-based energy estimation technique and HEMA was not large, since Bluetooth is rarely operated and energy monitoring does not have much chance to render inaccurate energy estimates. However, the radio device is frequently used, and the state transition overheads are large (Fig. 18) for the software-based energy estimation approach. HEMA performed energy monitoring with an error rate of less than 3%. In the gyro case, similar results were obtained. The previous experiments were conducted to evaluate momentary monitoring performance. Momentary monitoring can be a useful tool for understanding the energy consumption behavior of a device. The key advantage of HEMA is the ability to monitor energy consumption after deployment. Therefore, long-term monitoring is possible. The results of long-term monitoring with HEMA are shown in Table 5. Energy monitoring was conducted for 1–12 h to evaluate the long-term monitoring performance. To save memory overheads, the monitoring data was stored in terms of average energy consumption while the application was running. Table 5 shows that the software-based energy low error ratio of 6.3% due to the run time power monitoring estimation approach has a large error ratio, since errors are information.

1h 3h 6h 9h 12 h

Gyro

Radio

Bluetooth

S/W (%)

HEMA (%)

S/W (%)

HEMA (%)

S/W (%)

HEMA (%)

10 17 22 25 56

2.2 2.9 4.2 5.1 5.9

15 23 34 48 62

3.9 4.3 4.9 5.5 6.3

7 13 18 21 30

2.3 3.1 3.7 4.1 4.9

5.4. Power management To evaluate HEMA, we implemented a power management mechanism. We reprogrammed the automated sensor-specific power management system (ASPM) [17] for DSL [18] application using HEMA. ASPM monitors the energy consumption pattern of applications and powers on/off the devices automatically. The DSL application includes periodic patterns of event-responded and continuous tracking of sound signal. A node that hears the sound first is elected as the leader node. The leader node then selects the position of the acoustic source among the voting grids. The detailed mechanism of ASPM and DSL is found in [17,18]. Here, we evaluate the power consumption of the DSL application using HEMA-based ASPM. To perform ASPM for DSL application, ASPM should have knowledge on wakeup latency and break-even cycle. HEMA provides this information using the Power Table described in Section 3. In the original ASPM we used pre-define power table; we now automatically generate the power table for HEMA-adapted ASPM as shown in Table 6. This is one advantage of using the HEMA scheme for power management. In the original DSL, the MIC sensor is turned off whenever it is not used (called UserPM, hereafter). UserPM does not consider the energy consumption of transition overhead. The DPM policy of the original DSL was reprogrammed using ASPM as follow. Whenever the MCU is not used, its power mode becomes C3 because the break even time of the MCU is close to 0 ms. In the MIC case, we established more complicated PM policies than the original DSL. Because the MIC sensor is frequently used, the break even is too short. We compare the original DSL

84

S. Choi et al. / Journal of Systems Architecture 58 (2012) 73–85

Table 6 Power table of DSL application with HEMA.

Acknowledgements

Device

State

Power

Estimated latency

Description

MCU

C0 C1

240 lA 51 lA

6 ls 2 ls

C2

7 lA

2 ls

C3

2 lA

1 ls

C4

0.1 lA

0

Power on Lower power mode 1 Lower power mode 2 Lower power mode 3 Power off

MIC sensor

D0 D2

40 lA 0 mA

85 ms 0

Power on Power off

Network device

D0 D1 D2 D3 D4

17.4 mA 19.7 mA 426 lA 20 lA 1 lA

100 ls 2 ls 2 ls 2 ls 0

Send Receive Idle Sleep Power off

Table 7 Power consumption of the modified DSLs.

Always On UserPM HEMA-based S/W-based

Power consumption (mA)

Sound detection error (%)

0.0156 0.0158 0.0142 0.0139

0.03 3.57 0.05 2.72

(Always-ON) with three kinds of PM policies: User-PM, HEMAbased ASPM and S/W-based ASPM. Table 7 shows the average power consumption after running the DSL for 5 min of each policy. As shown in Table 7, HEMA-based and S/W-based PM policies are more energy-efficient than User-PM. Moreover, when HEMAbased ASPM is applied, the error rate decreased because HEMA prevents the data delay based on runtime power consumption information. However, S/W-based ASPM increase error rate because it uses pre-defined power information. HEMA provides appropriate information for WSN applications as well as energy efficiency. The result shows that HEMA provides essential information to perform run-time power management.

6. Conclusion In this paper, we proposed HEMA, the hardware-assisted energy monitoring architecture, for a practical runtime energy monitoring system. HEMA uses a hardware-software combined monitoring technique to provide an analysis of consumed energy for individual devices using micro sensor nodes. We presented the design and core mechanism of HEMA based on a real implementation. The experimental results showed that HEMA accurately traced the energy consumption of individual devices with low overheads. The accuracy was within 6% when compared with the custom-built measuring instrument. In conclusion, we validated that battery monitor IC-assisted power monitoring is an efficient method for developing practical power management methods in wireless sensor nodes. The cost of a battery monitor IC is reasonably cheap, and the overheads are sufficiently low to use it for sensor nodes. This, when combined with appropriate software techniques, means that effective energy monitoring is now both possible and practical.

This work was supported by the National Research Foundation of Korea (NRF) Grant funded by the Korea government (MEST) (No. 2011-0000156, No. 2011-0015332), and also by the IT R&D program of MKE/KEIT (No. 2010-10035310). References [1] D. Estrin, A. Sayeed, M. Srivastava, Wireless Sensor Networks, in: Proceedings of Eighth International Conference on Mobile Computing and Networking (MobiCom02 Tutorial), USA, September 2002. [2] A. Kansal, J. Hsu, S. Zahedi, M.B. Srivastava, Power management in energy harvesting sensor networks, ACM Transactions on Embedded Computing Systems 6 (4) (2007). [3] A. Sinha, A. Chandrakasan, Dynamic power management in wireless sensor networks, IEEE Design & Test of Computers 18 (2) (2001) 62–74. [4] P. Dutta, J. Hui, J. Jeong, S. Kim, C. Sharp, J. Taneja, G. Tolle, K. Whitehouse, D. Culler, Trio: Enabling Sustainable and Scalable Outdoor Wireless Sensor Network Deployments, in: The fifth International Conference on Information Processing in Sensor Networks (IPSN 2006), Nashville, Tennessee, USA, April 2007. [5] S. Choi, H. Cha, R. Ha, A Selective DVS Technique based on Battery Residual, Microprocessors and Microsystems, Elsevier Science 30 (1) (2006) 33–42. [6] S. Choi, B. Song, H. Cha, R. Ha, Energy-Aware Pipeline Monitoring System Using Piezoelectric Sensor, IEEE Sensors (in press). [7] A. Dunkels, F. Österlind, N. Tsiftes, Z. He., Software-based on-line energy estimation for sensor nodes, in: Proceedings of the Fourth Workshop on Embedded Networked Sensors (Emnets IV), Cork, Ireland, June 2007. [8] O. Landsiedel, K. Wehrle, S. Gotz, Accurate Prediction of Power Consumption in Sensor Networks, in: The Second IEEE Workshop on Embedded Networked Sensors, Sydney, Australia, May 2005. [9] T. Trathnigg, R. Weiss, A Runtime Energy Monitoring System for Wireless Sensor Networks, in: Proceedings of the 3rd IEEE International Symposium on Wireless Pervasive Computing, Santorin, Greece, May 2008. [10] X. Jiang, P. Dutta, D. Culler, I. Stoica, Micro Power Meter for Energy Monitoring of Wireless Sensor Networks at Scale, in: Proceedings of the Sixth International Conference on Information Processing in Sensor Networks(IPSN), Cambridge, Massachusetts, April 2007. [11] T. Stathopoulos, D. McIntire, W. Kaiser, The Energy Endoscope: Real-time Detailed Energy Accounting for Wireless Sensor Nodes, in: Proceedings of the Seventh International Conference on Information Processing in Sensor Networks(IPSN), St. Louis, Missouri, USA, April 2008. [12] Ti INA219 current monitoring IC, . [13] R. Fonseca, P. Dutta, P. Levis, I. Stoica, Quanto: Tracking Energy in Networked Embedded Systems, in: Proceedings of the Eighth USENIX Symposium on Operating System Design and Implementation (OSDI’08), San Diego, CA, USA, 2008. [14] P. Dutta, M. Feldmeier, J. Paradiso, D. Culler, Energy Metering for Free: Augmenting Switching Regulators for Real-Time Monitoring, in: Proceedings of the Seventh International Conference on Information Processing in Sensor Networks(IPSN), St. Louis, Missouri, USA, April 2008. [15] DS2782 battery monitor IC, . [16] J. Rahmé, K. Agha, A state-based battery model for nodes’ lifetime estimation in wireless sensor networks, in: Proceedings of the tenth ACM international symposium on Mobile ad hoc networking and computing, New Orleans, USA, 2009. [17] N. Kim, S. Choi, H. Cha, Automated Sensor-specific Power Management for Wireless Sensor Networks, in: The Fifth IEEE International Conference on Mobile Ad-hoc and Sensor Systems (MASS 2008), Atlanta, USA, September 2008. [18] Y. You, J. Yoo, H. Cha, Event Region for Effective Distributed Acoustic Source Localization in Wireless Sensor Networks, in: The 5th IEEE Wireless Communications & Networking Conference (WCNC 2007), Hong Kong, China, March 2007. [19] IADS8381, . [20] TI TMS320F28335, . [21] H. Cha, S. Choi, I. Jung, H. Kim, H. Shin, J. Yoo, C. Yoon, RETOS: Resilient, Expandable, and Threaded Operating System for Wireless Sensor Networks, in: The Sixth International Conference on Information Processing in Sensor Networks (IPSN 2007), Cambridge, Massachusetts, USA, April 2007. [22] Nanotron NA5TR1, . [23] H. Choi, C. Yoon, H. Cha, Device Driver Abstraction for Multithreaded Sensor Network Operating Systems, in: European conference on Wireless Sensor Networks(EWSN), Bologna, Italy, January–February 2008. [24] C. Yoon, H. Choi, S. Lee, H. Cha, B. Song, H. Lee, IEEE 802.15.4a-Based Anchorfree Mobile Node Localization System, in: The 8th International Conference on Information Processing in Sensor Networks (IPSN 2009, DEMO), San Francisco, USA, April 2009.

S. Choi et al. / Journal of Systems Architecture 58 (2012) 73–85 Sukwon Choi received his B.Sc. and M.Sc. degrees in computer science from Kwangwoon University and Yonsei University in 1999 and 2005, respectively. He received his Ph.D. in computer science from Yonsei University in 2011. His research interests include embedded operating systems, low-power system, and wireless sensor networks.

Hayun Hwang is currently working for LG electronics, Korea, as a research engineer. He received his B.Sc. and M.Sc. degrees in computer science from Dankook University and Yonsei University, respectively. His research interests include embedded system and wireless sensor networks.

85 Byunghun Song is a senior researcher in the RFID/USN Convergence Research Center of Korea Electronics Technology Institute. His research interests are in the broad area of wireless sensor networks, including reliable protocol design, system support, and applications of systems. He received his B.S., M.S. and Ph.D. in electronic communication engineering from Kwangwoon University, Korea, in 1998, 2000, and 2004, respectively.

Hojung Cha is currently a professor in computer science at Yonsei University, Korea. His research interests include wireless and mobile systems, embedded operating systems, and sensor network systems. He received his B.S. and M.S. degrees in computer engineering from Seoul National University, Korea, in 1985 and 1987, respectively. He received his Ph.D. in computer science from the University of Manchester, England, in 1991.