A Microservices-based IoT Monitoring System to improve the Safety in Public Buildings Marina Mongiello * , Luigi Patrono † , Francesco Nocera * , Angelo Parchitelli * , Luca Riccardi * , Ilaria Sergi † , Piercosimo Rametta † and Leonardo Avena * * Dipartimento di Ingegneria Elettrica e dell’Informazione Politecnico di Bari, Bari, Italy Email: {firstname.lastname}@poliba.it † Dipartimento di Ingegneria dell’Innovazione, Universita ` del Salento, Lecce, Italy Email: {firstname.lastname}@unisalento.it Abstract—Safety of public buildings’ users is an important issue, especially in buildings frequented by a great number of people. In such places, in case of an emergency, like a fire, rescue workers must intervene in a timely manner, directing their efforts towards places where there are people to be saved. This work presents an Internet of Things(IoT)-based framework, aiming at monitoring environmental parameters in order to support rescuers during emergencies. The microservices paradigm allows a pattern-based specification of system components that are refined and adapted on-the-fly depending on the specific execution context, based on the changing aspects such as, user’s need and requirements, context variables, user’s behavior, sensor data. First results related to the validation of the proposed system mainly concerning non-functional requirements of the implemented system through a proof-of-concept are reported and discussed. I. I NTRODUCTION The recent regulations on fire prevention adopted by many countries are aimed at safeguarding buildings and people with the goal of (i) reducing the causes of fire, (ii) guaranteeing the stability of the structure, favoring escape of all present, (iii) limiting the spread of fire, and (iv) guaranteeing the possibility of intervention of firefighters. These regulations focus on all the components that are concerned in the event of a fire: location and structure of the building, materials and their reaction to fire, measures for the exodus of people, fire-fighting systems, electrical systems, alarm, water systems and rescue. However, despite all these measures, fires occur and sometimes certain circumstances can nullify or prevent the application of some solutions foreseen at design phase. In such cases, for example, small explosions or collapses can block the escape routes of some locals and prevent the evacuation by people present at that time. In other cases, instead, smoke can disorient users, causing them to flee in the wrong direction, arriving in places difficult to reach by rescuers. For these reasons, having a snapshot of the building when the emergency occurs, with the level of some ambient parameters (temperature, humidity, smoke level, CO2, etc.) and the human presence in each local of the building, would be an important support for rescue workers, especially in case of large buildings, in order to optimize their work and save as many lives as possible. Internet of Things(IoT)-enabling technologies and devices like Bluetooth Low-Energy (BLE), Wi-Fi, smartphones, smart objects, etc. can help in reaching this goal [1], [2], [3], [4], [5], [6]. Low-cost fast-prototyping platforms, such as Arduino 1 or ST Nucleo 2 , equipped with a set of ambient sensors, allows the creation of wireless networks of smart devices able to periodically sense the surrounding environment and to send collected data to a Cloud server for further analysis. There, a microservice based software application is pro- posed for the monitoring system. Microservice based architec- tures have started to gain in popularity and are often adopted in the implementation of modern cloud, IoT, and large- scale distributed applications. Lewis and Fowler define [7] the microservice architectural style as an approach to developing a single application as a suite of small services, each run- ning in its own process and communicating with lightweight mechanisms, often an HTTP resource API. Therefore, the microservices should be independent components conceptually deployed in isolation and equipped with dedicated memory persistence tools (e.g., databases) [8]. Developers can focus almost exclusively on the few features of the microservice they are responsible for. However, the final application will consist of many microservices, so each one is able to coordinate with the others. The independence of a single microservice must not compromise the functioning of the other microservices and, in general, of the overall system. Hereby, [9], [10] we model and implement a microservices- based architecture for monitoring data detached from sensors in a IoT environment for a near real-time situation. The proposed framework is an innovative system to support rescue workers (firefighters, first aid workers, civil protection teams, etc.) in case of hazardous events. Particularly, the focus is on events in which they need to intervene in large environments with different access points and with a great number of users, like schools, hospitals, offices, senior citizens’ homes, cultural or entertainment places. In these situations, in fact, it is necessary to guide the rescuers in a timely manner at the points 1 Arduino, https://www.arduino.cc/ 2 ST Nucleo, http://www.st.com/en/evaluation-tools/stm32-mcu- nucleo.html?querycriteria=productId=LN1847