An Energy Aware Adaptive Sampling Algorithm for Energy Harvesting WSN with Energy Hungry Sensors

Wireless sensor nodes have a limited power budget, though they are often expected to be functional in the field once deployed for extended periods of time. Therefore, minimization of energy consumption and energy harvesting technology in Wireless Sensor Networks (WSN) are key tools for maximizing network lifetime, and achieving self-sustainability. This paper proposes an energy aware Adaptive Sampling Algorithm (ASA) for WSN with power hungry sensors and harvesting capabilities, an energy management technique that can be implemented on any WSN platform with enough processing power to execute the proposed algorithm. An existing state-of-the-art ASA developed for wireless sensor networks with power hungry sensors is optimized and enhanced to adapt the sampling frequency according to the available energy of the node. The proposed algorithm is evaluated using two in-field testbeds that are supplied by two different energy harvesting sources (solar and wind). Simulation and comparison between the state-of-the-art ASA and the proposed energy aware ASA (EASA) in terms of energy durability are carried out using in-field measured harvested energy (using both wind and solar sources) and power hungry sensors (ultrasonic wind sensor and gas sensors). The simulation results demonstrate that using ASA in combination with an energy aware function on the nodes can drastically increase the lifetime of a WSN node and enable self-sustainability. In fact, the proposed EASA in conjunction with energy harvesting capability can lead towards perpetual WSN operation and significantly outperform the state-of-the-art ASA.


Introduction
One of the major obstacles for Wireless Sensor Networks (WSN) technology to expand even further and ultimately replace, wherever possible, wired sensor solutions, is their limited energy availability, which significantly reduces their lifetime, as batteries are the primary energy source for WSN nodes. The rate of improvement in battery capacity in the last decades has not increased significantly [1], when compared to advances in processing, sensing, and memory technologies. However, novel applications ‚ Precise energy model for a WSN network with power-hungry sensors and energy harvesting capabilities.
‚ Evaluation of the proposed approach within two application domains, namely SHM and monitoring of beehives.
‚ Simulation evaluation using long term in-field measurements and comparison with the ASA (without energy awareness) and the fixed sampling rate (conventional method) in terms of energy durability.

Related Work
Energy management techniques to achieve long term monitoring and self-sustainability in WSN applications are widely used and explored in the literature at both node and network level [10,11]. The most common approaches employ: communication power management [12], voltage scaling [5], adaptive IC power modes, duty cycling [13], wake up receivers [14] and data aggregation [15]. Beside them, another popular way to reduce energy consumption in WSN is using the adaptive radio frequency approach [16,17] and also static or dynamic packet length optimization, in order to save energy on transmission [18,19]. Another approach is the implementation of adaptive sampling algorithms [6,20,21], which allows a high increase in lifetime. Today, the traditional methods, with fixed sampling rate, are replaced with solutions that modify the sampling rate of the sensors according to the needs (i.e., temporal changes and frequency) of the phenomenon observed. In this way, the sensor node does not waste energy sampling the sensor more than the actual maximum frequency of the signal [20]. However, using only adaptive sampling can guarantee an extension of the lifetime, but may not guarantee self-sustainability (or energy neutrality) of WSN, as the battery is still a finite energy resource.
Energy harvesting (EH) for WSN has been very prolific in the last decade of research [22,23], trying to overcome the battery limitation. EH plays an important role in enhancing the life span of a node in a network that aims to achieve self-sustainability [2,21]. A good example of an energy harvesting system that utilizes small wind turbine to harvest wind energy and to power the associated electronic circuitry as well as sensing the wind is presented in [24]. The authors give a detailed description, analysis, and evaluation of the proposed energy harvesting system for autonomous wind sensors and prove the concept of fully autonomous self-powered wireless sensing. A similar example of an autonomous self powered WSN node is analyzed and developed in [25], where the authors consider the application of monitoring wildfire spread in a remote area. As emphasized in [25], the main problem of a battery powered WSN node in fire hazard monitoring applications is that when the battery is running low the sensor nodes could stop functioning and expose the area to fire danger, which is not acceptable for such a monitoring system. To that end, authors are suggesting a solution in the form of a self powered WSN node that will measure the wind speed at the site, and at the same time, harvest the energy from the wind to sustain the remote sensing operation of the WSN node. A battery-less self powered wireless sensor, that autonomously performs a measurement of air temperature and velocity and transmits data to an external receiving unit is presented in [26]. The proposed sensor is powered by a harvesting system that exploits the airflow. The sensor continuously operates for airflow speeds greater than 3 m/s. For slower flows, the sensor is off, and the receiver assumes that the velocity of air is below the threshold. This type of application allows the battery constraints to be overcome by excluding the battery from the system. However, the main issue with the approach presented in [24][25][26], is the unpredictable variable nature of the energy sources in both space and time. Hence, energy harvesting systems on their own cannot ensure that the node will last [27]. Complementing the energy harvesting with an efficient energy management algorithm is often a solution to this problem [27]. An effective power management algorithm for sensor networks with sensors that do not require a high sampling rate is presented in [28]. Another interesting approach is described in [29], where the authors present an algorithm that adaptively adjusts the processor speed to achieve system-wide energy efficiency based on the workload and available energy information. In [30], the authors present an energy management technique for WSN with solar energy harvesting. They propose two adaptive transmission schemes, in which they adjust the transmission delay based only on the battery percentage and output voltage of the solar panel. However, the authors do not present any data or model of the harvested energy and the consumed energy by the platform used. In addition, the proposed approach is only evaluated on one platform.
In many WSN examples in the literature, adaptive sampling algorithms are used only as a tool to minimize the communication between the sensor node and the base station [20]. However, dynamically adapting the sampling frequency of a power hungry sensor according to the maximum frequency of the signal (which depends on the phenomenon observed), one can effectively reduce the power consumption of the sensor and at the same time reduce the radio activity. In this paper, we extend this vision by enhancing the algorithm with a power aware functionality, and verify the concept in simulation with two different deployment scenarios and different types of energy harvester. To the best knowledge of the authors, this is the first paper that presents this approach supported by simulation with in-field long term experimental evaluation. The algorithm proposed Energy Aware ASA (EASA) can be useful especially for wireless sensor nodes equipped with energy harvesting capabilities, where the battery is periodically recharged from an environmental sources.

