You are currently viewing IoT-empowered road anomalies detection in real-time

IoT-empowered road anomalies detection in real-time

IoT-empowered road anomalies detection in real-time

Automating road surface monitoring procedures using IoT sensor data, machine learning, and edge computing

Table of Contents


Statistics show that many road accidents are caused directly by poor road conditions and by the drivers’ reaction to incidents and hazards resulted by improper road design or construction. In addition, road network infrastructure, from local roads to larger arterials and interstates, require significant financial investment for maintenance. Typically, this incurs costs of several thousands of euros per km, depending on the road type. Today, monitoring and repairing the road infrastructure involves a lot of manual operations. Thus, the inspection of the quality of the infrastructure should be gradually improved and be more automated to enhance driver and passenger safety while keeping costs low. RAZOR (“Road hAZard detector”) is a scalable IoT solution, built on top of the hardware and software technology stack, that detects road surface anomalies in real time. It may provide road surface monitoring information to various stakeholders such as road operators and maintainers, authorities for infrastructure and transport, municipalities, insurance companies. RAZOR has been developed in the context of ASSIST-IoT EU Project.


RAZOR solution includes three core components:

  1. An IoT device, mounted on the car, that embeds vibration sensors and generates the raw sensor data (z-axis acceleration values), which will be processed for identifying a potential road hazard indication.

  2. An edge device software (currently running on a Raspberry Pi) that collects the raw sensor data measurements from the IoT device, runs the road surface anomaly detection algorithm and reports the results to the IoT Cloud platform.

  3. A Cloud platform that collects, stores, and visualizes the prediction results using custom dashboards.

RAZOR IoT Device

The RAZOR IoT device is a battery-powered device that is built upon IoT board family and hosting open-source Micropython firmware. The specific board embeds acceleration, CO2, temperature, and humidity sensors. When powered on, it loads its configuration and connects to a predefined Wi-Fi network (provided by the co-located Raspberry Pi). The device has a led indicator that shows the running status:

led color



Device Setup


Network Connection Error


Network Connected + No GPS Fix

White Blinking (every second)

Network Connected + GPS Fix

When connected to the network, the device starts its measurements loop on a 10 Hz frequency, which is a commonly used frequency in relevant research. The following table lists the measurement information captured by the device:




Timestamp of the measurement


Device’s serial number






Horizontal dilution of precision


Number of satellites that the device is connected to


X-axis acceleration


Y-axis acceleration


Z-axis acceleration


Relative Humidity


CO2 concentration



The measurements are sent in a SenML format, which is commonly used in IoT applications


RAZOR Edge Software

The RAZOR edge software processes the incoming measurements and uses statistical and machine learning techniques to perform road surface anomaly detection. The software runs on the edge device, which is also mounted on the vehicle. It is implemented in Python, which provides well-established data processing libraries like Pandas, scikit-learn and NumPy. The software comprises of two containerized services, which are decoupled and can be executed independently:

  • The training service, which trains the models using collected measurements for this purpose,

  • The prediction service, which uses the trained models and performs the actual road surface anomaly detection in real-time.

The identification of road surface anomalies is a classification problem. The training service is executed on demand, once a new training dataset has been obtained. The aim is to update the trained models that are used by the prediction service. In the current implementation, the models classify whether there is a road bump or not, using accelerometer data on the Z-axis. Two models have been implemented:

  • A threshold-based model that compares the Z-axis standard deviation with a predefined threshold (calculated during the training phase)

  • A Support-Vector-Machine (SVM) model using a linear Kernel. The model is provided by the scikit-learn package.

The high-level view of the prediction service is shown below.

The prediction service hosts two threads:

  • The MQTT consumer thread that runs in the background and receives incoming raw measurements in a predefined topic

  • The prediction thread that runs a scheduled job to perform the actual prediction

The two threads exchange information via a thread-safe queue; the MQTT consumer thread enqueues the raw measurements and the prediction thread retrieves them every n seconds (n = 4 by default). The prediction service evolves in 4 sequential steps:

  1. The data ingestion phase, where the raw measurements are received from the MQTT topic and enqueued

  2. The preprocessing phase, where:

    1. A time-series data frame is generated using the timestamps included in the raw measurements

    2. Time alignment and late data filtering is performed

    3. The standard deviation of the Z-axis accelerometer data is calculated on the current time interval

  3. The prediction phase, where each model performs the classification

  4. The persistence phase, where the results are reported to the cloud platform

Cloud Platform

Road anomalies are finally reported to IoT platform. This platform provides a variety of visualization options in the form of fully customizable dashboards. Secure device-to-Cloud communication is based on unique authentication and identification keys. The keys are known to the Edge software. A dashboard is used to visualize the incoming results. An example snapshot is shown below, reporting the results of a test route.

A customizable dashboard at the IoT platform, created for the RAZOR application

Current Status and Improvements

  • The solution has been currently verified for road bumps detection. Additional road surface anomaly classes will be introduced, like road cracks, potholes, etc.

  • The current data analysis relies on the experienced Z-axis acceleration standard deviation over a time window. Additional features for the prediction models will also be defined, like the vehicle speed for improving prediction accuracy.


Part of the development has been performed in the context of and supported by ASSIST-IoT EU-funded Project.