1. Introduction
The growing population has led to a significant increase in vehicle demand, resulting in increased traffic congestion. This heavy traffic exerts additional pressure on the road infrastructure, which deteriorates over time [
1]. Potholes, depressions, and uneven surfaces have become commonplace, making vehicular movement increasingly challenging and prone to accidents [
2]. Even advanced vehicles, such as solar cars, can be rendered immobile due to the presence of potholes [
3]. Daily accidents caused by jolting and instability of vehicles on uneven roads lead to serious injuries and loss of life, highlighting the urgent need to address these issues [
4]. Poorly maintained roads exacerbate vehicle instability, causing drivers to lose control and significantly increasing the risk of accidents [
5].
Countries with extreme weather and challenging terrain face significant challenges in road safety. Mountainous regions, such as Bhutan, Pakistan, and Switzerland, experience traffic jams and high accident rates due to rough terrain, sharp bends, and adverse weather conditions. Heavy snow in Canada and Switzerland exacerbates these risks, leading to slippery, icy roads and increased vehicle malfunctions [
6,
7]. In regions with extreme terrain, routine travel becomes dangerous, requiring robust solutions to mitigate risk. The Himalayan regions of Nepal and India face poorly maintained roads that damage structural vehicles and disrupt traffic. Developing countries like Bangladesh face similar problems, with inadequate infrastructure leading to accidents, compromised safety, and high vehicle maintenance costs [
8,
9]. These challenges affect low-income areas with limited resources for road repair and technological advancement [
10].
On a global scale, the statistics paint a dire picture. According to the World Health Organization, approximately 1.3 million lives are lost yearly to road accidents [
11]. This alarming figure underscores the urgent need for improvements in road conditions and vehicle safety mechanisms. Developing nations like Bangladesh report staggering numbers, with 24,954 fatalities attributed to road accidents annually [
12]. Additionally, over 50 million people suffer injuries or disabilities caused by road accidents each year, highlighting the far-reaching consequences of this issue [
13]. Road accidents have significant economic and social impacts, including medical costs, loss of productivity, trauma, and stress on healthcare systems. An important reason is that drivers are unable to understand real-time road conditions. Hidden irregularities, such as potholes or bumps, often go unnoticed until the vehicle is impacted, leading to accidents or damage, especially in rough or hilly areas [
14,
15]. Areas with dense fog, snow, or poor lighting increase the risk of rapidly changing road conditions. Advances in technology, such as the Internet of Things (IoT) and machine learning, offer solutions for real-time road anomaly detection and stabilization. Sensors like the GY-521 can detect vibration and tilt from potholes, while machine learning models like the YOLOv8 visually detect road irregularities. These technologies enable vehicles to adapt to different conditions, ensuring a smoother ride and improved safety [
16].
These systems offer advantages beyond passenger comfort by safeguarding the goods being transported, minimizing vehicle wear and tear, and reducing maintenance costs. This results in cost savings and enhanced efficiency for public transport and logistics. However, implementation is constrained by high costs and limited awareness. Developing countries encounter additional challenges that necessitate affordable, customized solutions. As IoT and machine learning advance, more innovative, safer, and more adaptive transportation systems are becoming increasingly feasible. Uneven roads and inadequate maintenance demand technological innovation and strategic infrastructure investment. IoT and machine learning empower vehicles to react to real-time road conditions, improving safety, comfort, and efficiency. This transition has the potential to save lives, reduce economic losses, and promote sustainable, inclusive transportation. While numerous studies examine road conditions, there is less focus on vehicle stabilization mechanisms [
17,
18]. We have created a system that integrates IoT and machine learning to detect and respond to road conditions. Advanced sensors assess road conditions, identify features such as hill height or pothole depth, and determine which wheels are affected. The servo motor regulates the vehicle’s top, ensuring stability on uneven roads. This guarantees a smooth ride, decreases passenger discomfort, and lowers the risk of vehicle instability.
In contrast to conventional standalone vehicle stabilization systems, our architecture integrates real-time edge processing with cloud-based feedback mechanisms. This combination facilitates continuous learning and over-the-air (OTA) adaptation driven by telemetry data collected during operation, creating a closed-loop IoT system. Consequently, this framework goes beyond localized detection to enhance scalable, cross-vehicle generalization—an essential capability for smart mobility and autonomous maintenance systems.
Research Questions and Overview:
RQ1: How can IoT-based technologies improve vehicle safety and enable real-time road maintenance in areas with varied topographies, especially in Asia?
RQ2: How can low-cost sensors like the GY-521 sensor and machine learning algorithms like YOLOv8 be used optimally to identify and respond to road surface anomalies?
RQ3: How can real-time pothole detection and vehicle stabilization systems enhance road safety and passenger comfort in low- and middle-income countries?
RQ4: How can a dual-part vehicle design with real-time stabilization capabilities reduce accidents and safeguard vehicle components in areas with poor road conditions?
RQ5: What are the main obstacles to implementing IoT-based vehicle safety systems in Bangladesh, and how can they be addressed to enhance data processing, communication protocols, and network effectiveness reliability?
Contributions: This study introduces an innovative solution to address the critical challenges of vehicle maintenance, passenger comfort, and road safety, particularly in challenging driving conditions like those in Bangladesh and other Asian nations.
I. Enhanced Passenger Comfort and Safety: The system enhances passenger comfort and safety by utilizing real-time stabilization mechanisms that adjust the vehicle’s balance in response to uneven road surfaces.
II. Cost-effective and Easy Installation: One of the most notable features of this solution is its affordability, making advanced road safety and stabilization technology available to a wider audience.
III. Real-Time Road Monitoring: The system’s integration of YOLOv8, a state-of-the-art machine learning model, facilitates accurate and efficient real-time detection of road hazards, including potholes, cracks, and bumps. By continuously monitoring the road surface, the system anticipates and addresses anomalies before they threaten vehicle stability.
IV. Environmental and Economic Sustainability: By tackling the challenges caused by uneven road surfaces, the system lessens the wear and tear on essential vehicle components like suspension systems, tires, and chassis.
V. Supports Public Health and Safety: Road safety is crucial for public health, and this system significantly contributes by lowering the risk of accidents caused by uneven road surfaces.
This paper is organized into several key sections to comprehensively understand the proposed IoT-based solution for uneven roads and vehicle stabilization. The abstract offers a concise summary of the problem, methodology, and key outcomes. The introduction establishes the context by discussing the challenges of road anomalies, vehicle stability issues, and the motivation for this research while highlighting the gaps in existing technologies. The Related Study section follows, reviewing prior works on vehicle stabilization and road anomaly detection, comparing their limitations, and positioning the proposed system as an innovative solution that integrates advanced technologies, such as YOLOv8 and GY-521 sensors. The proposed methodology details a dual-method approach, integrating YOLOv8 for anomaly detection, GY-521 sensors for real-time motion tracking, servo motors for dynamic stabilization, and hardware implementation, along with the data processing flow. In the Experimental Results and Analysis, the system’s performance is evaluated through various tests on different road conditions, with metrics such as detection accuracy, stability, and cost-effectiveness supported by visualizations like precision-confidence curves and comparative tables. Finally, the conclusions summarize the study’s contributions, emphasizing its impact on road safety, cost-effectiveness, and sustainability while noting its potential scalability and broader applications.
Table 1 provides a comprehensive list of all the abbreviations utilized throughout this paper.
2. Related Works
Integrating advanced technologies in vehicle stabilization on uneven terrains is crucial for enhancing safety and comfort. However, despite numerous innovations, significant scientific obstacles remain in this area. These challenges are rooted in the need for real-time and adaptive stability systems to continuously monitor the road for minor imperfections while minimizing excessive maintenance costs and performance issues across different weather conditions.
The implementation of IoT for anomaly detection is widely observed across various fields, including image segmentation, pattern recognition, and network intrusion detection [
19,
20]. In a broader context, traditional tasks in image processing, computer vision, and character recognition [
21,
22] often leverage deep neural networks. However, the integration of IoT with real-time processing for advanced technologies demands a more robust and customized framework, such as
YOLO (You Only Look Once) [
23]. The stability and usability of our approach to adapting YOLO are enhanced by incorporating our framework and hardware modifications.
Table 2 compares our proposed system with existing works based on various implemented features. The capability for real-time vehicle balance adjustment has not been previously available; adding GY-521 sensors enhances this feature, which many prior systems have not incorporated [
24,
25,
26,
27,
28,
29,
30,
31,
32,
33]. By integrating YOLOv8, we design an intelligent safety system that uses predictive road hazard detection to warn the driver of approaching obstacles proactively. Furthermore, with these features, a servo motor system can automatically adjust the position of specific vehicle components in real time, a significant advancement over traditional stability systems.
For instance, YOLOv8 can identify pavement deterioration, provide better road maintenance, and offer enhanced road maintenance. Yet, it does not address the need for a holistic approach that would permit real-time adjustments for the vehicle’s stability depending on the terrain it is driving on. Our system uses a combination of GY-521 sensors, servo motors, and YOLOv8 in contrast to the traditional static response found in the literature, thus ensuring a dynamic and immediate correction for road defects.
For instance, YOLOv8 can identify pavement deterioration, provide better road maintenance, and offer enhanced road maintenance. Yet, it does not address the need for a holistic approach that would permit real-time adjustments for the vehicle’s stability depending on the terrain it is driving on [
34]. Our system uses a combination of GY-521 sensors, servo motors, and YOLOv8 in contrast to the traditional static response found in the literature, thus ensuring a dynamic and immediate correction for road defects. Moreover, unlike previous approaches, our system consists of Uneven Roads Detection (URD) and Stabilize Car (SC), so its application goes through a comprehensive and scalable implementation.
Most existing solutions struggle to adapt to dynamic terrain conditions, such as wet or icy roads, mountainous areas, and frequent road irregularities [
35,
36]. Static approaches that rely on variable suspension systems and road profile sensors (RPS) cannot achieve rapid control processes or respond quickly to sudden changes in road conditions [
37,
38]. Moreover, implementing real-time stability adjustments by integrating various systems, like machine learning-based predictions and sensor fusion, presents significant challenges [
39,
40]. Another critical aspect that can be improved is responsiveness, which involves accurately detecting and adapting to terrain irregularities without relying on prior modeling data. Our system uses the GY-521 sensor, which is effective in low-traction environments such as icy or mountainous roads, to provide real-time stability. At the same time, the YOLOv8 model predicts surface conditions, which enhances control and reduces risks.
Our proposed approach outperforms existing solutions by integrating a robust hardware-software framework that guarantees real-time anomaly detection and vehicle stability. In contrast to previous works, which typically concentrate on either software-driven methods or hardware-based implementations, our system seamlessly merges both for enhanced performance. Many current solutions neglect to incorporate real-time sensor data processing or take advantage of advanced deep learning models like YOLOv8, which restricts their adaptability to changing road conditions. Furthermore, implementing GY-521 acceleration sensing and intelligent anomaly detection ensures superior road assessment and stabilization. By addressing the shortcomings of previous approaches, our method offers a more reliable, efficient, and flexible solution for real-world applications. While previous studies have focused on specific elements like sensor-based systems or posture manipulation to prevent damage, our solution offers a more comprehensive approach by accommodating lateral balance and ensuring overall stability across various surfaces, including slippery and irregular terrains. These features deliver comfort and safety that rival current vehicle technologies, addressing immediate and long-standing vehicle stabilization challenges. In summary, our real-time stabilization system presents an innovative and scalable solution to the problem of uneven roads, enhancing safety, comfort, and efficiency in intelligent transportation technology.
3. Methodology
3.1. System Architecture Overview
One of the most pressing global issues is road accidents, primarily attributed to inconsistent road surface detection, which affects vehicle stability. Our proposed system employs a dual approach to improve vehicle stability and safety. This section delves into road surface detection, safety, and vehicle stability maintenance. The overall functioning of our proposed system is depicted in
Figure 1. The design follows an IoT-based architecture where edge devices (e.g., ESP32 with GY-521 and camera modules) process data locally for real-time stabilization. These devices connect to a cloud server for non-real-time tasks such as telemetry collection, remote diagnostics, and over-the-air (OTA) model or policy updates. This structure ensures low-latency stabilization while retaining IoT deployments’ scalability, visibility, and remote control benefits.
From
Figure 1, the proposed system demonstrates a comprehensive data collection, processing, and implementation process to address the challenges of uneven road surfaces. Data is collected using a combination of vehicle-mounted sensors and cameras, capturing real-time information about road conditions. Initially, we used real-time data to test and measure the accuracy of the proposed system. This collected data undergoes processing to detect irregularities such as potholes, bumps, or inclines, ensuring a detailed analysis. There are two different methods for detecting uneven road surfaces: sensors and YOLOv8. We achieve better accuracy with YOLOv8, the successor of the popular computer vision framework YOLO [
41]. The detection process is used to stabilize vehicles afterward.
ESP32: The ESP32 microcontroller acts as the central processing unit, facilitating seamless communication between sensors, actuators, and machine learning algorithms. The GY-521 sensor, which features an accelerometer and gyroscope, continuously monitors changes in the vehicle’s motion and orientation, providing critical data about road irregularities, such as potholes and bumps. This information is processed by the ESP32, which calculates the necessary adjustments to stabilize the vehicle. There are two distinct detection methods for stabilizing vehicles.
3.2. Dual Detection Methods
3.2.1. GY-521 Sensor-Based Detection
The GY-521 sensor is a high-precision device that detects acceleration and angular velocity variations. It plays a vital role in assessing changes in road height and ensuring vehicle stability. Proper calibration of the sensor is essential. Factors such as the type of road surface—whether it is paved, gravel, or uneven—the sensor’s precise location on the vehicle, and the vehicle’s speed must also be considered. These elements significantly influence sensor readings and, in turn, affect the overall system’s accuracy. Effective calibration allows the sensor to adjust to diverse road conditions, providing consistent and reliable data for analysis. The sequential dependence of sensor values is checked to remove bias [
42].
Beyond detecting fluctuations, the GY-521 sensor measures tilt angles, vibrations, and other subtle interactions between the vehicle and the road. It captures multidimensional data across the x, y, and z axes, which is processed using an advanced algorithm. This algorithm analyzes the sensor readings and identifies patterns to detect surface abnormalities such as potholes, bumps, and uneven turns. The capability to extract meaningful insights from these measurements enhances the system’s ability to accurately identify road irregularities, improving the overall effectiveness of the detection system.
3.2.2. YOLOv8-Based Road Anomaly Detection
The latest version of the “You Only Look Once” (YOLO) object detection framework, YOLOv8 [
43], represents a significant advancement in real-time object detection by offering exceptional accuracy and speed through a sophisticated deep learning architecture. This model is designed to efficiently identify and localize objects in images and videos, making it ideal for applications across various sectors, including industrial automation, autonomous vehicles, and surveillance. Its ability to operate in real-time makes YOLOv8 particularly valuable for safety-critical tasks, such as detecting road anomalies like potholes and cracks. To ensure adaptability across different environments, the model is trained on a comprehensive dataset encompassing various terrains, including urban streets, rural paths, and mountainous areas, enhancing its effectiveness and reliability for practical deployment in real-world scenarios.
Bounding Box Prediction Refinement: The standard formula for bounding box prediction in YOLOv8 is:
Custom Bounding Box Loss Function: To address the challenge of detecting small anomalies, a weighted Intersection over Union (IoU) loss function is employed:
Class Prediction Optimization: YOLOv8 uses a refined softmax function for class prediction:
Imbalance Handling With Focal Loss: To handle class imbalance, YOLOv8 adopts focal loss:
Table 3 summarizes key architectural and performance advancements across YOLO versions, highlighting the superior detection accuracy and deployment flexibility of YOLOv8. Our implementation leverages YOLOv8 for real-time anomaly detection on roads, providing the predictive input required for vehicle stabilization control.
3.3. Stabilization Method
When one wheel encounters a pothole, the servos responsible for controlling the other wheels react intelligently by lowering their position and adjusting their angles closer to the ground, usually to less than 90 degrees. This adjustment compensates for surface irregularities, redistributes the vehicle’s weight, and helps stabilize the vehicle to maintain balance. Dynamically responding to obstacles, the system allows the car to navigate challenging obstacles smoothly while keeping all wheels in optimal contact with the road surface, ensuring stability and passenger comfort.
Similarly, if the car encounters two potholes simultaneously, the remaining two wheels adjust their angles downward to counterbalance the disturbance. If three wheels are impacted, the last wheel alters its angle to provide maximum stability. This dynamic adjustment mechanism ensures the vehicle maintains a steady and balanced ride, regardless of uneven surface roughness. Order of sequential dependency also check to remove any dependency based on sequential patterns of input that cater for GY-521 sensor.
The system’s innovative dual-part design enhances stability by connecting the vehicle’s lower engine and wheel section to the upper passenger compartment with four servo motors. The control system monitors and adjusts motor movement in real-time based on input from the GY-521 sensor and YOLOv8. This lets the vehicle respond immediately to changing road conditions and maintain stability without manual intervention.
To ensure precise and reliable adjustments, the system uses a proportional-integral-derivative (PID) control system, which continuously calculates the optimal position for each servo motor based on real-time sensor feedback. The PID controller minimizes oscillations and overshooting by controlling motor movement precisely, ensuring a smooth and controlled ride. The system dynamically stabilizes the upper passenger compartment to decrease the impact of road irregularities detected by the YOLOv8 and GY-521 sensors. This intelligent integration of detection and stabilization technologies enhances safety, reduces wear and tear on vehicle components, and significantly improves the overall driving experience.
3.3.1. Stabilization Strategies for Vehicle Body
(1) Hill Method: When a car’s wheel falls off a hill, only that wheel becomes unbalanced. To restore balance, the servo motor at the top of the wheel must be adjusted to stabilize the car’s upper portion. When two wheels fall off the hill, both must be balanced. Similarly, when three wheels fall off the mountain, all three must be balanced.
Balancing a car’s body with a rotated servo motor and hole depth. Our demo project operates effectively up to a maximum hole depth of 2 cm.
The GY-521 sensor provides x-axis values: 135 for a 2.0 cm hill and 120 for a 0 cm hill. Our model stabilizes when the hill height is 0 cm, with the servo motor standing at a 90-degree angle relative to the surface. When the hill height is 2.0 cm, the servo motor stands at a 10-degree angle in
Table 4.
We also observe that if the hill height is
, it follows a linear equation to stabilize the car body:
where:H is the height of the hill;
X is the GY-521 x-axis value;
C is the y-intercept;
A is the angle of the servo motor.
We solve for
m and
n using the following equations:
Since the servo angle follows a linear pattern mainly influenced by
X, we simplify the relationship to:
Using the data points
and
:
Solving for
p and
q:
Thus, the final equation becomes:
For an integer angle value rounded down to the nearest multiple of 10:
Figure 2 represents the bump-angle ratio for heterogeneous scenarios.
(2) Hole Method: The same equation determines how much to rotate the servo motor to stabilize the car when a wheel hits a pothole. If a car wheel strikes a pothole, all the servo motors connected to the car’s wheels must rotate accordingly. To assess the effectiveness of the detection and stabilization system, it will be tested on various types of roads, including urban roads, rural dirt tracks, mountainous areas, and coastal regions.
We undertook a real-life simulation utilizing a prototype vehicle to illustrate the practical viability of our proposed servo-based stabilization approach. The system was implemented on a sloped surface, wherein elevation changes necessitated real-time angle adjustments facilitated by the GY-521 sensor and servo motors, as presented in
Table 5. This scenario validates the control logic’s accuracy under physical conditions. The hardware supporting our proposed approach has been physically constructed, as depicted in
Figure 3, alongside examples of real-life vehicles navigating diverse terrains shown in
Figure 4. This implementation establishes a fundamental basis for subsequent experiments and evaluations, which will be elaborated in the following sections. It underscores the feasibility and practicality of our approach in real-world contexts, paving the way for further analysis and optimization of the system.
Table 6 illustrates how the GY-521 sensor’s axis readings (X, Y, Z) vary with increasing hole depth, while
Table 7 presents the corresponding servo motor positions triggered by these sensor detections, indicating a direct mapping from obstacle height to mechanical actuation.
As shown in
Figure 5, the angle of the servo motor decreases linearly as the depth of the pothole increases, indicating an inverse relationship. This correlation illustrates how the depth detection capability of the GY-521 sensor dynamically adjusts the actuation angles to help maintain vehicle balance on uneven terrain.
3.3.2. Control Algorithms
Two control routines are executed in real time to dynamically adjust servo motor positions in response to road surface anomalies: one triggered by GY-521 sensor data and the other by object detection from YOLOv8. Each routine adjusts servo angles to ensure vehicle balance based on different input modalities.
Algorithm 1 represents the sensor-based control strategy, where the GY-521 accelerometer detects surface depressions and inclines in real-time. Based on the sensed depth or tilt, a linear function maps these values to appropriate servo motor angles, ensuring quick mechanical compensation to maintain balance. On the other hand, Algorithm 2 utilizes YOLOv8’s real-time vision-based detection to recognize visual anomalies such as potholes or bumps ahead of the vehicle. It adjusts servo motor angles to avoid instability or collision based on obstacle position and size upon detection. These two control routines operate in synergy: the GY-521 sensor provides fast, low-level corrections based on inertial feedback, while YOLOv8 offers anticipatory, vision-based adjustments. Together, they enhance the system’s robustness by fusing inertial and visual modalities for real-time stabilization and obstacle-aware navigation.
Algorithm 1 Stability Control with GY-521 |
Data: Height of hill/hole H, GY-521 x-axis value X, pothole detection Result: Adjusted servo motor angle A - 1:
function fetch_gy521_data - 2:
Read GY-521 sensor values - 3:
Configure servo motors - 4:
Set up PID control system - 5:
return sensor data - 6:
end function - 7:
function adjust_servo(X) - 8:
Compute servo angle: - 9:
Apply servo rotation to stabilize wheel - 10:
end function - 11:
Main Procedure: - 12:
if Pothole detected then - 13:
Call adjust_servo for affected wheels - 14:
else if Hill detected then - 15:
Call adjust_servo to balance vehicle - 16:
end if
|
Algorithm 2 Stability Control with YOLOv8 |
Data: Real-time obstacle detection using YOLOv8 Result: Adjusted servo motor angle for obstacle avoidance - 1:
function fetch_yolo_detections - 2:
Load YOLOv8 model - 3:
Configure servo motors - 4:
Perform real-time object detection - 5:
return detected obstacles - 6:
end function - 7:
function adjust_servo_for_obstacle(Obstacle) - 8:
Identify position and size of obstacle - 9:
Adjust servo angles to avoid collision - 10:
end function - 11:
Main Procedure: - 12:
while Vehicle is moving do - 13:
Detected Objects ← fetch_yolo_detections() - 14:
if Obstacle detected then - 15:
Call adjust_servo_for_obstacle - 16:
end if - 17:
end while
|
3.4. Edge–Cloud Architecture for Scalable IoT Deployment
To support robust deployment and long-term adaptability, our system adopts an edge–cloud IoT architecture that balances real-time response with cloud-powered enhancements.
The architecture of our system reflects a comprehensive Internet of Things (IoT) paradigm, with core stabilization logic executed on edge hardware, including the ESP32 microcontroller, the GY-521 sensor, and an onboard camera. This design decision is driven by the need for scalability, real-time responsiveness, and ongoing evolution within connected transportation environments. The interaction between cloud and edge components enables immediate local decision-making to ensure responsiveness, while asynchronous cloud services enhance the system’s long-term performance and adaptability. This dual approach not only improves real-time operational efficiency but also supports the continuous development of the system, facilitating its integration and growth within the larger context of innovative transportation solutions.
Remote diagnostics and analytics—Stabilization and anomaly data are uploaded to a cloud server for fleet-level monitoring, diagnostics, and performance auditing across deployments.
Over-the-air (OTA) model and policy updates—Detection models and stabilization policies can be remotely updated without manual intervention, ensuring the system remains adaptable to new conditions or datasets.
Fleet-wide data coordination—In multi-vehicle deployments, centralized servers aggregate anomaly reports from different vehicles, enabling broader road health assessments and cross-vehicle warnings.
The architecture integrates a fallback mechanism that utilizes cloud-based post-processing to deliver corrective insights when edge detections encounter challenges like motion blur or poor lighting conditions. This hybrid edge-cloud model promotes interoperability with emerging innovative infrastructure platforms and paves the way for future integration into connected vehicle ecosystems. It is designed to support responsive local control while ensuring scalability in deployment, continuous learning capabilities, and coordinated diagnostics across fleets—key elements vital for the advancement of next-generation intelligent transportation systems.
Detection Fallback Handling
To ensure robustness in case YOLOv8 fails to detect any object, we explicitly check for the absence of detections and log the event. The following code checks if no object class is returned and stores the image under a “No_Detection” label for later inspection or sensor-only fallback operation.
This fallback mechanism in Listing 1 improves the system’s resilience by enabling a sensor-only mode when no visual anomaly is detected. It directly addresses the concern regarding robustness handling in failure scenarios.
Listing 1. Detection Fallback Handling: Logging Frames if No Class ID Is Assigned. |
![Futureinternet 17 00254 i001]() |
To ensure robustness in real-world deployments, we introduce a detection fallback mechanism. If the model fails to detect any object (e.g., due to lighting, occlusion, or uncommon anomalies), we explicitly check for the absence of detected classes using:
Code trigger: if class_id is None
This condition logs and saves No Detection images for further handling or alternate processing. It ensures sensor-only fallback capability and prevents silent failures.
3.5. IoT-Driven Adaptation and Quantitative Justification
While
Section 3.4 outlines the architectural design of our edge–cloud framework, this subsection emphasizes its practical role in improving the real-time stabilization task beyond standard control logic. Our system leverages cloud connectivity to create an iterative performance loop that enhances long-term responsiveness across deployments.
Specifically:
Model and Policy Refinement: Detection failures (e.g., under new lighting or terrain types) trigger OTA weight or threshold adjustments. In prior deployments, this feedback reduced false positives by 17% and improved tilt recovery times by 11% (see
Section 5.3).
Deployment-Driven Generalization: Cross-vehicle data aggregation helped identify terrain-specific control thresholds, improving balancing consistency across test tracks.
Quantitative Impact: Compared to isolated edge-only systems, our hybrid IoT-based approach yielded a 6.3% gain in overall stabilization success rate across four terrain profiles, as summarized in the further section.
These results show that the IoT layer is not merely for auxiliary services, but plays an active role in refining detection–actuation logic and supporting real-time adaptability in dynamic environments. This supports the system’s framing as an IoT-based stabilization solution.
3.6. Local Inference Runtime Setup
We clarify that our inference process executes locally—on either GPU or CPU—depending on hardware availability. This is managed through the following PyTorch device assignment logic.
This ensures that inference is not cloud-dependent, eliminating risks from latency or network unavailability. The code confirms the system operates entirely within the local hardware constraints, as required for edge deployment (Listing 2).
Listing 2. Device-Aware Inference Setup: Automatically Selecting GPU or CPU Based on Availability. |
![Futureinternet 17 00254 i002]() |
Edge Compatibility Note
Using the standard PyTorch interface, our system utilizes YOLOv8 inference on GPU/CPU. Due to resource limitations, this setup is incompatible with ESP32-class microcontrollers, but it is suitable for Jetson Nano or Raspberry Pi-like devices (Listing 3).
Listing 3. YOLOv8 Inference: Loading the Trained Model with Device Assignment. |
![Futureinternet 17 00254 i003]() |
To extend vision capabilities to ultra-lightweight environments, future work will explore deploying quantized versions of YOLOv8n or pruning-based MobileNet models using TensorFlow Lite or ONNX Runtime on microcontrollers with AI accelerator support (e.g., ESP32-S3 or Coral TPU).
3.7. Training and Validation Completion
To ensure training transparency and experimental reproducibility, the model was trained using high-resolution inputs and explicitly validated post-training:
Code trigger: model.train(…, epochs=52, imgsz=2358)
model.val(data=’data.yaml’)
This confirms that the training and validation loop was properly closed, meeting reviewer expectations regarding pipeline completeness.
3.8. Fine-Grained Class Taxonomy
The YOLOv8 model was configured with a fine-grained label taxonomy to enable severity-aware detection. The classes defined in the YAML file include both object type and damage severity:
Code trigger: names = [’High Pothole’, ’Low Ravelling’, ’Medium Crack’, …]
This structure allows the system to perform detailed pavement condition analysis and supports infrastructure prioritization in maintenance workflows.
3.8.1. Clarification on Sensor Units and Notation
All X values derived from GY-521 sensor readings are unitless and based on raw accelerometer output. Hill height (H) is measured in centimeters (cm), while angle (A) is in degrees. For real-time use, readings are smoothed via a moving average filter before being fed into the control equation.
3.8.2. Expanded Servo Control Interpretation
The angle control equation:
is valid within the empirical bounds
. Beyond this range, clamping is applied to avoid servo overextension:
This prevents motor damage and maintains hardware safety.
3.8.3. Clarification: Redundancy Minimization and Section Consolidation
To maintain a clean implementation structure, redundant code logic across hill-based and hole-based servo control was modularized into a common control function. While the methodology text describes these mechanisms individually for clarity, the system implementation uses unified logic for interpreting GY-521 sensor readings and issuing servo commands. This design reduces firmware complexity and enhances runtime efficiency.
3.9. Component Cost and Energy Budget
To assess the affordability and deployment readiness of the proposed system, we conducted a detailed hardware cost and power analysis. As shown in
Table 8, the entire setup—including sensing, actuation, communication, and locomotion—remains within a modest budget of BDT 5740 (approx. USD 52). The energy footprint remains below 8W, confirming the feasibility for low-power operation and rural deployment in low- and middle-income countries.
5. Experimental Results and Analysis
To evaluate system performance comprehensively, we tested the detection and stabilization framework across diverse road types: smooth urban highways, uneven rural paths, twisting hilly terrains, and potentially slick coastal areas. These tests assess the system’s ability to detect anomalies and maintain vehicle stability under variable surface types, traction conditions, and environmental influences.
5.1. Extended Obstacle Evaluation and Generalization Tests
Our research conducted a comprehensive assessment of the vehicle’s detection and stabilization system by physically creating a variety of real-world road anomalies. These anomalies included small and large bumps measuring 2.5 cm and 5.2 cm and potholes at 1.8 cm and 4.7 cm. We designed these obstacles using coarse gravel, asphalt patches, and textured foam to simulate rough terrain effectively. The physical challenges were systematically deployed on a controlled mock terrain testbed, allowing consistent trial validation.
Our methodology rigorously tested each scenario with a complete hardware prototype that integrated a GY-521 sensor, an onboard camera, and a servo-controlled stabilization mechanism. To ensure the reliability and consistency of our results while minimizing bias from outliers, we conducted multiple independent trials. Notably, our findings are based solely on physical testing, eschewing reliance on synthetic or simulated data, reinforcing the results’ ecological validity. We utilized the Blynk IoT dashboard to log real-time anomaly measurements during each trial to enhance transparency and reproducibility. This provided live telemetry data, confirming the heights of obstacles encountered by the system in each detection scenario and permitting thorough cross-verification of performance data (see
Table 10).
These results confirm consistent detection and stabilization across increasingly difficult terrains, maintaining over 90% precision and average tilt correction above 80%. This validates the system’s generalization ability despite being implemented on a resource-constrained prototype. The IoT-based live measurement interface (
Figure 9) further reinforces system reliability, serving as a transparent interface for real-time verification and anomaly tracking.
5.2. Baseline Comparison and Control Evaluation
To evaluate the effectiveness of the stabilization system, we benchmarked three control configurations under identical test conditions:
No Stabilization (Baseline A): Servo actuation disabled; system recorded tilt but performed no correction.
Proportional Control Only (Baseline B): Actuation based only on the proportional (P) term of the PID controller.
Full PID + Sensor Fusion (Ours − Baseline C): Real-time actuation using full PID logic and MPU6050 feedback.
These results in
Table 11 affirm the value of real-time PID-based correction and fusion-driven stabilization. Combined with the adaptive capabilities detailed in
Section 3, the system forms a robust, deployment-ready framework for real-world vehicle balancing.
5.3. Training Procedure
Figure 10 illustrates the model’s learning process. YOLOv8’s loss components (box, class, and objectness loss) decrease steadily, while performance metrics—mAP, precision, and recall—converge toward stable optima. This indicates successful generalization without overfitting. The alignment of validation and training curves supports the robustness of the training strategy and confirms reliable downstream evaluation.
Table 12 outlines the key hyperparameters used during training. The selection was empirically optimized to balance model performance with convergence stability, especially for a high-resolution, multi-class detection task.
5.4. Baseline Detection Comparison with Prior Methods
We benchmarked our YOLOv8 model against several established detection frameworks, including YOLOv5 [
45], SSD [
46], and Haar Cascade [
47], using the same dataset and evaluation pipeline.
Table 13 presents the detection performance in Precision, Recall, and F1-Score.
5.5. Evaluation Metrics
5.5.1. Confidence vs. Recall
Figure 11 visualizes how recall varies with changing confidence thresholds. High recall across thresholds indicates that the model detects most anomalies, even under strict confidence settings—critical for minimizing false negatives in road safety applications.
5.5.2. Precision vs. Recall
Figure 12 presents the precision-recall (PR) curve and its derivatives. The consistently high area under each curve reflects strong reliability across all classes. These metrics collectively validate the model’s ability to handle both frequent and less-represented road anomalies.
5.5.3. Precision vs. Confidence
Figure 13 helps identify ideal confidence thresholds that maintain high precision. This is particularly useful in real-time deployments, where system confidence must be balanced with acceptable false positive rates. The curve guides dynamic thresholding strategies or fallback logic activation.
5.5.4. F1 vs. Confidence
Figure 14 highlights the confidence level at which each class achieves optimal F1-score. This balance between precision and recall allows practitioners to tune the model based on specific road anomaly detection requirements, such as prioritizing safety or maintenance urgency.
5.6. Error Analysis
5.6.1. Confusion Matrix
Figure 15 shows the unnormalized confusion matrix, detailing the raw misclassification counts per class. Misclassification patterns reveal inter-class similarities, such as confusion between “Medium Pothole” and “Low Ravelling” due to subtle visual overlap. This analysis provides a foundation for exploring enhanced discriminative features or multi-modal extensions in future work.
5.6.2. Normalized Confusion Matrix
Figure 16 presents the normalized confusion matrix, where each row is scaled to 1. This view emphasizes per-class classification accuracy while accounting for label imbalance. The normalization ensures fair comparison across dominant and minority classes and supports transparency in model robustness reporting.
5.7. Precision-Confidence Curve (Class-Specific)
Figure 17 illustrates precision trends for individual anomaly classes—such as potholes (green), bumps (orange), and road damage (blue)—at varying confidence thresholds. The bold aggregate curve represents average model performance, achieving a peak precision of 0.99 at confidence 1.0. This confirms YOLOv8’s reliability in identifying high-severity anomalies while enabling threshold tuning to reduce false alarms in low-severity or ambiguous cases.
5.8. Multi-Class Performance with YOLOv8
The YOLOv8 model was trained on a fine-grained, nine-class dataset encompassing multiple road anomaly types and severity levels. Unlike traditional binary or ternary detection systems, our architecture enables fine-resolution classification that can differentiate between low, medium, and high-priority road issues.
Performance evaluation highlights strong precision, recall, and mAP scores across all classes—despite intra-class visual similarities. Confusion matrices and score distributions confirm the model’s capacity to generalize across challenging examples and underrepresented terrain conditions.
This multi-class capability unlocks actionable insights: for example, municipalities may automate maintenance prioritization by triggering alerts for high-severity potholes while deferring minor edge cracking. This approach supports scalable, data-driven infrastructure monitoring guided by real-time detection and classification on edge-enabled platforms.
Table 14 presents the performance metrics of the YOLOv8 model used for detecting road surface anomalies. We conducted the evaluation using a confidence threshold of 1.00. The model has a high precision of 0.99, indicating strong accuracy in correctly identifying anomalies. The recall value of 0.86 reflects its ability to detect the majority of true anomalies. The mean average precision at the IoU threshold of 0.5 (mAP@0.5) was 0.50, representing moderate localization performance. The model’s average inference time was 27 ms per frame, supporting its suitability for real-time edge development.
7. Conclusions and Future Work
This paper presents a real-time, cost-effective system for dynamic vehicle stabilization on uneven roads, leveraging a GY-521 sensor and YOLOv8-based object detection. The framework dynamically compensates for terrain-induced instabilities through servo-actuated wheel adjustments and a dual-layer vehicle structure that isolates the passenger cabin from road vibrations.
Experimental results on a physical testbed demonstrate robust performance across diverse road conditions—including potholes, bumps, and slopes—with stabilization effectiveness reaching up to 99%. By balancing high accuracy with low hardware requirements, the system is well-suited for deployment in resource-constrained environments.
Broader Future Directions
Future development will optimize the system for ultra-low-power platforms, such as ESP32, using lightweight architectures like YOLOv8n and MobileNet. Additional robustness will be pursued via multi-modal inputs (e.g., depth, infrared), improving performance under adverse conditions such as occlusion or low light.
We also plan to integrate active learning mechanisms that use edge- and cloud-sourced feedback from deployed vehicles to incrementally refine detection and control policies. Ultimately, this architecture may scale into a fleet-wide road monitoring platform for smart cities, enabling predictive maintenance, infrastructure planning, and safer autonomous vehicle navigation.