Energy Aware Adaptive Sampling Algorithm
Typically ASA algorithms evaluate the maximum frequency (f Max ) of the signal and decide the sampling frequency (f Sampling ), which is usually at least twice f Max to avoid aliasing. An example of ASA algorithm (Algorithm 1) is presented in the pseudo code below and more details can be found in [6,20]: Algorithm 1 An example of ASA algorithm.
1. Store an initial number of sensor samples (W); 2. Estimate the f Max on the acquired W samples; 3. Based on f Max set the sampling frequency to a value f Sampling = c f Max where c is a confidence parameter that has to be ě 2 to avoid aliasing; 4. Define upper and lower frequency borders to detect the change in the maximum frequency f Up and f Down as: Acquire a sample and add to the dataset; 8. Estimation of the current maximum frequency f Curr on the sequence (i´W + 1, i); 9. Count the consecutive number of events when the frequency was higher or lower than previously 10.
The relevant parameters are as follows: ‚ h is the consecutive number of samples after which the algorithm detects a change. A low value of h indicates variation in the maximum frequency of the detected signal. As a consequence, false detections are more frequent, which finally results in a very frequent update of the sampling rate-f Sampling .
‚ δ is the minimum percentage change in the maximum frequency that must be detected by ASA.
Using the ASA algorithm can drastically reduce the number of acquired samples with respect to the traditional fixed sampling rate approach, hence saving energy [6,20]. However, to guarantee self-sustainability when the node is equipped with energy harvesters, the ASA needs to monitor the energy level of the node and manage the node activity based on the available energy. Therefore, to further increase the life span of a node and ultimately achieve self-sustainability, we propose an approach in which each of the nodes in the network will have the ability to further adapt the sampling rate of the sensors according to the energy available in the system. This approach can be used as standalone extension for every ASA algorithm. The sampling rate of the sensors refers to how often the sensors are sampled and how often the measured data are sent to the base station (BS). It is also assumed that each of the nodes in the network is able to monitor its own energy level, and is able to harvest energy from the environment. Based on their energy levels, the nodes can adjust the sampling rate received from the BS following the equations below: where K is the function cost for the energy awareness; E batt is the battery level expressed in percentage (0-100); and X level is the selected critical level of the battery in percentage, where the sample frequency starts to decrease from f Sampling to f EASA and the system starts to conserve energy. The rate of saving is also dictated by the parameter m, which in our simulations was fixed to 1, 0.5, and 0.33. The proposed algorithm follows f Sampling until the energy in the battery drops below a level X level . Afterwards, f Sampling is decreased following the trend defined by Equation (2). Using this approach can cause aliasing to occur in which case the Nyquist criterion (f sampling > 2 Bandwidth) will not be met. In this case, the sensor signal will be sub-sampled, with a frequency lower than the maximum frequency of the signal, introducing errors in the measurement. Some of these errors can be filtered as part of back end post-processing, or accepted as a trade off for staying active in the network. Further discussion on this problem is presented in Section 6.

