# An Efficient Interface for the Integration of IoT Devices with Smart Grids
## 1 Introduction  
The evolution of computing devices and ubiquitous computing has led to the development of the Internet of Things (IoT). This technology encompasses several devices with different functionalities that can be interconnected in the same environment or even in separate environments. IoT applications are diverse, and some typical applications include Industry 4.0, logistics, and smart cities [1]. The latter is further subdivided into traffic, sanitation, agriculture, security surveillance, and Smart Grids (SGs), which are the focus of this article.  
SGs are different from traditional power grids, which are structures with the sole function of transmitting and distributing electricity from remote plants to end consumers. On the other hand, SGs make intensive use of communication technologies in the power grid to enable the transfer of status information from various components in the grid. This feature allows to implement strategies for system operation and control more efficiently than conventional solutions. SGs, in conjunction with IoT, can be seen as an answer to fundamental questions in the energy market. In fact, what makes an SG \"smart\" is its ability to bidirectional communication, sensing, management possibilities, and the use of protocols that allow data exchange, as seen in [2; 3; 4; 5; 6]. Consequently, all stakeholders in the electricitysector, from generation to industrial or residential users, must work together for the continuous flow of generation and use of information generated by SG. With that, the integration between the different protocols of IoT and SG is the main challenge caused by the development directed to different purposes.  
As highlighted in [7], the communication architecture is a quite important aspect to be considered in SGs, because this architecture must provide the necessary infrastructure to support the expected SG functionalities based on automated and intelligent management and control functions in electrical power systems. Besides, it must fulfill the performance requirements, including timing, since timing is a critical aspect to take into account in SGs communication, especially with regards to power system operation and protection.  
Cyber-Physical Systems (CPSs), such as SG and IoT systems, are represented by platforms that are integrated through connectivity protocols that enable to share information among the different devices [8; 9]. Several standards can be used for IoT communication, such as Constrained Application Protocol (CoAP) and Message Queue Telemetry Transport (MQTT). These protocols can be applied to a general IoT context, but are not recommended or standardized for use in SGs, as the Open Smart Grid Protocol (OSGP) is. A solution is necessary to integrate those protocols and enable data exchanges between general application protocols and specific application protocols such as OSGP.  
Given the heterogeneity of general and specific applications and protocols, we identified a gap regarding the mapping of data packets between CoAP and OSGP. This mapping would enable IoT systems applied to residential and industrial plants to obtain and provide information to SGs. Within this context, this paper presents the integration between the CoAP and OSGP communication protocols in a solution that we call CoAP and OSGP Integration for the Internet of Things (COIIoT). To the best of our knowledge, based on the literature systematic mapping executed, this is the first adaptation between CoAP and OSGP.  
The remainder of this article is organized as follows. Section 2 provides a brief background on communication protocols with an emphasis on CoAP and OSGP. Next, Section 3 discusses some related work. Section 4, in turn, presents the architecture of the proposed integration architecture. Following, Section 5 presents the materials and methods employed and discusses the results obtained in the experiments. Finally, in Section 6, we give the final remarks and discuss future work.