## 1 Introduction
Fog computing supports physically distributed, low-latency (e.g., real-time or quasi real-time responses) and location-aware applications that decrease the network traffic and the computational load of traditional cloud computing systems by processing in the IoT nodes most of the data generated by their sensors and actuators and unburdening the higher layers from data processing [24]. Furthermore, when designing a smart campus, it is necessary to plan how LoRaWAN gateways and nodes are deployed to guarantee good IoT node coverage while minimizing the number of gateways (i.e., minimizing the smart campus communications infrastructure cost). The problem is that there are only a few examples of academic and commercial tools that create such a planning [25; 26], so developers have to adapt tools previously optimized for other technologies (e.g., Wi-Fi [27]) or have to carry out tedious empirical measurements throughout the campus [28; 29]. This article confronts the mentioned challenges by designing and implementing a cost-efficient, scalable, and low-power consumption LoRaWAN fog computing-based architecture for wide areas. Specifically, the system was designed with the aim of developing novel latency-sensitive IoT outdoor applications that create more sustainable and intelligent campuses. The following are the main contributions of the article, which as of writing, have not been found together in the literature:  
* To establish the basics, it presents the main characteristics of the so-called smart campuses together with a detailed review of the state of the art of the main and the latest communications architectures and technologies, previous academic deployments, novel potential LPWAN applications and relevant tools for radio propagation modeling and planning. * It thoroughly details the design, implementation, and practical evaluation of a scalable LPWAN-based communications architecture for supporting the smart campus IoT applications. * The article presents the 3D modeling of a real 26,000 m\({}^{2}\) campus whose LoRaWAN wireless propagation characteristics are evaluated with an in-house developed 3D Ray-launching radio-planning simulator. The results obtained by such a simulator are validated by comparing them with empirical LoRaWAN measurements obtained throughout the campus. * It details how the radio-planning tool can be used to design the deployment of LoRaWAN infrastructure for three smart campus applications: a mobility pattern detection system, a smart irrigation solution, and a smart traffic-monitoring deployment. Thus, it demonstrates the usefulness of the proposed tools and methodology, which are able to provide fast guidelines to smart campus designers and developers, and that can also be used for easing LoRaWAN network deployment and research in other large environments such as smart cities. The rest of this article is structured as follows. Section 2 reviews the state of the art on smart campuses: their characteristics, technologies, architectures, previous relevant deployments, potential applications, and the previous work on modeling and planning a smart campus. Section 3 details the architecture of the proposed system and the characteristics of the LoRaWAN testbed implementation. Section 4 describes the proposed planning simulator and the analyzed scenario. Section 5 is dedicated to the experiments. Finally, Section 6 presents the main discussion on the lessons learned from these experiences, while Section 7 is devoted to the conclusions.