## 4 An Interoperable IoT Architecture for Precision Agriculture (RQ4)
### Functional Requirements of IoT Architecture  
The requirements of the system architecture have been identified. Some of these are met by the chosen standard, while others are inherent in the technology being used.  
The proposed architecture aims to be as \"adaptable\" as possible to the types of needs that may arise in the context of precision agriculture. The main requirements are listed below.  
* Absence of model constraints in sensor usage
* Support for various communication protocols
* Ensured data homogeneity
* Easily scalable
* Data storage capability
* Data visualization capability based on user-defined filters
* Sensor status monitoring
* Ease of use
* Use of open-source software
* Accessibility from mobile devices
* Autonomous with minimal routine maintenance  
The proposed architecture is shown in Figure 3 The diagram illustrates the communication flow between devices and highlights the protocols used in the various sections that make up it. The system consists of three sections: the first section represents the various sensors located in agricultural fields that periodically send data to the gateways. The second section includes the gateways that communicate with _connectors_, which act as \"translators\" for the data being sent to the third section, which comprises the server and the central database [82]. Regarding the first section, we deploy heterogeneous sensors produced by different companies and equipped with various communication methods. The various devices communicate with the associated gateway using different technologies, which may fall under the LPWAN (Low-Power Wide-Area Network) category, such as LoRaWAN or SigFox, or utilize a wireless connection to the Internet [73].  
In the second part, the gateways act as bridges between non-IP protocols, used to communicate with the sensors, and MQTT, the protocol used to communicate with the connectors. Unlike the sensors, the gateways do not face significant issues regarding autonomy and are connected to the Internet. Their task is to forward the data received from the sensors to the broker, which in turn will publish the messages to their respective topics. The _connectors_ are used to collect heterogeneous data from various gateways, convert it into the OGC SensorThings format, and redirect it to the server via the RESTful protocol [83]. In the network to be created, a dedicated connector is set up for each sensor model connected to the network. In the MQTT network, the gateways are essentially the \"publishers\", while the connectors play the role of \"subscribers\". A gateway publishes to the \"topic\" corresponding to the sensor model from which it received the payload. A connector \"listens\" only to the topic on which the payloads it can convert are published. The use of MQTT  
Figure 3: Block diagram of the interoperable IoT architecture for precision agriculture.  
helps keep the payload size small and allows some sensors to communicate directly with the connector, bypassing the gateway if they have their own Internet connection [62].  
Another advantage of this configuration is the ease of system scalability. In fact, if additional sensor models need to be added to the network later, it will only be necessary to add a new \"topic\" to the MQTT network and associate a connector with it, without modifying the pre-existing configurations. In the third section, the server implements one of the available open-source software solutions for managing an OGC SensorThings database. In the following subsection, the available alternatives will be analysed, and the one most suitable for the proposed system will be selected. These implementations use an SQL database for storing information, with support for managing spatial geographic features [84]. Finally, the central server is connected to a client that can request, process, and visualize the data contained in the database.