## 4 Experiments and Results
### Implementation Results
#### 4.2.1 Energy Consumption Results  
In this section we have performed the tests defined in Section 4.1.1. During the experiments, the development board has been monitored (voltage and current values) using the INA219 sensor. In Table 3 we show the mean values for current measured by the sensor when performing each experiment. In Table 4 the consumption results for each configuration are shown.  
\begin{table}
\begin{tabular}{l c c} \hline
**Value** & **Mean** & **Standard Deviation** \\ \hline \(T_{T\_NoAutth}\) & 43.83 & 5.99 \\ \(T_{T\_Autth}\) & 67.74 & 11.07 \\ \(T_{P\_Intros}\) & 11.84 & 1.28 \\ \(T_{P\_pyAutth}\) & 0.23 & - \\ \hline \end{tabular}
\end{table}
Table 2: Results in delay measurement (milliseconds). \(T_{T\_NoAutth}\): Time without using the authorization module; \(T_{T\_Autth}\): Time using the authorization module; \(T_{P\_Intros}\): Time needed to obtain the AS validation response; \(T_{P\_pyAutth}\): Time imposed by the authorization module.  
\begin{table}
\begin{tabular}{l c c} \hline
**Developer Board** & **Wi-Fi** & **Mean** & **Standard Deviation** \\ \hline Idle state & Off & 33.47 & 1.67 \\ Idle state & On & 81.08 & 4.21 \\ HTTP Client (with requests) & On & 96.37 & 7.38 \\ MQTT Client (with requests) & On & 88.48 & 2.40 \\ MQTT Client (with requests and auth.) & On & 88.51 & 2.27 \\ \hline \end{tabular}
\end{table}
Table 3: Current measures during the experiments (milliamperes).  
Table 3 shows the mean value and the standard deviation for electric current consumption from the development board NodeMCUv1 when we simulate the transmission and reception of 1000 messages using the following configurations:  
* Idle state (Wi-Fi off): Development board with disabled Wi-Fi interface, in idle state during the average time it takes to send and receive 1000 messages in the other experiments.
* Idle state: Development board with enabled Wi-Fi interface, but still in an idle state during the average time it takes to send and receive 1000 messages in the other experiments.
* HTTP Client (with requests): Wi-Fi interface enabled and performing the transmission and reception task for 1000 messages with the HTTP following the REST architecture.
* MQTT Client (with requests): Wi-Fi interface enabled and performing the transmission and reception task for 1000 MQTT messages using the default protocol configuration, and disabling the authorization module both in the IoT device and the Broker.
* MQTT Client (with requests and authorization module): Wi-Fi interface enabled and performing the transmission and reception task for 1000 MQTT messages using the proposed configuration. That is, enabling the authorization module in both the IoT device and the Broker.  
Besides the current values shown in Table 3, we have carried out the same mean calculation using the voltage used to feed the development board. The mean value obtained is 5.08 V with a standard deviation of 0.07.  
Using the resultant values, we can obtain the energy consumption for each message transmission in each configuration by applying Equation (5), where \(V_{cc}\) is the voltage (in volts), \(l_{c}\) is the current (in amps) measured during the message transmission, and \(t_{m}\) is the time needed (in seconds) for the message to be fully transmitted.  
\[E_{c}=V_{cc}\times l_{c}\times t_{m}[J] \tag{5}\]  
In Table 4 we show the energy consumption (in millijoules) needed for the transmission of a single message in each one of the configurations used in the experiments where there is actual message transmission.