Energy Model of an Energy Harvesting WSN Node with a Power Hungry Sensor
The development of an appropriate energy model, capable of accurately evaluating the energy consumption of hardware in different states of operation is an important task that will make the simulation and evaluation of potential deployments possible.
The energy consumed during an operation is a function of the time required to carry out the operation in the particular operational mode of the underlying hardware. For example, once it is known that a particular task requires a certain number of microcontroller clock cycles, the amount of energy required (E ALG ) is easily calculated (e.g., E ALG = P MCU. t ALG ) where P MCU is the power consumption of the MCU in Active Mode, and t ALG is the time required to execute the algorithm.
In the state machine in Figure 1, we assume a duty cycled node which has harvesting capabilities and a power hungry sensor. When the node samples the sensor it also sends the measurement to the BS. We assume that the earlier described ASA is running on the BS. When the ASA detects a change in the frequency of the signal, the base station sends a new sampling frequency, f ASA , to the node. The node, which has information on how much energy is available in its battery (and how much energy is harvested), adapts this sampling frequency f ASA (received from the BS) according to Equations (1) and (2) resulting in a new sampling rate f EASA .
Assuming that the information on the harvested power available, P i HARVESTED , for each i energy source, and the period of harvesting is available (t iharv ), the amount of harvested energy from the n sources can be calculated using Equation (3).
During the period when the node is active (t ACTIVE ), the node first listens for a message that contains the new sampling frequency from the BS (t RX ). The associated power consumption to this state is P RX . If within this time (t RX ), the node receives a message containing a new sampling frequency, it executes the energy aware function described with Equations (1) and (2) and adapts the sampling frequency received from the BS according to its energy levels. In the case when the node does not receive a message from the BS, the node continues sampling at the previous sampling frequency. The node samples the sensor for a period of time t SnesorSamp . In the case of a power hungry sensor, the energy consumption in that period can be dominant due to the power required for sampling P SensorSampling , due to the duration of this phase, or in some cases both. After the data is acquired from the sensor, the next step is the processing phase where the data is analyzed by the microcontroller or additional circuits (i.e., ADC, level translators, etc.). This phase is represented by P PROC and t PROC in Equations (4) and (5). Finally, the node sends a message to the BS (t TX and P TX ) containing the acquired measurement. Thus, the active period can be described using Equations (4) and (5).
To evaluate the system energy spent during the sleep period, Equation (6) can be used, where P SLEEP is the power consumption in sleep mode and the time spend in sleep (t SLEEP ) is the total period T minus the activity period (t ACTIVE ). Finally the total energy available in the system at each time (t) is defined by Equation (7) where E LEVEL is the energy available in the battery: It is important to emphasize that for the proposed energy model of an energy harvesting WSN with energy hungry sensors to be used for theoretically modeling of any harvesting system, it is enough to know the amount of harvested power, the period of harvesting and the overall consumed energy of the system during the same period. During the period when the node is active (tACTIVE), the node first listens for a message that contains the new sampling frequency from the BS (tRX). The associated power consumption to this state is PRX. If within this time (tRX), the node receives a message containing a new sampling frequency, it executes the energy aware function described with Equations (1) and (2) and adapts the sampling frequency received from the BS according to its energy levels. In the case when the node does not receive a message from the BS, the node continues sampling at the previous sampling frequency. The node samples the sensor for a period of time tSnesorSamp. In the case of a power hungry sensor, the energy consumption in that period can be dominant due to the power required for sampling PSensorSampling, due to the duration of this phase, or in some cases both. After the data is acquired from the sensor, the next step is the processing phase where the data is analyzed by the microcontroller or additional circuits (i.e., ADC, level translators, etc.). This phase is represented by PPROC and tPROC in Equations (4) and (5). Finally, the node sends a message to the BS (tTX and PTX) containing the acquired measurement. Thus, the active period can be described using Equations (4) and (5).
To evaluate the system energy spent during the sleep period, Equation (6) can be used, where PSLEEP is the power consumption in sleep mode and the time spend in sleep (tSLEEP) is the total period T minus the activity period (tACTIVE). Finally the total energy available in the system at each time (t) is defined by Equation (7) where ELEVEL is the energy available in the battery: It is important to emphasize that for the proposed energy model of an energy harvesting WSN with energy hungry sensors to be used for theoretically modeling of any harvesting system, it is enough to know the amount of harvested power, the period of harvesting and the overall consumed energy of the system during the same period.

Experimental Setup and Node Architecture
In order to evaluate the proposed energy aware algorithm, two different platforms have been used and deployed to collect field data. In the first deployment (I), a custom made platform was developed and used for monitoring the wind speed and direction with harvesting energy from the wind. In the second deployment (II) an off the shelf WSN platform was used for monitoring the gas levels (with an emphasis on measuring the CO 2 levels) in a beehive with solar energy harvesting. The deployments are carried out separately in two different application scenarios, with different durations in order to assess the performance of the proposed algorithm in different conditions (i.e., different platform, application space, and sensors).
A generic block diagram of the systems deployed is presented in Figure 2. In the following subsections, the deployments are described in detail.

Experimental Setup and Node Architecture
In order to evaluate the proposed energy aware algorithm, two different platforms have been used and deployed to collect field data. In the first deployment (I), a custom made platform was developed and used for monitoring the wind speed and direction with harvesting energy from the wind. In the second deployment (II) an off the shelf WSN platform was used for monitoring the gas levels (with an emphasis on measuring the CO2 levels) in a beehive with solar energy harvesting. The deployments are carried out separately in two different application scenarios, with different durations in order to assess the performance of the proposed algorithm in different conditions (i.e., different platform, application space, and sensors).
A generic block diagram of the systems deployed is presented in Figure 2. In the following subsections, the deployments are described in detail.

