# Open-Source MQTT-Based End-to-End IoT System for Smart City Scenarios
## 1 Introduction  
Internet of Things (IoT) and related technologies have been undergoing exponential growth for a few years, rising from 15 billion connected devices in 2015 up to 30 billion in 2020, and their numbers are intended to grow over the next decade [1]. IoT defines a network of devices, such as sensors, actuators, gateways and cloud services, interconnected among them with the aim of offering a specific service. Among several verticals, urban mobility is receiving a lot of attention, driven by the introduction of different micro-mobility options as an alternative urban mobility solution in the COVID-19 era [2]. Such mobility options require careful attention towards parameter-tracking for safety reasons. The number of industrialized cities, which are more and more aware of eco-sustainability issues, has been constantly growing over the past few years [3]; this trend led government authorities to sponsor the adoption of eco-friendly means of transportation, such as e-bikes, electric scooters, Segways and so on. However, as the number of non-conventional meansof transportation has been rising exponentially, there has been a similar rise in the number of road accidents, involving so-called vulnerable road users (VRUs) [4]; therefore, the implementation of wearable technologies is remarkably beneficial in terms of user safety by helping people connect to a much broader intelligent ecosystem often referred to as a Smart City. The main issue in an ubiquitous computer environment, such as IoT, is how impractical it is to impose standards that everyone has to comply to [5]; hence, one of the biggest constraints is to deal with closed source systems, which act as black boxes where the underlying structure is unknown. This leads to IoT solutions that are very hard to interact with, especially due to the nature of IoT being a very complicated heterogeneous network platform. An outright example is highlighted in [6], a survey performed on 26 different IoT clouds that can be grouped into 10 different genres of applications, which showed, as expected, the lack of heterogeneity management. Moreover, deploying a large number of wearable devices all over the city would have a large impact on the costs of such a system; therefore, we deem that, cost-wise, a full-stack solution including all the elements for complete control of the system from the source to the customer premises would be highly beneficial as it allows cutting off all those costs linked to third-party software and hardware, which an IoT solution usually relies on. Another reason for cost reduction is the presence of an open-source approach where, once the community is fully engaged, the rate of progress can rapidly accelerate, and the project can potentially progress at a rate that can overcome closed-source development [1]. Applied to our scenario, the open-source approach allows developing a core system that can be further extended by developers and users also giving the specific requirements of any city. The proposed open-source approach could be the basis for further refinement as well as additional plug-in software and devices. An End-to-End (E2E) Open-Source Proof-of-Concept (PoC) IoT architecture is proposed here, aiming to properly address the previously introduced issues. It is based on the integration of different open-source technologies, whose main purpose is to monitor, through the use of sensors connected to a micro-controller, the information related to the road users. The system has been implemented by integrating an ESP32, i.e., a System on Chip (SoC), equipped with sensors used to acquire environmental information that are able to interact through a Bluetooth Low Energy (BLE) connection with an Android device, which acts as an intermediate point that gathers the information produced by the sensors in a real-time asynchronous way.