## 4 Our Prototype
### System Architecture  
The improved system architecture for emergency management is reported in Figure 1. It is always based on a fat client-thin server architecture where the computation load weighs on clients. Each client is equipped with an additional battery to ensure the client's work even in case of emergency. The system differs from the previous one just due to some adjustments. There are some clients (in the Figure, the ones in classrooms #5 and #6) that have a further layer, the Redundancy one. Such clients were strategically chosen since they are at the opposite end of the campus. The Emergency Data Transfer feature was implemented, which leverages LoRa (Long Range) technology to ensure critical data are preserved and transferred during network failures or other emergency scenarios. LoRa is a low-power, long-range wireless communication technology that provides robust and reliable data transmission over distances significantly greater than are possible with traditional Wi-Fi or Bluetooth solutions. This makes it an ideal choice for ensuring data continuity in a smart campus environment. Each of these two clients is equipped with a LoRa module. This module enables the Raspberry Pi to communicate with external servers over long distances without relying on the campus's primary network infrastructure. If a disruption, a failure, or an emergency is detected, the module activates and the Raspberry Pi begins transmitting essential data packets to predefined external servers using the LoRa network. Such clients, during emergencies, collect data from the other clients of the LAN. Then, such data are transferred via LoRa to maintain the integrity of the people-counting system. The data fit within the limited bandwidth of LoRa communications since they consist of  
Figure 1: Improved system architecture for emergency management. just a list of integers, ensuring efficient and timely delivery. The LoRa network operates on a duty cycle, meaning that data are sent at regular intervals or triggered by specific events, such as a network failure. This ensures that even during extended outages, the most recent and relevant data are transmitted. The integration of LoRa for the transfer of emergency data offers several advantages. Firstly, it provides a fail-safe mechanism that enhances the reliability and resilience of the people-counting system. In the event of a network failure, critical data are not lost but rather securely transmitted to external servers, where they can be retrieved and analyzed later. This is particularly important for maintaining continuous monitoring and ensuring data-driven decision-making, even in adverse conditions. Moreover, LoRa's low power consumption is ideal for emergency scenarios where power resources may be limited. The technology's ability to operate over long distances also ensures that data can be transmitted even if the primary network is compromised. This extended range is particularly useful in large campus environments where network issues might be localized but still affect critical system operations. The server responsible for receiving data via LoRa plays a crucial role in ensuring the integrity and availability of critical information during network failures or emergencies. This server is specifically designed to handle the unique requirements of LoRa communication, including the low bandwidth and sporadic nature of data transmission.The LoRa data reception server is located in another facility also belonging to the University of Bologna, located two kilometers from the campus, with reliable power and network infrastructure to ensure its continuous operation even when the primary campus network is compromised. To manage the incoming data, the server runs specialized software capable of handling the intermittent and low-bandwidth nature of LoRa communications. This software is designed to parse and store the data efficiently, ensuring that each data packet is correctly timestamped and associated with the originating client.