# The Impact of Cloud Versus Local Infrastructure on Automatic IoT-Driven Hydroponic Systems
## 3 Results
### Software Comparison Infrastructure Between AFCI and LSI
#### 3.2.1 Software Infrastructure of the AFCI  
From a software perspective, AFCI constructs its M5 Stack request in the form of JSON, as shown in the following example:  
_(temperature_DS18B20\": 28.19, \"temperature_DHT22\": 30.9, \"humidity_DHT22\": 43.3, \"soil_moisture\": 1, \"water_level\": 1.87, \"EventProcessedItcTime\": \"2025-02-28T16:39:43.2929208Z\", \"PartitionId\": 0, \"EventEnqueuedItcTime\": \"2025-02-28T15:41:54.6700000Z\", \"IoTHub\": { \"Messageld\": null, \"CorrelationId\": null, \"ConnectionDeviceld\": \"1\", \"ConnectionDeviceGenerationId\": \"638763404011884782\", \"EnqueuedTime\": \"2025-02-28T15:41:54.5810000Z\" } } In this example, the DS18B20 sensor recorded a temperature of approximately 28.19 \({}^{\circ}\)C in the liquid. The DHT22 sensor reported an ambient temperature of 30.9 \({}^{\circ}\)C and measured the relative humidity of the air at 43.3%.  
The liquid conductivity value is 1%, which suggests that the liquid is not detected at all. This value indicates the need to trigger the event of starting the irrigation pump. The water level has been measured at 1.87%. This parameter indicates how much liquid is available in the reservoir, suggesting the necessity of starting the pump.  
The EventProcessedUtcTime indicates the moment when the cloud service processed the event. It is expressed in UTC (Coordinated Universal Time). The identifier of the partition from which the event originates is 0. Partitions are used in distributed systems to identify the origin of the data. Extending the monitored plants needs to consider multi-partitioning. The EventEnqueuedUtcTime indicates when the event was added to the queue for processing, which is also expressed in UTC format.  
The IoT Hub section contains metadata about the connection of the IoT device with the hub:  
* Messageld is null, meaning the message does not have a specific ID;
* ConnectionDeviceId is the unique identifier of the device, explicitly set in the Azure graphical interface for a specific device. The ID of the connected device is 1, uniquely identifying the device that sent the data;
* ConnectionDeviceGenerationId is the identifier for device generation;
* EnqueuedTime is the exact moment when the message was queued in IoT Hub.  
An Azure Stream Analytics Job connects mStackInstance (IoT Hub) and the SQL Server Database. This service identifies the data event in the Hub, retrieves it, and deposits it into the database. To achieve this, the software pipeline needs to be studied, analyzed, and built, as illustrated in Figure 9. Here, mStackInstance is the job's input, while the database table is the output. A server for SQL Database hosting is also set up in the Azure portal.  
The most important software component is the Azure Stream Analytics service, as presented in Figure 9. The image highlights how the data from a device (M5 Stack), used for managing the hydroponic system, is processed and monitored. In the central part of the image, the Query section shows the SQL script that selects all data from the stream. The stream service acquires the data from mStackInstance and inserts it into the hydroponicDB  
Figure 9: Software pipeline architecture for data processing through Azure Stream Analytics Hub.  
database. This infrastructure is configured to continuously capture and store data from the hydroponic system sensors, which are monitored at one-hour intervals.  
In the lower part of Figure 9, the Job simulation (preview) section displays a chart of the data processing workflow. In this chart, an input node can be observed fetching data from the m5 stackInstance service, followed by an intermediate processing step labeled Computing hydroponicdb, then a merging step (Merger), and finally, the output into the hydroponicDB database.