Deployment (I)
The custom made platform used in deployment (I) (Figure 3) is capable of supporting a variety of digital and analog sensors intended for structural health monitoring including the previously mentioned ultrasonic wind speed and direction (WMT52) sensor. The node uses the Texas Instruments MSP430F5437A microcontroller and the CC2520 as radio transceiver. The selected microcontroller has a 16 bit RISC CPU and offers various sleep modes with low power consumption. It also has sufficient SRAM and flash memory to accommodate the requirements of the application. The CC2520 exhibits fast wake-up times, low power consumption (two different sleep modes), and compliance with the updated IEEE802.15.4-2006 Standard. The selected wind sensor is an ultrasonic Vaisala WMT52 sensor that has an array of three equally spaced ultrasonic transducers on a horizontal plane. The wind speed and the wind direction

Deployment (I)
The custom made platform used in deployment (I) (Figure 3) is capable of supporting a variety of digital and analog sensors intended for structural health monitoring including the previously mentioned ultrasonic wind speed and direction (WMT52) sensor. The node uses the Texas Instruments MSP430F5437A microcontroller and the CC2520 as radio transceiver. The selected microcontroller has a 16 bit RISC CPU and offers various sleep modes with low power consumption. It also has sufficient SRAM and flash memory to accommodate the requirements of the application. The CC2520 exhibits fast wake-up times, low power consumption (two different sleep modes), and compliance with the updated IEEE802. 15

Experimental Setup and Node Architecture
In order to evaluate the proposed energy aware algorithm, two different platforms have been used and deployed to collect field data. In the first deployment (I), a custom made platform was developed and used for monitoring the wind speed and direction with harvesting energy from the wind. In the second deployment (II) an off the shelf WSN platform was used for monitoring the gas levels (with an emphasis on measuring the CO2 levels) in a beehive with solar energy harvesting. The deployments are carried out separately in two different application scenarios, with different durations in order to assess the performance of the proposed algorithm in different conditions (i.e., different platform, application space, and sensors).
A generic block diagram of the systems deployed is presented in Figure 2. In the following subsections, the deployments are described in detail.

Deployment (I)
The custom made platform used in deployment (I) (Figure 3) is capable of supporting a variety of digital and analog sensors intended for structural health monitoring including the previously mentioned ultrasonic wind speed and direction (WMT52) sensor. The node uses the Texas Instruments MSP430F5437A microcontroller and the CC2520 as radio transceiver. The selected microcontroller has a 16 bit RISC CPU and offers various sleep modes with low power consumption. It also has sufficient SRAM and flash memory to accommodate the requirements of the application. The CC2520 exhibits fast wake-up times, low power consumption (two different sleep modes), and compliance with the updated IEEE802.15.4-2006 Standard. The selected wind sensor is an ultrasonic Vaisala WMT52 sensor that has an array of three equally spaced ultrasonic transducers on a horizontal plane. The wind speed and the wind direction  The selected wind sensor is an ultrasonic Vaisala WMT52 sensor that has an array of three equally spaced ultrasonic transducers on a horizontal plane. The wind speed and the wind direction are determined by measuring the time it takes the ultrasound to travel from each transducer to the other two. The sensor can be interfaced using the RS-485 protocol, which requires an additional differential transceiver (level translator) in order to be interfaced to the microcontroller. A step up DC-DC converter from Analog Devices ADP2371 (3.3 V to 12 V) was used to provide the supply voltage to the wind sensor. To completely turn off the supply voltage for the sensor when not in use, a simple transistor based switch controlled by the MCU was implemented. This ultimately reduced the sleep current of the platform to 15 µA. A harvester power unit was used to harvest the wind energy with a scaled wind turbine. The harvester is a high efficiency power unit that can recharge a battery with harvested energy from the wind [31]. An off the shelf small size scaled wind turbine was used with radius of the blades of 0.17 m. This wind turbine provides a rectified (DC) output voltage that is regulated (stepped up or down) by the harvesting unit and fed to a rechargeable battery. To directly supply the node, the voltage from the battery is then further regulated to 3.3 V.
The experiment for collecting the wind speed data was carried out over a period of 35 days. The node and the wind sensor were deployed on a roof-top of a 20 m tall building located in Cork, Ireland. The node was duty cycled, sending the collected wind data every 20 s (0.05 Hz) to a base station that was connected to a laptop storing the messages in a file. The wind sensor was configured to sample with a fixed sampling frequency of 1 Hz over a period of 10 s and sending the minimum, maximum and the average value of the speed and direction within those 10 s. The 35-day data set of continuous wind sensor monitoring was used to evaluate the proposed approach in simulation.

