# Embedding Security Awareness in IoT Systems: A Framework for Providing Change Impact Insights
## 3 Approach
### IoT Based Smart Irrigation System Testbed  
Our designed IoT based Smart Irrigation System testbed has five layers, by adopting general IoT architecture [30; 31], as shown in Figure 1. The Physical Layer consists of soil moisture sensors for monitoring soil water content, along with temperature and humidity sensors to capture ambient environmental conditions. These sensors are integrated through a hardware circuit centered around a Raspberry Pi, enabling real-time data acquisition and control. In the testbed environment, a buzzer is used as an actuator to simulate the behavior of an irrigation mechanism. This configuration supports controlled testing and validation of automated decision-making and response strategies within the system. To support data acquisition, the hardware circuit incorporates an Analog-to-Digital Converter (ADC) that converts the analog signals generated by the sensors into digital data. This conversion enables Raspberry Pi devices, positioned at the Edge Layer, to collect and process sensor input effectively. Within the Physical Layer, two primary processes are executed: _ReadSensor_, which captures real-time data from the sensors, and _SendSensorDataToEdge_, which transmits the digitized data to the Edge Layer. Communication between the Physical and Edge Layers is facilitated using the User Datagram Protocol (UDP), a lightweight and efficient protocol well-suited for real-time, low-overhead sensor data transmission. Figure 1: Process flow diagram of IoT-based Smart irrigation system testbed. The Edge Layer comprises Raspberry Pi devices responsible for collecting, preprocessing, and aggregating sensor data before forwarding it to a centralized server in the Cloud Layer. Upon receiving sensor data, each Raspberry Pi executes a sequence of processes, illustrated in Figure 1. The _CollectSensorData_ process temporarily stores raw sensor readings for a predefined time window to support temporal analysis. The _CleaningSensorData_ process enhances data integrity by filtering out anomalies such as null values, duplicate entries, and corrupted records. Next, the _AggregateSensorData_ process computes statistical summaries (including average, minimum, and maximum values) to represent prevailing environmental conditions (e.g., soil moisture) over the specified interval. The final step in this layer, _SendsSensorDataToCloud_, transmits the aggregated data to the Cloud Layer using the Transmission Control Protocol (TCP), which ensures reliable and ordered data delivery, and incorporates basic security mechanisms to protect data during transmission. The Cloud Layer functions as the computational core or \"brain\" of the IoT system, responsible for executing advanced analytics and managing sensitive data. On the server side, a ML model is deployed to predict soil moisture levels and inform automated control decisions. We designed an automated pipeline that manages the end-to-end flow from data reception to actuator decision-making based on the model's output. The pipeline initiates with the _ReceivedSensorData_ process, which stores aggregated data from the Edge Layer into a local repository and logs the status of each transaction. The subsequent _PreProcessSensorData_ stage formats and encodes the data, transforming it into a valid input instance for the ML model. This instance is then processed by _FeedSensorDataToMLModel_, which forwards the data to the prediction model. The _ExecuteMLModel_ process activates the model to generate a prediction, which is logged by _GetMLModelPrediction_. The final stage, _DecideToTriggerActuator_, evaluates the prediction outcome and determines whether the irrigation valve actuator should be activated or not. The resulting decision is communicated along two paths:  
1. To _ShowAnalysisResult&TriggerDecision_ at the Application Layer, where the user is notified of the prediction and actuator decision. 2. To the Edge Layer, where the _SendTriggerToActuator_ process relays the command to the Physical Layer.