In order to achieve the objectives of Smart Cities, public administrations need to take measures to regulate mobility, which undoubtedly requires a high level of information and sensorization. Until the implementation of the connected vehicle takes place, it is still necessary to install sensors to obtain information about mobility. Bluetooth sensors are becoming a useful tool due to the low cost of equipment and installation. The use of Bluetooth sensors in cities, with short distances between sensors, makes it necessary to propose new classification algorithms that allow the trips of pedestrians and vehicles to be differentiated. This article presents the study carried out in the city of Valencia to determine the use of motor vehicles in the historic center and propose a new classification algorithm to distinguish between an onboard Bluetooth device and the same device carried by a pedestrian when it is not possible to use the travel time for the classification due to the short distance between sensors. This causes very similar or even indistinguishable travel times for vehicles and for pedestrians. We also propose an algorithm that allows vehicles to be classified according to what type of trip is made always through the historical center of Valencia, whether it is to make a shorter itinerary through the city or to access the center for any type of business. This algorithm would enable the Origin-Destination matrix of an urban network with short distances between sensors if they are available in all entries and exits. Likewise, the results obtained have allowed to positively evaluate the algorithm defined to distinguish between trips made by a pedestrian or a vehicle in a city, using the MAC address of their mobile devices with very short distances among sensors. The results of this study show that it is possible to use Bluetooth technology, with low cost installations, to evaluate the use of the city by motor vehicles.
Urban air pollution poses complex challenges due to its multivariate, non-linear dynamics and significant implications for public health and environmental sustainability. This study presents a comprehensive, explainable, and unsupervised anomaly detection framework for identifying atypical pollution events in multivariate time series from urban monitoring networks. We analyse long-term records of five key atmospheric pollutants (PM₂.₅, PM₁₀, NO, NO₂, NOₓ) from six air quality stations across Valencia, Spain, using an ensemble of twelve state-of-the-art unsupervised algorithms. The ensemble anomaly scores are interpreted through dimensionality reduction (UMAP), clustering, and SHAP-based feature attribution using a surrogate XGBoost model. Our results reveal distinct classes of pollution anomalies driven by traffic, meteorological conditions, biomass burning, and extreme weather events. The model successfully captures both abrupt pollution episodes and more subtle multivariate deviations, demonstrating high internal coherence and robustness across algorithmic families. By integrating explainable machine learning with ensemble detection strategies, this framework enhances the reliability of air quality data, supports environmental diagnostics, and enables context-aware responses to pollution episodes. The approach is scalable, transferable, and well-suited for improving anomaly detection and interpretation in environmental monitoring systems.