## 4 LOKA: LOw Power Consumption Algorithm
\[I_{\mu Current}=V_{ADC}=\frac{result\cdot(V_{refp}-V_{refn})}{2^{n}}+V_{refn} \tag{2}\]

The Equation (3) corresponds to the total energy consumption in the prototype device taking into account the Equations (1) and (2). \[W[J]=\cdot E\cdot T\cdot\sum_{j=1}^{N}[\frac{result_{j}\cdot(V_{refp}-V_{refn })}{2^{n}}+V_{refn}]_{j}=\frac{E}{f}\cdot[t\cdot f\cdot V_{refn}+\frac{V_{ refp}-V_{refn}}{2^{n}}\cdot\sum_{j=1}^{N}result_{j}] \tag{3}\]

Finally, we set the following setting values for the Equation (3): \(E\) to 3.7 V, _Vrefp_ to 2.4 V, _Vrefn_ to 0.9 V and a frequency of 95 KSPS. Then, Equation (4) shows the consumption in Joules for a time \(t\) gathering \(N\) energy measures. \[W[J]=3895\times 10^{-8}\cdot(85500\cdot t+\frac{1}{2730}\cdot\sum_{j=1}^{N} result_{j}) \tag{4}\]The experimental setup is shown in Figure 6. It is composed of a \(\upmu\)Current device, the LPC824 and a PC. Through this configuration, we implemented the Equation (4). LPC824 calculates the summation for \(N\) measures of the ADC at a frequency of 95 KSPS. Then, it sends to a PC the summation through the UART port. Finally, the PC calculates the Equation (4) and saves the result. We have collected measures with different configurations of transmit data interval and operation time. The collected measures are divided into two classes of experiments: without LOKA and with LOKA. In the experiments without LOKA there is no duty-cycling algorithm implemented in the sensor mode, and therefore, all electronics components are in active mode. In the experiments with LOKA, the designed duty-cycling algorithm turn off and on the radio module (XB24 end-device) and change the power mode of the electronic components. These experiments always send periodically 64 bytes of sensor data to analyze the energy consumption during the operation time. One one side, the prototype mode with LOKA was tested in 360 experiments divided in blocks of 30 measures. On the other side, the prototype mode with LOKA was tested in 60 experiments divided in blocks of 5 measures. The energy consumption obtained showed that the standard deviation is small so we consider that the number of samples is enough to support our conclusions. For both experiments, we considered different values for the transmit interval time and the operation time:

* Discrete values of transmit data interval: [10; 30; 60] (seconds). * Discrete values of operation time: [60; 300; 600; 900] (seconds). As can be observed in the Figures 7 and 8, the energy consumption is reduced along the time using the LOKA. The longer the operation time and the longer the transmit data interval, the higher consumption reduction we obtain with LOKA. The maximum energy consumption reduction in our experiments was applying LOKA with a transmit data interval of 60 s and a time operation of 900 s getting a reduction above 12 Jules. In contrast, the minimum energy consumption reduction was applying LOKA with a transmit data interval of 10 s and a time operation of 60 s getting a reduction below 1 Joule. In all cases, applying the Equation (5), LOKA always reduces the energy consumption more than 55% respect to the prototype without our algorithm. Then, we achieve our objective of extending the time between battery charges. \[Energy\ reduction=\frac{E_{without\ LOKA}-E_{with\ LOKA}}{E_{without\ LOKA}} \times 100\% \tag{5}\]

Figure 6: Experimental energy measuring schema is measured converting the current into voltage with the \(\upmu\) Current device and using it as the input of the LPC824’s ADC to be calculated with a PC. ### Comparison between LOKA and Popular WSN Platforms

In this section the energy consumption of multiples academic and industrial WSN platforms are compared to the prototype where LOKA has been deployed. In particular, we focus on the energy consumption of the microcontrollers and the radio transceivers of these platforms.