# An Interoperable Component-Based Architecture for Data-Driven IoT System
## 4 Use Case and Implementation
### Implementation  
To validate the feasibility of the proposed architecture, we built a prototype edge IoT system and deployed the system to the real-world for experimental purpose. The hardware architecture illustration of the proposed edge IoT system is shown in Figure 2. Firstly, Raspberry Pi 3 is used as the edge device to host the central control system. The data transmission from the edge device to the data storage server is also achieved through the MQTT protocol. Arduino MKR1000 microcontroller (Arduino, Massachusetts, USA) is used as the hardware for end device components. We integrated the MKR1000 microcontroller with a voltage and a current sensor to detect the operating voltage and current of the solar PVs. The microcontroller wirelessly transmits the sensed data through the MQTT protocol to the Raspberry Pi 3. The Raspberry Pi 3 then processes the inbound data and generates a feedback value to the MKR1000 microcontroller. The microcontroller receives the feedback signal, converts the received feedback into a PWM signal and apply the signal by matching it with the operating frequency of the solar PV power converter to update the operating voltage of the solar PV. Finally, the data are streamed to the database server for storage. The data transmitted from the end devices are transferred to a server through MQTT, from the edge device as soon as the data is received. Since our data are time series data, we decided to use _InfluxDB_[39], which is a time series  
Figure 2: Hardware illustration of Edge IoT system (MPPT use case). database (TSDB). It is optimized for fast storage and retrieval of time series data for application such as operations monitoring, application metrics, IoT sensor data, and real-time analytics. Apart from that, _InfluxDB_ is integrated with MQTT plugins, which enables direct MQTT messages storage in the database without MQTT broker installation or any extra effort to process the data. Furthermore, the data in _InfluxDB_ can be easily visualized through _Grafana_[40], which is a customizable data visualization platform that supports direct integration with _InfluxDB_. The data from the external data input component are also streamed to the same server. The overall data-driven IoT system architecture layer illustration is shown in Figure 3. The main functions consist of data processing and data-driven feedback functions. The data processing function receives the inbound data from microcontrollers in string format and decodes the message to extract the necessary sensor values. The function recognizes the device ID through the subscribed MQTT topics. For instance, we programmed the first solar PV's end device to publish the data string under the topic \"Sensor/PV_1\" and the second solar PV's end device as \"Sensor/PV_2\". The data string is processed to extract the voltage and current readings. After processing the data, the function transmits the extracted sensor values to the data-driven feedback model and data storage server simultaneously. The program flow of the overall program of the proposed IoT system is shown in Figure 4. The explanations for each function are as follows. * Data Processing Function: Firstly, the system receives data from the voltage and current sensors, and the sensor IDs are identified through the topic of the MQTT messages. After that, the message, which is in the format \"_Voltage/Current_\", is decoded to extract voltage and current values. The extracted data are then labeled according to their respective device ID and are assigned to the corresponding data-driven feedback model. For instance, the voltage and current data with device ID \"_PV_#\" are assigned to their respective MPPT data-driven feedback model for feedback generation. * Data-driven model: The data-driven model generates feedback through the MPPT algorithms: Perturb and Observe (P&O) and Incremental Conductance (InCond).