This section evaluates the performance of the system in a real-world environment. The system comprises an IoT-eNose, the system server and the router providing the VPN connection. The IoT-eNose responsible for data collection consists of a Raspberry Pi connected to an electronic nose through a USB port. The Raspberry Pi used is a Model 3 b+, featuring a Broadcom BCM2837B0 (Broadcom Inc., San Jose, CA, USA), Cortex-A53 (ARMv8) 64-bit SoC @ 1.4 GHz, and 1 GiB of SDRAM, whereas the eNose is the one specified in [
1]. The Raspberry Pi connects to the Internet using a TP-LINK TL-MR101 4G modem (TP-Link Technologies Co., Ltd., Nanshan, Shenzhen, China) equipped with a SIM card of the Orange company, with both components linked by an Ethernet cable. Additionally, the Raspberry Pi runs an OpenVPN client to access a VPN hosted by a TP-LINK Archer AX53 router (TP-Link Technologies Co., Ltd., Nanshan, Shenzhen, China), which connects to the Internet using a static public IP address. This configuration establishes a secure private network to protect the Raspberry Pi’s web servers and the system server from unauthorized access.
Figure 7 depicts the physical connection between the Raspberry Pi, the electronic nose, and the 4G modem. On the other hand, the system server setup is based on a personal computer with an Intel Core i7 processor (Intel Corporation, Santa Clara, CA, USA) and 32 GiB of DDR4 main memory (Micron Technology, Inc., Boise, ID, USA) running a Debian Linux distribution.
The experiments have focused on the assessment of the latency in the web server access, the reliability of the MTTQ transmission, resources utilized in the Raspberry Pi, bandwidth requirements and overall system functionality with data visualization. Next, each one of these items is explained.
6.1. Latency Assessment
The first experimental analysis aims to measure the latency introduced when communication is established via a 4G modem. The measurement tries to determine the latency during the execution of HTTP GET and POST methods, which facilitate interaction between the user’s browser and the web server hosted on the Raspberry Pi in the IoT-eNose. The communication process adheres to the standard sequence defined by the HTTP protocol. It begins with the TCP three-way handshake: the client sends a SYN packet to initiate the connection, the server responds with a SYN-ACK, and the client finalizes the handshake with an ACK. Once the connection is established, the client sends an HTTP GET request specifying the desired resource using a URL. The server processes the request and returns an HTTP response, which includes a status line, headers, and the requested content (HTML page or data). After completing the data exchange, the TCP connection is terminated through a sequence of FIN and ACK packets exchanged by the client and server.
Figure 8 illustrates this entire sequence of TCP packets and their interaction.
The latency for the entire sequence of packet exchanges is measured on the computer running the browser. To ensure the process was completed correctly, the TCP packet exchange between the computer and the Raspberry Pi was initially captured using the Wireshark V4.4.2 software. This capture verified the integrity and accuracy of the interaction.
Figure 9 displays the sequence of exchanged packets, with the timestamp of each packet listed in the first column. These timestamps allow for precise measurement of the duration of the sequence, which is approximately 69 milliseconds.
To achieve statistically significant results, this experiment was repeated automatically ten thousand times to obtain a more reliable average value for the latency. Additionally, a second experiment was conducted to measure the latency when the Raspberry Pi was directly connected to the same router as the client computer via an Ethernet cable. The histograms representing the latency distributions for these two scenarios are shown in
Figure 10 and
Figure 11, respectively. The mean latency values for both cases were calculated, with a delay of 67 milliseconds for the 4G connection and 3 milliseconds for the one with the direct Ethernet connection. From these results, it can be concluded that the delay caused by the 4G connection significantly impacts the access time to the web server hosted on the Raspberry Pi. Specifically, the 4G connection increases the access latency by a factor of 20, highlighting the substantial influence of network delay on the server’s response time. This delay is a critical factor to consider in applications where the system is responsible for controlling elements that depend on a feedback loop with strict time constraints. In such scenarios, the introduced delay could disrupt the real-time response of the system, potentially leading to performance degradation or failure to meet the required timing for accurate operation.
Additionally, this latency can impact the web response time and the overall user experience when managing the IoT-eNose through the web interface. Keeping this time low enhances the user experience and reduces the server response time. The experimental results have shown that the web server in the Raspberry Pi can produce a rapid response to user requests. However, the use of cellular connection enlarges this response time due to the transmission latency, but even in this case, the time remains low enough to ensure a good user experience.
6.2. MQTT Messages Transmission Reliability
The goal of this experiment is to determine the system reliability during data transmission from the IoT-eNose to the system server using the MQTT protocol. As stated in the previous section, the QoS selected is 0, indicating that no reception guarantee is configured. This evaluation involved the transmission of 10,000 MQTT messages published from the IoT-eNose and their reception and storage in the system server database. To this end, an experiment with this number of data samples was carried out. During the test, a Wireshark session on the Raspberry Pi of the IoT-eNose was open to detect erroneous transmissions. As can be seen in
Figure 12, the first detected error is due to a TCP retransmission, indicating that the sender did not receive an acknowledgment (ACK) for a previously sent packet within the expected time, prompting it to resend the packet. The second error detected indicates a duplicate ACK, which occurs when the receiver receives an out-of-order packet and is still waiting for a specific packet. This is a consequence of previous packet loss or delayed reception. After the completion of the test the percentage of TCP retransmissions detected was 0.5% of the total number of packets transmitted from the IoT-eNose to the system server with MQTT messages. Despite these packets’ losses and delays, TCP ensures packets are received in order and includes error checking and acknowledgment features, resulting in reliable packet transmission.
However, MQTT with QoS level 0 does not guarantee message delivery, acknowledgment, or retransmission, so data loss can still occur at this stage. Nevertheless, during the experiment conducted, no data loss was detected, and all the MQTT messages were correctly received by the subscriber running on the system server and saved in the MariaDB database. Thus, this experiment has corroborated that with a sampling rate of approximately two data messages transmitted per second, and using MQTT components based on the Python Paho library, reliable data transmission and storage can be accomplished with no data loss. This result confirms the robustness of the data collection process achieved in the proposed system with the MQTT protocol.
The network bandwidth used for transmitting the MQTT data sequence has also been measured using the Wireshark tool and it accounts for 4.6 kbps. If all the aggregated traffic is considered, including updates sent via websockets to the user’s browser, the total bandwidth rises to 9.4 kbps. Even though this bandwidth is quite low compared to the bandwidth provided by 4G/5G connections available with the modem used, which contributes to the correct transmission and storage of the collected data.
6.4. Data Visualization
The last experiment focuses on visualizing the data collected by the electronic nose in the user’s web browser. The Bokeh library integrated in the Python application running on the system server is utilized for dynamic data representation. In this setup, the system server provides access to data collected from the IoT-eNose that comprises the eight gas sensors, which are stored in the MariaDB database. Each sensor’s data can be accessed via eight distinct URLs hosted by the system server. When the user visits the main page, the browser first downloads the JavaScript code that performs the rendering of the graph, enabling the data visualization in the browser. Once the JavaScript is executed, the browser begins automatically retrieving and updating the data for each sensor channel. This is performed by sending requests to the corresponding web services associated with each sensor. The browser ensures that the data for each channel is continuously updated and the corresponding line in the graph is dynamically plotted to reflect real-time data changes.
A network traffic capture using Wireshark shows the sequence of URLs accessed by the browser to fetch the data, this capture is shown in
Figure 14. In this experiment, the system server was directly connected to the router via an Ethernet cable to minimize external delays. The user computer requests data from all eight sensor channels, with each request retrieving the corresponding data from the database. To simplify the visualization of the web service access, many TCP data packets were omitted from the capture. This setup enables the calculation of the delay required to fetch the JavaScript code and sensor data needed for rendering the graph. In this specific configuration, with both the user computer and the system server directly connected to the router via Ethernet, the total time required for this process is approximately 622 milliseconds.
Once the user’s browser receives all the necessary information, it can render the graph displaying the data and the values provided by each sensor.
Figure 15 depicts the data graph as it appears in the user’s browser. The graph is designed to be updated automatically every 2 s, as specified by the parameters of the AjaxDataSource() function. This means the browser periodically fetches new data from the system server at this fixed interval. This continuous refresh mechanism ensures that the graph reflects real-time data as it is being collected by the IoT system and stored in the database, enabling dynamic and up-to-date visualization for the user. In addition, the measured delay in the retrieval of the data from the system server is lower than the update time configured in the AjaxDataSource() function, ensuring that this process can be performed efficiently.
The conducted experiments have confirmed the robustness of the system and the successful accomplishment of its intended functionality. The system provides a good response time, reliable and secure data transmission, and a low usage of IoT-eNose resources and bandwidth. This enables the real-time analysis of agricultural products in remote areas, ensuring timely and accurate data collection.
6.5. Application for Detecting Rot in Lemon Fruits
To evaluate the performance of the IoT-eNose system in a real-world agricultural setting, an experimental study was conducted using lemons provided by Citrus Gea Belmonte, S.L., a Spanish company specialized in citrus harvesting, and commercial distribution. The selected fruit belonged to the ‘Verna’ variety, known for its extended harvesting season and sensitivity to post-harvest conditions. All lemon samples were uniformly treated with 0.1% sodium benzoate (BS), a common preservative used to inhibit microbial growth and extend shelf life, as outlined in
Table 2. The primary objective of the experiment was to assess the capability of the IoT-eNose to monitor changes in volatile organic compound (VOC) emissions over time, which are indicative of fruit freshness, ripeness, and potential spoilage.
To this end, the IoT-eNose system was deployed directly within the company’s facilities, enabling continuous and non-invasive monitoring of lemon batches under typical storage and handling conditions. Data acquisition was carried out over several weeks, capturing VOC profiles from multiple batches to allow for longitudinal analysis. This setup provided a realistic environment to evaluate the system’s robustness and sensitivity to temporal variations in VOC emissions, which may be influenced by pre-harvest treatments, storage parameters, and environmental factors. By integrating sensor data with time-series analysis, the experiment aimed to uncover patterns that could support early detection of quality degradation.
The organization of the fruits for this study was meticulously employing a randomized and homogeneous distribution approach. Each experimental condition consisted of three distinct lots, with each lot containing 10 lemons. The distribution strategy ensured that control lemons were grouped together, while two additional lots underwent field treatments involving sodium benzoate (BS) additive applications, specifically labeled as BS0.1 × 3 and BS0.1 × 4 passes. To maintain consistency and traceability, all lots were meticulously placed in IFCO boxes, each box appropriately labeled to indicate the respective treatments applied.
Measurement sessions using the IoT-eNose were systematically scheduled for 4 weeks. The first batch (CNT) underwent analysis every Monday across weeks 1 through 4. Similarly, the second batch (BS0.1 × 3) was analyzed every Tuesday during the same weeks, while the third batch (BS0.1 × 4) underwent analysis every Wednesday. This staggered schedule allowed for a comprehensive month-long monitoring period for each lot, enabling thorough evaluation of rot development through the IoT-eNose analyses. Such a systematic approach facilitated the detection of volatile organic compound patterns associated with fruit decay progression over time. It is pertinent to note that when the fruits were not undergoing analysis, they were stored in cold rooms maintained at a controlled temperature of 8 °C and relative humidity ranging between 80% and 85%. This storage condition was meticulously managed to prevent cold damage and maintain fruit quality until analysis, ensuring that environmental conditions did not compromise the integrity of the samples during the experimental period. This experimental setup and logistical framework not only ensured the systematic evaluation of rot development under controlled conditions but also underscored the importance of precise scheduling and environmental control in agricultural research. The use of IoT-eNose technology in conjunction with standardized storage protocols represents a significant advancement in fruit quality assessment, offering insights that can inform decision-making processes aimed at optimizing crop management practices and post-harvest handling techniques.
Principal Component Analysis (PCA) was employed to analyze and group the samples based on the collected data. The sample distribution was intentionally designed to reflect both within-group variability and treatment contrast, using a randomized and balanced block structure (3 lots of 10 lemons per treatment), ensuring replicability and statistical robustness. However, we will now include a justification matrix linking the biological variability of lemon VOC emissions with sensor response dynamics. Initially, the data were structured into a matrix format, followed by normalization to ensure each variable contributed equally to the analysis. This step was crucial to prevent variables with larger scales from dominating the principal components (PCs) solely based on their magnitude. The matrix was then decomposed into principal components (PCs), which are new variables that capture the maximum variance in the data. These components were ordered such that the first PC explains the most variance, followed by the second PC, and so on.
The dataset used for PCA consisted of 90 data points, corresponding to measurements obtained from fruits using the IoT-eNose prototype.
Figure 16 visually represents the results of the PCA performed on these data points. The analysis aimed to explore how the samples clustered relative to the week of analysis, providing insights into temporal variations or trends. Each sample is visually depicted as a point in the plot, with larger points indicating cluster centroids that summarize the groupings of data points. In
Figure 16, samples analyzed during week 1 are depicted in red, primarily clustering in the lower left part of the plot. This clustering suggests that samples from week 1 share similar characteristics, possibly related to their composition or condition during measurement. In contrast, samples from week 2 are shown in orange and tend to cluster in the upper left portion of the plot, indicating a distinct grouping from week 1. Samples from week 3 are represented in gray and exhibit a more scattered distribution across the right side of the plot, suggesting greater variability or diversity among these samples compared to weeks 1 and 2. Overall, the PCA provided a structured approach to discerning patterns and grouping samples based on their characteristics derived from the IoT-eNose measurements. By focusing on specific phases and cycles of data collection, we aimed to extract meaningful insights that could inform further research or practical applications in quality assessment or classification tasks related to fruit analysis.
On the other hand,
Figure 17 provides a detailed illustration of how the data are grouped based on both the week of analysis and the specific treatments applied. In this experimental setup, there were three distinct treatments and a span of three weeks over which the analyses were conducted, resulting in a total of nine distinct groups. The primary objective of this analysis was to elucidate the relationship between the applied treatments and the incidence of fruit rot, thereby evaluating the efficacy of each treatment method. Upon closer examination of
Figure 17, several notable patterns emerged. Initially, during week 1 of the analysis, it was observed that samples from all three treatments exhibited a tendency to cluster together in the lower left part of the plot. This clustering was particularly evident among control samples, which formed a distinct cluster within this region. Additionally, some samples from the BS0.5 × 3 treatment group during week 2 also showed a tendency to join this cluster.
The distinct grouping of samples according to treatment and week highlights potential correlations between treatment application and the observed outcomes related to fruit rot. Each treatment’s efficacy in mitigating or influencing the development of fruit rot can be inferred from the clustering patterns observed in
Figure 17. By visually mapping these clusters, it becomes possible to assess how each treatment performed across different time points, offering insights into their effectiveness under varying conditions. Moreover, beyond mere visual observation, statistical analysis can further validate these clustering patterns and provide quantitative measures of treatment efficacy. Techniques such as analysis of variance (ANOVA) or clustering algorithms can be employed to assess the significance of these groupings and determine whether the observed differences are statistically significant. Furthermore, understanding the dynamics of how treatments interact with temporal factors such as the progression of weeks is crucial. For instance, the consistent clustering of control samples in week 1 suggests a baseline level of fruit rot incidence before any treatment effects are applied. In contrast, the variability in clustering observed in subsequent weeks, particularly with the BS0.5 × 3 treatment group, may indicate varying levels of treatment effectiveness over time or in response to changing environmental conditions.
In conclusion,
Figure 17 serves as a visual representation of the complex relationships between treatments, weeks of analysis, and the incidence of fruit rot. It underscores the importance of systematic analysis and data visualization in agricultural research, offering insights that can inform future experimental designs and agricultural practices aimed at optimizing fruit quality and yield. Further exploration of these patterns through advanced statistical methods will contribute to a more comprehensive understanding of treatment impacts on fruit health and overall crop management strategies.
Finally, the culmination of our analysis involved the training of two Support Vector Machine (SVM) models designed to predict distinct scenarios based on the data collected. These models were developed using k-means clustering as part of their preprocessing step to enhance classification accuracy.
Figure 18 visually presents the outcomes of the SVM model tailored to classify lemons according to the week of analysis, while
Figure 19 demonstrates the classification results considering both the week of analysis and the specific treatment applied to the lemons.
In the experimental setup, the dataset encompassed comprehensive measurements and observations over multiple weeks, with three distinct treatments under scrutiny. This comprehensive approach allowed for a nuanced evaluation of how temporal factors and treatment variations influence the classification outcomes. Upon rigorous training and validation, both SVM models exhibited exceptional performance in their respective classification tasks. Notably, the model depicted in
Figure 18 achieved a remarkable 100% accuracy in classifying lemons according to their respective weeks of analysis. This flawless accuracy underscores the robustness of the SVM algorithm in capturing the temporal patterns inherent in the dataset. In contrast,
Figure 19 showcases the results of the SVM model tasked with classifying lemons based on both the week of analysis and the specific treatment applied. Despite the added complexity of predicting outcomes influenced by treatment variations, this model also achieved a notable 100% accuracy in its classification task. This achievement highlights the efficacy of SVM models in handling multifaceted datasets and discerning subtle variations in classification patterns across different experimental conditions.
However, it is essential to note the role of k-means clustering in enhancing the initial classification accuracy. In the first scenario, where classification was based solely on the week of analysis, the SVM model achieved 100% accuracy. In contrast, when k-means clustering was employed as a preprocessing step to refine the classification boundaries, the accuracy slightly decreased to 92%. This slight reduction suggests that while k-means clustering effectively aids in grouping similar data points, there may still be inherent variability that impacts classification outcomes. Similarly, in the second scenario where classification considered both the week of analysis and treatment variables, the SVM model initially achieved 100% accuracy. However, with the inclusion of k-means clustering as a preprocessing step, the classification accuracy notably decreased to 34%. This observation reveals an over-simplification of the input space, leading to a loss of critical variance required for effective neural network learning. This significant reduction highlights the inherent complexity of classifying data points when multiple variables are considered simultaneously, necessitating further investigation into refining the clustering and classification methodologies. This reinforces the conclusion that preprocessing methods must preserve VOC signature fidelity for IoT-eNose applications. Despite statistical evaluation, the technical validation of the IoT-eNose was demonstrated by its ability to distinguish decay stages and treatment effects in real-time under field-mimicking conditions.
The comprehensive evaluation of these SVM models and their associated preprocessing techniques not only underscores their potential in accurately predicting experimental outcomes but also emphasizes the importance of robust data preprocessing methods in optimizing classification performance. Moving forward, continued research efforts will focus on refining clustering algorithms and enhancing SVM model capabilities to handle increasingly complex datasets and diverse experimental conditions.
In conclusion,
Figure 18 and
Figure 19 provide compelling visual representations of the SVM models’ capabilities in classifying lemons based on temporal and treatment-related factors. The achieved accuracies demonstrate the potential of machine learning algorithms in agricultural research settings, where precise classification of experimental outcomes can significantly impact decision-making processes and enhance agricultural practices for improved yield and quality outcomes, specifically rot monitoring.