## Appendix A The LoRaWAN Communication Solutions
### Experimental Validation of LoRaWAN solution  
The experimental validation of the choice of LoRaWAN for implementing the proposed IoT architecture has been done in a real smart campus environment. It was carried out by measuring the coverage and latency of dispersed devices in the main campus of the Federal University of Rio Grande do Norte, Brazil ([[https://ufrm.br/institucional/localizacao](https://ufrm.br/institucional/localizacao)]([https://ufrm.br/institucional/localizacao](https://ufrm.br/institucional/localizacao))). It is worth noting that the adoption of a home automation into a Smart Campus infrastructure architecture is not only limited to the adoption of LoRaWAN. The management functionalities to support location, authentication and authorization have been also implemented before the experimental characterization took place, but they are not presented here because do not have impact on the presented results. The experiment scenario consists of a LoRaWAN gateway, installed indoor at the Industrial Informatics Laboratory, acting as a packet forwarder and redirecting the received packets to a LoRaWAN backend, installed in a computer in the lab. A LoRaWAN mote, acting as a sensor, was connected to a supervision laptop and configured as a Class A device. Currently, no other LoRaWAN networks have been deployed in the campus. Figure 14 shows the experimental setup. The LoRaWAN gateway is a Sentrius RG1 XX device with the following characteristics: two antennas dual band Wi-Fi (2.4 GHz and 5 GHz), one LoRa antenna, and one Ethernet input (RJ45). The LoRa Gateway software is executed by a Atmel a5 core at 536 MHz with Linux kernel v4.x. It can interface itself with many LoRaWAN backend implementations: Semtech, LoRaIO, The Things Network (TTN), Stream, etc. The LoRaWAN mote is realized using a Microchip RN2903 module which has the following characteristics: Class A LoRaWAN implementation, support to the 915 Mhz ISM band, ASCII command interface and firmware update via UART, 14 GPIO pins (for general purpose input/output signals). The laptop and the LoRaWAN device were placed in a car which visited 20 points inside the campus to realize the following test procedure: a LoRaWAN message from the more is sent by means of external commands issued by the supervision computer via USB interface; the gateway receives and forwards the packet to the registered LoRa server, which, in turn, propagates it through the LoRa stack as showed in Figure 4. As a consequence, no message overlapping can occur. Each sent packet contains a payload of 50 bytes, a message size that it is compatible with the use case described in the previous section. The worst case condition from the sensitivity point of view was chosen: messages are sent using SF7 @ C/R = 4/5. The transmission power was set to +14 dBm. The timestamps of each sent package were recorded both on the supervision PC and on the LoRa Server for the analysis of message latency. The supervision PC and the LoRa Server have been synchronized by using NTP (Network Time Protocol). To register the timestamps, the WhiteShark software was installed on the supervison computer connected to the LoRaWAN mote and in the computer where the open LoRa Server stack was installed. Thus, the whole exchange of messages could be monitored. This procedure, used to measure the packages latency in a LoRaWAN infrastructure, was proposed in [64]. The experiment was started by choosing some geographical locations around the LoRaWAN gateway. The locations were chosen by increasing the distance between the gateway and the LoRaWAN mote. Figure 15 show the sending locations, identified by red balloons (i.e., transmission was successful) or black circles with a \"x\" inside (i.e., transmission was not successful), such as well as the gateway position, identified by a blue balloon. Figure A2: Schematic representation of the experimental setup used for the LoRaWAN IoT architecture characterization. Figure A4: The Microchip LoRaWAN mote based on RN2903.