Deployment (II)
The second deployment was carried out as a part of a research activity in smart monitoring of beehives [9]. The main goal of this research is to obtain knowledge of the conditions within the hive, and use this knowledge to inform the beekeeper, with the aim of maintaining a healthy hive through the use of heterogeneous WSN and mobile technologies [9]. The same deployment is also used for weather prediction [9].
A deployment period of 14 days has been used in this paper to evaluate the benefits of the proposed approach. The critical parameters that may indicate the status of the beehive were identified as: temperature, humidity, Carbon Dioxide (CO 2 ) levels, and Oxygen (O 2 ) levels [32,33]. These are known to vary in response to one or more of these scenarios: the number of honeybees in the hive, the health of the colony, and the external weather conditions [9].
As the proposed approach aims to reduce the power consumption of the power hungry sensors, the data collected with the CO 2 sensor (as the most power hungry sensor) were selected for focus over the 14 days of the deployment. This means that the EASA was performed on the CO 2 data as being one of the most important gas sensors in the hive that would give the most significant information about the beehive condition. The platform used for deployment (II) is an off the shelf WSN platform, Libelium "Waspmote" v1.2. It is a low power platform based on Atmega microcontroller, with a modular architecture allowing a combination of over 70 sensors and 11 radio technologies, with a built in SD card slot and an accelerometer. The gas sensors selected for the actual deployment were off the shelf CO 2 and O 2 gas sensors that could be interfaced with the gas sensor board developed by Libelium. Additionally, an NO 2 sensor and two air contaminants sensors were deployed. The actual sensors used in the deployment are: molecular oxygen (O 2 ) SK-25; carbon dioxide (CO 2 ) TGS4161; nitrogen dioxide (NO 2 ) MiCS-2710; and two air contaminants TGS2600 and TGS2602, which sense gases including ethanol (CH 3 CH 2 OH), hydrogen sulfide (H 2 S), and methane (CH 4 ). The base station used for this deployment was a bridge between the ZigBee network and the 3G network. It used an XBee Series 2 ZigBee radio and a GSM/GPRS/3G module to send the data to a server. The main issue that was encountered in this deployment was the long sampling period of each of the four sensors and hence very high energy consumption of the system during the sampling state. The results of this deployment have shown that even using an energy harvesting source (i.e., solar) does not guarantee a long lasting WSN node. For this reason, these deployments will benefit significantly from the adaptive sampling using the EASA. The five sensors and the battery in deployment (II) were sampled every 4 h, which translates to a sampling rate of 0.000069 Hz (or 1 sample every 14,400 s).

Experimental Results
To evaluate the energy consumption of the sensor node in different states, power consumption has been measured. Tables 1 and 2 present the power consumption and energy consumption of each of the states, together with the relevant task duration, for the two deployments respectively. To characterize the power consumption of the Waspmote platform in different states, a full power characterization was performed using a DC Power analyzer (Agilent N6705B DC) logging data for the current consumption of the platforms while running the firmware described in detail in the text below. Knowing the duration of each state allowed us to calculate the number of samples acquired by the power analyzer and then calculate the average current consumption and energy spent in each of the individual states described below.  In both deployments, the energy consumed during some of the tasks is dependent upon: the sampling rate of the sensor, which changes according to the dynamics of the wind speed (in I), and CO 2 levels (in II); and also the energy available in the system. An energy model used in the simulations was derived using the measured results presented in Tables 1 and 2 and Equations (5)-(7) presented in previous sections once the period T is known, which, as mentioned earlier, is related to the sampling rate f sampling .
In deployment (I), the time t ACTIVE is equal to the sum of the time for sampling the sensors (10 s), communication time between the sensor and the MCU (RS485-UART) and the wireless communication which includes sending and receiving the 16 byte long messages. The data transfer speed of the transceiver CC2520 is 250 kbps and the transmit power is fixed to +5 dBm. The duration of this task is directly related to the number of bytes in the message.
The average power extractable from the airflow can be calculated using Equation (8).
where A is the swept area of the blades, ρ is the density of air, η is the efficiency of the rectifier and the DC-DC converter, v avg is the measured average wind speed and c p is the power coefficient, which is a function of the tip-speed ratio (TSR) of the wind turbine [34]. c p is determined using both analytical formulas and measurements in the lab with controlled wind-speed and direction. In general it is less than 0.1 for small size turbines. Because the power factor is a function of the TSR, it is indirectly a function of the wind speed. In that case the c p factor cannot have fixed value and must be corrected for different values of the wind speed. The manufacturers of wind turbines usually give a TSR vs. c p curve. This curve was not available for this work and a characterization of the turbine had to be performed. The characterization was conducted experimentally by measuring the RPM and the power produced at different wind speeds; whereas the power available in the wind, and the power factor were calculated using Equations (8) and (9). Figure 4 describes the curve that was generated from the experiment. To be able to use this in the simulation, an interpolation of the measured data was performed. The formula derived with the interpolation was used to correct the c p factor Equation (10). In deployment (I), the time tACTIVE is equal to the sum of the time for sampling the sensors (10 s), communication time between the sensor and the MCU (RS485-UART) and the wireless communication which includes sending and receiving the 16 byte long messages. The data transfer speed of the transceiver CC2520 is 250 kbps and the transmit power is fixed to +5 dBm. The duration of this task is directly related to the number of bytes in the message.
The average power extractable from the airflow can be calculated using Equation (8).
where A is the swept area of the blades, ρ is the density of air, η is the efficiency of the rectifier and the DC-DC converter, vavg is the measured average wind speed and cp is the power coefficient, which is a function of the tip-speed ratio (TSR) of the wind turbine [34]. cp is determined using both analytical formulas and measurements in the lab with controlled wind-speed and direction. In general it is less than 0.1 for small size turbines. Because the power factor is a function of the TSR, it is indirectly a function of the wind speed. In that case the cp factor cannot have fixed value and must be corrected for different values of the wind speed. The manufacturers of wind turbines usually give a TSR vs. cp curve. This curve was not available for this work and a characterization of the turbine had to be performed. The characterization was conducted experimentally by measuring the RPM and the power produced at different wind speeds; whereas the power available in the wind, and the power factor were calculated using Equations (8) and (9). Figure 4 describes the curve that was generated from the experiment. To be able to use this in the simulation, an interpolation of the measured data was performed. The formula derived with the interpolation was used to correct the cp factor Equation (10).
When calculating the power extractable from the wind, the wind turbine cut in speed has to be taken into account. For the selected wind turbine the cut in speed was measured to be 3 m/s. Because the wind speed in deployment (I) was an average wind speed over a period of 10 s, the harvested energy calculated in the simulation for this case must also be for intervals of 10 s. Hence, When calculating the power extractable from the wind, the wind turbine cut in speed has to be taken into account. For the selected wind turbine the cut in speed was measured to be 3 m/s. Because the wind speed in deployment (I) was an average wind speed over a period of 10 s, the harvested energy calculated in the simulation for this case must also be for intervals of 10 s. Hence, the energy consumed (E consumed ) in the simulation for every cycle was calculated over a period T of 10 s using Equation (11). Finally the total energy available in the system at each time (t) is defined by Equation (7) where E LEVEL is the available energy in the battery after every cycle E consumed = E ACTIVE pT f EASA q`P SLEEP pT´pT f EASA qq (11) Figure 5 shows the estimated power in the wind calculated using Equation (8) with the measured average wind speed data from deployment (I) and Equation (10) for calculating of the power factor. The values of the rest of the parameters were as follows: efficiency was set to η = 0.56, which reflects the efficiency of the DC-DC conversion and the AC-DC rectifier inside the wind turbine. The density of the air was taken to be ρ = 1.2 kg/m 3 (at T = 15˝C). Econsumed = EACTIVE (T fEASA) + PSLEEP (T − (T fEASA)) (11) Figure 5 shows the estimated power in the wind calculated using Equation (8) with the measured average wind speed data from deployment (I) and Equation (10) for calculating of the power factor. The values of the rest of the parameters were as follows: efficiency was set to = 0.56, which reflects the efficiency of the DC-DC conversion and the AC-DC rectifier inside the wind turbine. The density of the air was taken to be ρ = 1.2 kg/m 3 (at T = 15 °C). To be able to precisely replicate the energy profile of the Waspmote in deployment (II), an analysis of the energy consumption of the system in various operational states was conducted. A state machine representation of the simplified operation was developed and implemented ( Figure 6) replicating the firmware used in deployment (II).  Table 2 summarizes the results of the power consumption analysis of deployment (II). It shows the average current and energy consumption of the Waspmote in different states of its operation, together with the duration of each of the states in deployment (II). The current profile is obtained To be able to precisely replicate the energy profile of the Waspmote in deployment (II), an analysis of the energy consumption of the system in various operational states was conducted. A state machine representation of the simplified operation was developed and implemented ( Figure 6) replicating the firmware used in deployment (II).  Figure 5 shows the estimated power in the wind calculated using Equation (8) with the measured average wind speed data from deployment (I) and Equation (10) for calculating of the power factor. The values of the rest of the parameters were as follows: efficiency was set to = 0.56, which reflects the efficiency of the DC-DC conversion and the AC-DC rectifier inside the wind turbine. The density of the air was taken to be ρ = 1.2 kg/m 3 (at T = 15 °C). To be able to precisely replicate the energy profile of the Waspmote in deployment (II), an analysis of the energy consumption of the system in various operational states was conducted. A state machine representation of the simplified operation was developed and implemented ( Figure 6) replicating the firmware used in deployment (II).  Table 2 summarizes the results of the power consumption analysis of deployment (II). It shows the average current and energy consumption of the Waspmote in different states of its operation, together with the duration of each of the states in deployment (II). The current profile is obtained  Table 2 summarizes the results of the power consumption analysis of deployment (II). It shows the average current and energy consumption of the Waspmote in different states of its operation, together with the duration of each of the states in deployment (II). The current profile is obtained using an Agilent N6705B DC Power Analyzer configured to sample the current consumption of the node every 5 ms. The figures for the I AVG in each state are obtained by averaging the measured current over the duration of the individual states.
In deployment (II), the time t ACTIVE is equal to the sum of the duration of each of the states. Due to the additional states in deployment (II), Equation (4) has to be rewritten such that includes all of the states described in Figure 6: where t SensorSamp " ř n i"1 t i sensor is the sum of the sampling times for all of the sensors, t SD is the time to write the message to a SD card and t ZB is the time to join the ZigBEE network.
The total active time (t ACTIVE ) for the microcontroller to perform all of the tasks in this deployment was 173 s. The sleep period (t SLEEP ) was set to be 10 s which makes the total period T for the measurement scenario to be T = 183 s.
Due to the long sampling period of the sensors, the energy required for sampling the five sensors (Table 2), has the most significant effect on the overall energy consumed by an application duty cycled node. This is purely due to the associated warm up period, which is 41 s for four of the sensors and 1.6 s for the O 2 sensor.
The energy harvested by the solar panel in deployment (II) was estimated through the information of the battery level, which was acquired with measuring the battery voltage. The period T for deployment (II) was 14,400 s. Having the data of the battery level for every 14,400 s (or every 4 h), and knowing how much energy is spent in the active and the sleep state allows the derivation of a rough figure for how much energy is harvested by the solar panel over the 4 h. Using Equation (11), we can calculate the consumed energy after each cycle T. Using Equation (12), the time taken to execute all of the sub states of the active state which for deployment (II) was 173 s. Subtracting this time from the period T will give the period spent in sleep state (t SLEEP = 14,227 s). If it is assumed that the battery has capacity C (mAh), the battery level at moment t seconds was X(t) (in %), and after 4 h the level is X(t + 14400), then the harvested energy with the solar panel could be estimated using Equation (13): If the result from Equation (13) is negative, we assume that no energy has been harvested. The power harvested is then calculated using Equation (14). Figure 7 gives the estimated power harvested by the solar panel for the days of deployment (II), derived using Equations (13) and (14).
If the result from Equation (13) is negative, we assume that no energy has been harvested. The power harvested is then calculated using Equation (14).

Simulation Results and Discussion
The state machines presented in Figures 1 and 6 were implemented and executed in MATLAB, following the node energy model described by the equations in Section 5, and using the infield power consumption measurements and sensor data from the both deployments.
For deployment (I), Equation (5) was used to calculate the energy spent in the active state. Using Equation (11) the energy spent after each cycle T was calculated, and using Equation (7) the energy available in the battery after each cycle was found. The cycle was T = 10 s. In this case we analyze a custom made WSN node with only one energy harvesting source (i.e., wind) and one power hungry sensor (i.e., ultrasonic wind sensor). The harvested energy was calculated using a real field data and Equations (3) and (8).
For the deployment (II), the energy model is described with Equations (7), (11) and (12). In this case, we analyze an off the shelf WSN node with five power hungry gas sensors that require long warm up periods. From an energy harvesting prospective, in this case, we have one energy source (i.e., solar). The harvested energy was estimated through the battery level using Equation (13) with the methodology described in Section 5. In both the simulations we assume that the ASA is running on the base station evaluating, for each period, the maximum frequency. The node is capable of recharging its battery by harvesting energy from the wind or sun, respectively, with the scaled wind turbine described in Section 4 and the solar panel described in Section 5. We also assume that the nodes are aware of the available energy. The EASA was implemented in MATLAB with the following values for its relevant parameters: c = 2.1, h = 5, W = 400, δ = 0.1% and X level = 70%. X level is the critical level of the battery at which the sampling rate is adapted according to Equations (1) and (2). Finally, the capacity of the battery in both of the deployments is 800 mAh. Figure 8 shows the sampling rate of ASA (f ASA ) vs. the sampling rate of the EASA (f EASA ) for deployment (I) and (II), respectively, for different values of m. In Figure 8a, the maximum frequency of the measured average wind speed is also presented. In both cases (Figure 8a,b), the sampling rate of ASA is adjusted by the energy aware routine, according to Equations (1) and (2). As mentioned earlier, a potential disadvantage of the EASA is the possibility aliasing occurring. When the energy level of the node is critical, the EASA could reduce the sampling frequency (rate) to a level at which it will no longer comply with the Nyquist criterion. This could cause under-sampling of the sensor signal to occur, in which case the maximum frequency of the signal will be greater than half the sampling rate. Such event is more likely to happen when the EASA is more conservative, which depends on the value of the parameter m. As depicted in Figure 8a, in the case when m = 1/3, in some occasions, the maximum frequency of the measured signal (wind speed) is higher than the sampling rate of EASA.
This will introduce an error in the measurement, which could be taken as a trade-off for staying active in the network, rather than continuing to sample at full rate and discharging the battery completely. In Figure 9, a comparison of the energy profiles of the nodes is presented. For both deployments (I) and (II), we consider the following cases: (i) the node is using the sampling rate from ASA; and (ii) when the node is adjusting the sampling frequency according to its available energy using Equations (1) and (2) with three different values of the parameter m. For deployment (II), the energy profile of the node with fixed sampling rate EFSR is also presented. In both cases (Figure 9a,b), when the energy level is above the threshold level (Xlevel = 70%), the sampling frequencies (rates) remain the same (fEASA = fASA) and the energy levels are identical, which means that the energy consumed in both cases is same. When the energy level is below Xlevel the sampling frequencies are no longer the same, which is reflected in the energy consumed by the nodes. The node on which EASA is running saves energy by reducing its sampling rate according to the current energy level. If the sampling frequency is not adapted to the energy available in the battery, the energy levels can significantly drop (below 20% in (Figure 9a) and to 0% in (Figure 9b)). In both of the figures, the same trend is present where the node running the ASA and the node using the EASA have identical energy levels until the critical level Xlevel is reached. In this figure the difference between the energy levels of node sampling the sensors with fixed sampling rate (FSR) and harvesting energy from only one source (i.e., sun in this case) can be noticed. This confirms that a significant savings can be achieved using the EASA, in comparison with using a fixed sampling rate strategy. In Figure 9, a comparison of the energy profiles of the nodes is presented. For both deployments (I) and (II), we consider the following cases: (i) the node is using the sampling rate from ASA; and (ii) when the node is adjusting the sampling frequency according to its available energy using Equations (1) and (2) with three different values of the parameter m. For deployment (II), the energy profile of the node with fixed sampling rate E FSR is also presented. In both cases (Figure 9a,b), when the energy level is above the threshold level (X level = 70%), the sampling frequencies (rates) remain the same (f EASA = f ASA ) and the energy levels are identical, which means that the energy consumed in both cases is same. When the energy level is below X level the sampling frequencies are no longer the same, which is reflected in the energy consumed by the nodes. The node on which EASA is running saves energy by reducing its sampling rate according to the current energy level. If the sampling frequency is not adapted to the energy available in the battery, the energy levels can significantly drop (below 20% in (Figure 9a) and to 0% in (Figure 9b)). In both of the figures, the same trend is present where the node running the ASA and the node using the EASA have identical energy levels until the critical level X level is reached. In this figure the difference between the energy levels of node sampling the sensors with fixed sampling rate (FSR) and harvesting energy from only one source (i.e., sun in this case) can be noticed. This confirms that a significant savings can be achieved using the EASA, in comparison with using a fixed sampling rate strategy.

Conclusions
In this paper, a novel Energy Aware Adaptive Sampling Algorithm for WSN with power hungry sensors and energy harvesting capability is presented. It has been shown that combining a traditional approach for adaptive sampling and energy aware management technique performed at node level can save energy, facilitating self-sustainability through energy harvesting. When the battery level is above a critical level, defined by the user (Xlevel), the proposed algorithm can use the sampling rate of any ASA. As the battery level goes below the critical level, the algorithm becomes more energy conservative by reducing the sampling rate. Thus, the node manages its activity in the network according to its energy levels. The algorithm was validated using real in-field data from two deployment scenarios in two different application spaces, namely, measuring wind speed and direction and monitoring bees in a smart beehive. These scenarios involved different sensors, including ultrasonic anemometers and gas sensors. Moreover, two different energy harvesting sources are considered, namely wind and solar. The aim is to achieve a self-sustainable system that can manage its activity according to the available energy. The error introduced due to aliasing can be accepted as a trade-off for staying active in the network, and not discharging the battery completely. Using the combination of energy harvesting, adaptive sampling algorithm, and energy aware management technique, an end user can be guaranteed a self-sustainable wireless sensor network

Conclusions
In this paper, a novel Energy Aware Adaptive Sampling Algorithm for WSN with power hungry sensors and energy harvesting capability is presented. It has been shown that combining a traditional approach for adaptive sampling and energy aware management technique performed at node level can save energy, facilitating self-sustainability through energy harvesting. When the battery level is above a critical level, defined by the user (X level ), the proposed algorithm can use the sampling rate of any ASA. As the battery level goes below the critical level, the algorithm becomes more energy conservative by reducing the sampling rate. Thus, the node manages its activity in the network according to its energy levels. The algorithm was validated using real in-field data from two deployment scenarios in two different application spaces, namely, measuring wind speed and direction and monitoring bees in a smart beehive. These scenarios involved different sensors, including ultrasonic anemometers and gas sensors. Moreover, two different energy harvesting sources are considered, namely wind and solar. The aim is to achieve a self-sustainable system that can manage its activity according to the available energy. The error introduced due to aliasing can be accepted as a trade-off for staying active in the network, and not discharging the battery completely. Using the combination of energy harvesting, adaptive sampling algorithm, and energy aware management technique, an end user can be guaranteed a self-sustainable wireless sensor network solution. The presented approach is especially suitable for applications with energy hungry sensors, and applications where maintenance has to be reduced to a minimum.