Next Article in Journal
The Impact of Time Delays in Traffic Information Transmission Using ITS and C-ITS Systems: A Case-Study on a Motorway Section Between Two Tunnels
Previous Article in Journal
Performance of Advanced Rider Assistance Systems in Varying Weather Conditions
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Real-Time Vehicle Emergency Braking Detection with Moving Average Method Based on Accelerometer and Gyroscope Data

1
Faculty of Engineering, Universitas Mercu Buana, West Jakarta 11650, Indonesia
2
Faculty of Computer Sciences, Universitas Mercu Buana, West Jakarta 11650, Indonesia
3
National Research and Innovation Agency, Jakarta 10340, Indonesia
*
Author to whom correspondence should be addressed.
Vehicles 2025, 7(4), 106; https://doi.org/10.3390/vehicles7040106
Submission received: 29 July 2025 / Revised: 4 September 2025 / Accepted: 16 September 2025 / Published: 25 September 2025

Abstract

Emergency braking detection plays a vital role in enhancing road safety by identifying potentially hazardous driving behaviors. While existing methods rely heavily on artificial intelligence and computationally intensive algorithms, this paper proposes a lightweight, real-time algorithm for distinguishing emergency braking from non-emergency events using accelerometer and gyroscope signals. The proposed approach applies magnitude calculations and a moving average filters algorithm to preprocess inertial data collected from a six-axis IMU sensor. By analyzing peak values of acceleration and angular velocity, the algorithm successfully separates emergency braking from other events such as regular braking, passing over speed bumps, or traversing damaged roads. The results demonstrate that emergency braking exhibits a unique short-pulse pattern in acceleration and low angular velocity, distinguishing it from other high-oscillation disturbances. Furthermore, varying the window length of the moving average impacts classification accuracy and computational cost. The proposed method avoids the complexity of neural networks while retaining high detection accuracy, making it suitable for embedded and real-time vehicular systems, such as early warning applications for fleet management.

1. Introduction

Road safety remains a major global concern. The Global Status Report on Road Safety revealed that in 2021, around 1.19 million people lost their lives in road traffic accidents, with 92% of these fatalities occurring in low- and middle-income countries [1]. Several factors contribute to this high accident rate, such as excessive speeding, driver distractions, driving under the influence of alcohol or drugs, poor road infrastructure, vehicle defects, and driver skills [1]. A driver’s ability to control the vehicle in a critical situation significantly influences the severity of the accident.
Braking is a vital aspect of vehicle control, enabling drivers to manage speed and react to unexpected dangers. Braking behavior varies depending on the situation and the driver’s reaction time. Common types include normal braking, anticipatory braking, and emergency braking. Emergency braking or hard braking refers to sudden, forceful braking, typically performed in emergency situations to avoid collisions. While this reaction can be lifesaving, it often comes with negative side effects. For example, emergency braking can cause loss of vehicle stability, especially on wet, slippery, or uneven surfaces, which may increase the risk of skidding, rollover, or triggering a rear-end collision if the following vehicle is too close. Studies in [2,3] show a moderate correlation between emergency braking events and historical crash accidents, with approximately 1 crash/mile for every 147 emergency braking events [3]. In addition, frequent emergency braking may reflect aggressive driving habits [3]. Understanding braking patterns can help identify drivers who are more prone to the risk of a traffic incident. Furthermore, ref. [2] suggests that clusters of emergency braking events can serve as early indicators of future collisions, allowing for targeted interventions to mitigate accident risks and enhance road safety.
While there are numerous studies that discuss crash detection systems [4,5,6,7,8], only a few have been proposed to track and analyze braking, such as studies in [9,10,11,12]. These studies analyze braking patterns using post-processing [9], telematics data analysis [10], and machine learning models [11,12]. These methods are typically linked to sensors that detect variations in acceleration and speed patterns, such as a Global Positioning System (GPS) sensor [10] and accelerometers, either used alone or in combination with gyroscopes [11,13]. GPS sensors provide spatial and temporal contexts. They offer location data for each braking event, enabling researchers and traffic authorities to map high-risk areas. GPS also tracks vehicle speed before and after braking, facilitating an understanding of how rapidly speed is reduced during deceleration. Furthermore, time-stamped route information allows analysts to associate braking behavior with specific road types, traffic conditions, and time-of-day patterns. However, relying solely on GPS for braking detection also has its limitations, mainly due to the low accuracy of speed estimation provided by GPS. Meanwhile, in [9,11,12,13], braking detection is based on accelerometers, either used alone or in combination with gyroscopes. Accelerometers, which measure changes in velocity over time, are particularly effective in capturing the dynamic aspects of braking. They can detect the intensity of braking through deceleration magnitude, typically expressed in meters per second squared or g-force, and identify hard or emergency braking events, which are marked by sudden, sharp decelerations often associated with emergency situations or aggressive driving. Additionally, accelerometers can measure the frequency and duration of braking episodes, offering insights into driving patterns and potential safety risks. In [11,12], emergency braking is detected using accelerometer data fed to machine learning and artificial neural network algorithms. However, these algorithms usually require considerably high computation loads, which becomes a major concern in the context of real-time and embedded applications.
While accelerometers are highly effective for braking monitoring, several challenges arise due to the accelerometer’s inherent characteristics. One of the primary issues is their high sensitivity to vibrations, which can lead to false positives in braking detection. Road irregularities, vehicle suspension movement, and engine vibrations can generate acceleration signals that resemble emergency braking events. Even with sophisticated neural network algorithms, normal driving movements can still be misclassified as emergency braking, speed bumps, or zig-zag movements as described in [11]. Additionally, accelerometers exhibit drift and bias, particularly in long-term measurements [14]. Small errors in orientation or sensor placement can accumulate over time, leading to incorrect estimations of deceleration and braking intensity [15]. Another challenge is shock response, where abrupt impacts can cause sudden spikes in acceleration readings (such as when a vehicle hits potholes), making it difficult to distinguish genuine braking events from external disturbances [16].
Unlike the study in [11] that deals with multiclass classification, this paper attempts to tackle a binary classification problem. This paper proposes an algorithm for detecting emergency braking and non-emergency braking events based on accelerometer and gyroscope signals. To achieve efficient computation, the algorithm incorporates a simple pre-processing filter and a classical statistics method. Instead of using artificial intelligence techniques, the proposed algorithm applies a simple moving average and finds the relationship between accelerometer and gyroscope peak magnitudes that differentiates emergency braking from other events. The use of a moving average, instead of a low-pass filter as in [11], is effective and computationally more efficient. The effects of different window lengths on the moving average are presented and discussed. The proposed algorithm shows that emergency braking signals possess a unique characteristic that sets them apart from events, such as regular braking, crossing damaged roads, and speed bumps. Furthermore, unlike prior studies that required sensors to be positioned in fixed orientations [14,15], the algorithm proposed in this study introduces a novel advantage by enabling users to place the sensor in any direction. In addition, the proposed braking detection algorithm can be used in applications, such as early warning systems that notify fleet management when emergency braking is detected, indicating the potential for an accident.

2. Related Works

Accident detection systems have evolved significantly through the integration of various sensors such as accelerometers, gyroscopes, and GPS. Numerous studies have explored different sensor configurations and algorithms to improve the accuracy and reliability of accident detection mechanisms. For instance, the study in [4] utilized an accelerometer not only to detect accidents but also to determine if a vehicle had rolled over. A mercury switch was also incorporated to detect and count instances of hard braking. The accelerometer, in a stationary vehicle, remained in a zero-g position with a stable output of approximately 1.65 V, which corresponded to a digital value of 338. Deviations from this value during vehicle roll indicated a rollover. For hard braking, the mercury switch functioned by completing an electrical circuit through inertia-driven contact closure during abrupt deceleration, prompting a falling-edge interrupt in the microcontroller to register the event.
Similarly, ref. [17] adopted a threshold-based method using accelerometer data, where values exceeding 3092 (approximately 30 G) indicated a collision. The study employed a conversion formula, g-force = 0.0108 × val − 3.4, to interpret raw sensor data and further examined how varying road conditions, such as smooth or rough surfaces, influenced these readings. Furthermore, the study in [18] introduced the use of a limit switch to complement accelerometer and GPS readings. Positioned at the front and rear of the vehicle, the limit switch reliably indicated collision events through contact-based electrical triggers.
A different approach was taken in [19], which implemented the SW-420 vibration sensor—a seismic detector capable of producing logic-high signals (2.5–5 V) when the intensity of vibration surpassed a predefined threshold. This method provided a cost-effective solution for identifying significant impacts. In the same year, ref. [5] developed a classification system based on g-force intensity using accelerometers. Impacts were categorized as mild (5–20 G), moderate (20–40 G), or severe (>40 G), while values below 5 G were deemed non-accidents. This stratified approach enabled the system to assess collision severity and inform appropriate response mechanisms.
A study in [6] employed the MPU-6050 (TDK InvenSense), a three-axis accelerometer and gyroscope module, for refined accident detection. The system relied on specific thresholds—tilt angles exceeding 80 degrees on the X-axis and 70 degrees on the Y-axis and vibration levels over 4000 mV/G—to confirm severe accidents. Meanwhile, ref. [7] proposed a hybrid method combining a sudden speed drop of over 20 km/h within three seconds, a tilt angle change greater than 15 degrees, and a crash signal to determine if an accident occurred. The system also assessed the vehicle’s motion status post-deceleration; if it had stopped completely, the event was classified as an accident.
Further advancements were made in [20], which introduced high-frequency data sampling, capturing acceleration readings every 2 ms. The algorithm used calculated the vector sum of acceleration across all three axes, comparing the total to a set threshold to identify abrupt changes in force that indicated a collision. This allowed for more responsive, real-time detection. Lastly, ref. [8] presented a multi-sensor fusion approach involving accelerometers, gyroscopes, and vibration sensors. The system determined the magnitude of motion by computing the distance between two points in three-dimensional space, based on changes in the x, y, and z coordinates. It also derived orientation angles to standardize the data. The gyroscope measured angular velocity to verify collision events, while threshold values were calibrated using sensor sensitivity to ensure precise detection. This comprehensive method enhanced the reliability of accident detection by confirming data from motion, orientation, and impact sensors. Table 1 shows a summary of the related works.
In contrast to the related studies that have been discussed, which focused on developing accident detection systems for situations where a collision or accident had already occurred, this study proposes an algorithm to detect both emergency and non-emergency braking based on accelerometer and gyroscope signals before an accident takes place. This approach allows the system to function as an early warning application, indicating the potential risk of a collision or accident. Additionally, the proposed algorithm allows sensors to be oriented in any direction without intensive computation, making the system easily adaptable to brake detection systems in various types of four-wheeled or larger vehicles.

3. Materials and Methods

3.1. Materials

The Orange Pi 5 SBC with Ubuntu OS 20.04 was used for data acquisition. Communication between the SBC and the sensor was facilitated by an inter-integrated circuit (I2C) interface at a speed of 400 kHz. The ASM330LHH comprises a three-axial accelerometer and a three-axial gyroscope. This configuration enables the collection of critical data, specifically measuring acceleration across the X, Y, and Z axes, as well as angular velocity around the same axes, denoted as ΩP (pitch), ΩR (roll), and ΩY (yaw), respectively. The orientation of the inertial axes of ASM330LHH is shown in Figure 1, with the Z-axis directed toward the top portion of the sensor casing. Furthermore, after preliminary experiments, a sampling frequency of 52 Hz was selected to balance data fidelity and computational efficiency for the embedded system. Under this configuration, dynamic vehicular motions can be adequately captured, as the selected sampling frequency preserves the temporal detail necessary for tracking rapid changes in acceleration and deceleration.
In this study, the system was installed in the dashboard of a city car, with the orientation of the device being arbitrary. The choice of arbitrary positioning was intended to emulate real-world deployment scenarios, wherein strict orientation is often impractical due to installation constraints and variability across vehicle models, for example, the Z-axis is aligned with the gravity vector.

3.2. Methods

3.2.1. Data Acquisition

The main objective of this study was to detect and cluster emergency braking events. Data from other driving conditions, such as regular braking, passing over speed bumps, and traversing damaged roads, were also collected to serve as comparative references for contextual analysis. This approach aims to explore the distinct differences between emergency braking and other events and to implement appropriate processing methods to prevent misclassification. Additionally, engine idle data were acquired as a reference.
To obtain sufficient variability in the dataset, each type of event was tested under diverse conditions. For the emergency braking event, the brake was engaged at different cruising speeds, i.e., 10, 20, 30, and 40 km/h. For safety reasons in our current situation, emergency braking is limited at a speed of 40 km/h. To capture the variability in real-world conditions, the experiments were also performed on multiple types of speed bumps and under different damaged road surface conditions as shown in Figure 2.

3.2.2. Data Analysis

The data analysis involves several computational steps:
  • Acceleration and angular velocity magnitude:
The magnitude of an accelerometer vector represents the overall acceleration experienced by the vehicle by combining the acceleration values from all three axes (X, Y, and Z). It is calculated using the Pythagorean theorem in 3D space:
A n = X n 2 + Y n 2 + Z n 2
where Xn, Yn, and Zn are the nth samples of the accelerometer readings in the X, Y, and Z directions, respectively. Meanwhile, the magnitude of a gyroscope vector signifies the total speed of rotation experienced by the vehicle, and is computed as
G n = Ω P . n 2 + Ω R . n 2 + Ω Y . n 2
where Ω P . n 2 + Ω R . n 2 +   Ω Y . n 2 are the nth samples of the gyroscope readings in the ΩP, ΩR, and ΩY directions, respectively.
2.
Moving average with various window lengths
A simple moving average (MA) is applied to the vector magnitudes of the accelerometer and gyroscope to smooth out the data from high-frequency signals and random vibration. The reason for this processing is because the emergency braking data’s shape resembles a short pulse [21]. The accelerometer and gyroscope magnitude moving average is calculated according to the following formulas, respectively:
A A n =   1 k i = n k + 1 n A i
G A n = 1 k i = n k + 1 n G i
where k is the window length and n is the nth sample. In this study, different window lengths were tested to determine the value that yields the best classification results.
3.
Finding optimal window length for the farthest cluster separation
After calculating the magnitude moving average of the accelerometer and gyroscope, the next step is to find the optimal window length that results in the farthest separation between the emergency braking and non-emergency braking events. The optimization problem is defined as follows. Let the search range of window lengths be
k ∈ K = {2, 4, 6, …, 100}
Define
(k) = Q(k) ∪ R(k) ∪ S(k) ∪ T(k)   (Non-emergency braking cluster)
ε(k) = E(k)           (Emergency braking cluster)
where Q, R, S, T, and E are the datasets representing speed bumps, regular braking, damaged roads, engine idle, and emergency braking, respectively. Each dataset consists of tuples containing the maximum peaks of the accelerometer and gyroscope. Let P(k) be the polygonal boundary (obtained from a convex hull) enclosing N ( k ) . For any point xi(k) ∈ ε(k), calculate its Euclidean distance to the P(k) boundary:
d i k = x i k y 2  
where d = 0 is designated for points that lie inside the N ( k ) cluster. Then, find the shortest distance from any emergency braking point to the non-emergency boundary for window length k:
D ( k ) = d i k     K ( k )
The objective function is to find the optimal window length k* that maximizes the shortest distance from any emergency braking point to the non-emergency boundary:
k * = m a x k     K   D ( k )

4. Results and Discussions

Table 2 shows the acquired data distribution of various events.
Figure 3 shows the accelerometer and gyroscope raw data sample for engine idle, regular braking, emergency braking, damaged road, and speed bumps, respectively. Figure 3a,b shows the data for engine idle. It can be seen that the ASM330LHH IMU sensor is not positioned flat on its base as the Z-axis is not at 9.8 m/s2 and the X and Y axes have non-zero values; instead, it is inclined to a certain degree. Figure 3c,d illustrates a data sample for regular braking, where it can be seen in the accelerometer data that the onset of braking happens at around 5 s and progresses slowly until a full stop at 10.5 s. On the other hand, the gyroscope data do not indicate noticeable changes in trends during braking because the vehicle’s angular position across pitch, roll, and yaw remains stable. This indicates that normal braking primarily affects linear acceleration, not orientation. Furthermore, Figure 3e,f presents an example of accelerometer and gyroscope data for emergency braking. In this example, the vehicle is cruising at a speed of 40 km/h and undergoes a deceleration of 5.5 m/s2. It shows braking starting at 11.5 s, followed by a short pulse for approximately 2 s, and ends with oscillations until a complete stop at 15 s. This type of short pulse is typically found in emergency braking events, and it signifies the magnitude and duration of deceleration experienced by the vehicle. In the gyroscope data, some degrees of rotation in the ΩR direction can also be observed. This is related to back-and-forth shock movements usually experienced at the end of emergency braking events.
In Figure 3g,h, a sample of data for the vehicle moving across a damaged road is shown. Generally, both the accelerometer and gyroscope data exhibit rapid oscillation around the baseline of their axes. Strong vibrations start at around 6 s and continue as the vehicle crosses the damaged road. It can be seen that the peak values for the accelerometer and gyroscope reach up to −20 m/s2 and −65 deg/s, which are much higher than those of emergency braking. Figure 3i,j shows the data trends of the vehicle moving over a speed bump, which exhibit slower oscillations compared with those in Figure 3g,h. However, the peak values can also become significantly higher than those of emergency braking.
Overall, from Figure 3, it can be seen that the instantaneous values cannot be used directly as decision criteria to distinguish emergency braking from the other events. Further processing steps are needed to extract more distinguishable features.

4.1. Magnitude and Moving Average

The first step in processing the raw data is to calculate the accelerometer and gyroscope magnitude according to Formulas (1) and (2), respectively. This step is meant to combine and simplify the three-axis measurements into a single parameter describing the overall magnitude of acceleration and angular velocity experienced by the vehicle.
The most prominent feature in emergency braking, compared to other events, is the short pulse, as shown in Figure 4e,f. In contrast, the speed bump and damaged road events are characterized by high oscillations around the accelerometer and gyroscope baselines. Therefore, the signal needs to be further processed so that the pulse shape is preserved as much as possible while the signal oscillation is greatly suppressed. This can be achieved by applying a moving average filter according to Formulas (3) and (4).
In Figure 4, the blue traces show the calculation results of accelerometer and gyroscope magnitudes, whereas the orange traces show the magnitude moving average with a window length of 40. In Figure 4a,b, it can be seen that during engine idle, the accelerometer magnitude oscillates around 9.8 m/s2, which signifies the engine vibration superimposed on the gravitational force. The gyroscope is averaged at 0.5 deg/s; this offset can be compensated to zero if needed. In Figure 4e,f, it can be observed that the averaged accelerometer magnitude smoothed out the random vibration while the prominent pulse shape of emergency braking is retained. On the other hand, Figure 4g–j show that the high peak magnitudes for the damaged road and speed bump have been averaged to significantly lower values because the signals typically oscillate around the gravitational force.
For high-frequency suppression, the same effect can be achieved by using low-pass filters instead of a moving average. However, low-pass filters, particularly those with sharp band transitions, are computationally much more intensive than a moving average. Computation time can be a crucial consideration in embedded applications, including in the automotive field, where this emergency braking detection system will be implemented. To gain an indication of the computational load, the following tasks based on Python 3 libraries were executed on the Orange Pi 5 SBC and Raspberry Pi Zero 2 W SBC: Butterworth low-pass filter (Scipy’s filtfilt), moving average (Numpy’s convolve), and moving average (Bottleneck’s move_mean). The execution time was measured using the timeit library. In addition, execution time on the ESP32 (WROOM-32) microcontroller using the RunningAverage’s getFastAverage library is also presented. In each of the experiments, 500 data points were fed into the processing task.
It can be seen in Table 3 that the LPF execution time increased significantly with the filter order. Numpy’s moving average is at least nine times faster than the Butterworth low-pass filter. Furthermore, the Bottleneck’s moving average was more than 160 times faster than that of the low-pass filter. Table 4 shows that the moving average execution time on the ESP32 microcontroller was around 533–536 µs. Only a small increase in execution time with the increase in window length was observed because the RunningAverage algorithm efficiently computed the sliding window.

4.2. Optimal Window Length

Figure 5 depicts all peaks of the averaged acceleration and angular velocity of all datasets in Table 2 at different window lengths. The dotted line represents the polygonal boundary that encloses all the non-emergency points, which was computed using the ConvexHull method from the scipy Python library. Emergency braking points that lie inside the polygon are assigned a distance of zero. At a window length of 10, emergency braking is not completely separated from other events, as the averaging effect is still insufficient. Some points are located inside the polygon. At a window length of 30, emergency braking forms a cluster secluded from other events. Further increasing the window length to 75 and 100 results in lower peaks for emergency braking. This is a consequence of the more aggressive smoothing effect of longer window lengths. However, such an over-smoothing effect does not affect the peaks of the regular braking pulse because its pulse duration is still longer than the window length. As shown in Figure 3c, the pulse duration of regular braking is around 5 s, or equivalent to 260 samples. Whereas the pulse duration of emergency braking is around 2 s, as shown in Figure 3e.
It was also observed that using acceleration as the only parameter is not sufficient for an emergency braking detection system. In particularly, peak acceleration on damaged roads can reach high values comparable to those of emergency braking. Thus, the acceleration of emergency braking becomes indistinguishable from other events. Therefore, the gyroscope becomes useful as a second parameter. Intuitively, because there is no vibrating motion during emergency braking, its peak angular velocity is usually low. This is a key feature that distinguishes emergency braking from a damaged road event, which has a high angular velocity as a consequence of vibration caused by crossing an irregular road surface.
To find the optimal window length that maximizes the separation distance between the emergency braking points and the non-emergency boundary, a systematic search was performed according to the criteria described in Equations (5)–(10). Figure 6 describes the Euclidean distances between each point of emergency braking and the non-emergency boundary at different window lengths. Each points/dots that have a zero distance are located inside the non-emergency boundary. Larger dots signify more points at that distance. It can be seen that the optimal window length is around 30 because the minimum distance reaches its maximum (at around 0.86) and no points are located inside the polygon boundary. This is also shown in Figure 5b.

5. Conclusions

This study presents a simple yet effective method for emergency braking detection based on the combined use of accelerometer and gyroscope data. Unlike previous studies that rely on artificial neural networks and require substantial computational resources, the proposed algorithm uses a moving average filter and classical statistical analysis to differentiate emergency braking from other events. The experimental results demonstrate that emergency braking has a distinct profile characterized by a short pulse in acceleration magnitude and relatively low angular velocity. By plotting the peak values of acceleration against angular velocity, the algorithm can effectively separate emergency braking events from regular braking, speed bumps, and damaged roads. This lightweight approach offers a practical solution for embedded automotive systems and can be deployed in early warning systems to enhance traffic safety and fleet monitoring.
The results presented in this paper are preliminary and require validation through more datasets on different vehicle types including automatic emergency braking (AEB) systems, different drivers, and higher travelling speeds. In addition, the presented classification thresholds are based on flat/level road conditions as these were the conditions used during measurements. On uphill or downhill roads, the thresholds will change depending on the degree of inclination. This is a consequence of the proposed algorithm, which does not remove gravitational acceleration. However, a small degree of inclination is expected to be tolerable as there are margins of separation between emergency braking and non-emergency braking. Therefore, the proposed algorithm in its current form is suitable for generally flat road environments.

Author Contributions

Conceptualization, H.P., A.W. and D.M.; methodology, Y.Y., M.I.S. and A.V.E.; software, A.W., Y.Y. and A.V.E.; resources, H.P.; writing—original draft preparation, Y.Y., M.I.S. and T.A.W.W.; writing—review and editing, H.P., A.W., Y.Y., M.I.S., D.M., I.S., A.V.E., T.A.W.W. and H.W.N.; project administration, T.A.W.W. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Research Organization for Energy and Manufacture (Grant No. 8/III.3/HK/2025), the National Research and Innovation Agency. The APC was funded by Universitas Mercu Buana.

Data Availability Statement

Data are contained within the article. Further inquiries can be directed to the corresponding author.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Global Status Report on Road Safety 2023, 1st ed.; World Health Organization: Geneva, Switzerland, 2023; ISBN 978-92-4-008651-7.
  2. Mahmud, S.; Day, C.M. Exploring Crowdsourced Hard—Acceleration and Braking Event Data for Evaluating Safety Performance of Low-Volume Rural Highways in Iowa. J. Transp. Technol. 2023, 13, 282–300. [Google Scholar] [CrossRef]
  3. Desai, J.; Li, H.; Mathew, J.K.; Cheng, Y.-T.; Habib, A.; Bullock, D.M. Correlating Hard-Braking Activity with Crash Occurrences on Interstate Construction Projects in Indiana. J. Big Data Anal. Transp. 2021, 3, 27–41. [Google Scholar] [CrossRef]
  4. Kader, M.A.; Alam, E.; Momtaj, S.; Necha, S.; Alam, M.S.; Masum, A.K.M. IoT Based Vehicle Monitoring with Accident Detection and Rescue System. In Proceedings of the 2019 22nd International Conference on Computer and Information Technology (ICCIT), Dhaka, Bangladesh, 18–20 December 2019; pp. 1–6. [Google Scholar] [CrossRef]
  5. Razali, S.N.; Abu Samah, K.A.F.; Ahmad, M.H.; Riza, L.S. IoT Based Accident Detection And Tracking System With Telegram and SMS Notifications. In Proceedings of the 2021 6th IEEE International Conference on Recent Advances and Innovations in Engineering (ICRAIE), Kedah, Malaysia, 1–3 December 2021; pp. 1–5. [Google Scholar] [CrossRef]
  6. Chikaka, T.P.; Longe, O.M. An Automatic Vehicle Accident Detection and Rescue System. In Proceedings of the 2021 IEEE 6th International Forum on Research and Technology for Society and Industry (RTSI), Naples, Italy, 6–9 September 2021; pp. 418–423. [Google Scholar] [CrossRef]
  7. Sagala, A.; Putra, J.A.; Silalahi, J.K.A.; Sianipar, R.A.T. Vehicle Accident Detection System with LPWAN Technology for Information Transmission. In Proceedings of the 2023 IEEE 9th Information Technology International Seminar (ITIS), Batu Malang, Indonesia, 18–20 October 2023; pp. 1–7. [Google Scholar] [CrossRef]
  8. Al-Tarawneh, L.; Al-Abweh, L.; Athamneh, A.; Refai, A.; Alja’aFreh, M. Design of an IoT-based Vehicle Accident Severity Detection System with Artificial Intelligence. In Proceedings of the 2025 5th IEEE Middle East and North Africa Communications Conference (MENACOMM), Byblos, Lebanon, 20–22 February 2025; pp. 1–6. [Google Scholar] [CrossRef]
  9. Walcott-Bryant, A.; Tatsubori, M.; Bryant, R.E.; Oduor, E.; Omondi, S.; Osebe, S.; Wamburu, J.; Bent, O. Harsh Brakes at Potholes in Nairobi: Context-Based Driver Behavior in Developing Cities. In Proceedings of the 2016 IEEE 19th International Conference on Intelligent Transportation Systems (ITSC), Rio de Janeiro, Brazil, 1–4 November 2016; pp. 675–681. [Google Scholar]
  10. Chan, I.W.; Badescu, A.L.; Lin, X.S. Assessing Driving Risk through Unsupervised Detection of Anomalies in Telematics Time Series Data. ASTIN Bull. 2025, 55, 205–241. [Google Scholar] [CrossRef]
  11. Nuswantoro, F.M.; Sudarsono, A.; Santoso, T.B. Abnormal Driving Detection Based on Accelerometer and Gyroscope Sensor on Smartphone Using Artificial Neural Network (ANN) Algorithm. In Proceedings of the 2020 International Electronics Symposium (IES), Surabaya, Indonesia, 29–30 September 2020; pp. 356–363. [Google Scholar]
  12. Prakash, A.; Senthil Kumar, C.B. Machine Learning-Based Predictive Analysis of Car Braking System. Commun. Appl. Nonlinear Anal. 2025, 32, 1083–1094. [Google Scholar]
  13. Bullen, F.; Ruller, J. Reconstructing Crashes Involving Emergency Braking on Wet Roads. Int. J. Crashworthiness 1998, 3, 65–72. [Google Scholar] [CrossRef]
  14. Guo, G.; Chai, B.; Cheng, R.; Wang, Y. Temperature Drift Compensation of a MEMS Accelerometer Based on DLSTM and ISSA. Sensors 2023, 23, 1809. [Google Scholar] [CrossRef]
  15. McClintock, F.A.; Callaway, A.J.; Clark, C.J.; Williams, J.M. Assessing the Impact of Sensor Orientation on Accelerometer-Derived Angles: A Systematic Analysis and Proposed Error Reduction. Appl. Sci. 2024, 14, 842. [Google Scholar] [CrossRef]
  16. Huang, L.; Jiang, K.; Wang, P.; Zhang, M.; Ding, X.; Li, H. Enhancing the Shock Response Performance of Micromachined Silicon Resonant Accelerometers by Electrostatic Active Damping Control. Micromachines 2021, 12, 1548. [Google Scholar] [CrossRef]
  17. Choudhury, A.; Choudhury, A.; Nersisson, R. GSM based Accelerometer Mounted Accident Detection with Location Tracking and Survivor’s Condition Monitoring System. In Proceedings of the 2019 IEEE International Conference on Distributed Computing, VLSI, Electrical Circuits and Robotics (DISCOVER), Manipal, India, 11–12 August 2019; pp. 1–6. [Google Scholar] [CrossRef]
  18. Roy, S.; Kumari, A.; Roy, P.; Banerjee, R. An Arduino Based Automatic Accident Detection and Location Communication System. In Proceedings of the 2020 IEEE 1st International Conference for Convergence in Engineering (ICCE), Kolkata, India, 5–6 September 2020; pp. 38–43. [Google Scholar] [CrossRef]
  19. Chaudhari, A.; Agrawal, H.; Poddar, S.; Talele, K.; Bansode, M. Smart Accident Detection And Alert System. In Proceedings of the 2021 IEEE India Council International Subsections Conference (INDISCON), NAGPUR, India, 27–29 August 2021; pp. 1–4. [Google Scholar] [CrossRef]
  20. Goyal, A.; Gupta, P.; Pandey, K. Vehicle Accident Detection and Reporting System using Internet of Things. In Proceedings of the 2024 5th International Conference on Electronics and Sustainable Communication Systems (ICESC), Coimbatore, India, 7–9 August 2024; pp. 1121–1126. [Google Scholar] [CrossRef]
  21. Dima, D.S.; Covaciu, D. Solutions for acceleration measurement in vehicle crash tests. IOP Conf. Ser. Mater. Sci. Eng. 2017, 252, 012007. [Google Scholar] [CrossRef]
Figure 1. Inertial measurement sensor ASM330LHH axis directions.
Figure 1. Inertial measurement sensor ASM330LHH axis directions.
Vehicles 07 00106 g001
Figure 2. (a) Speed bump; (b) damaged road.
Figure 2. (a) Speed bump; (b) damaged road.
Vehicles 07 00106 g002
Figure 3. Accelerometer and gyroscope raw data samples: (a,b) engine idle; (c,d) regular braking; (e,f) emergency braking; (g,h) damaged road; (i,j) speed bump.
Figure 3. Accelerometer and gyroscope raw data samples: (a,b) engine idle; (c,d) regular braking; (e,f) emergency braking; (g,h) damaged road; (i,j) speed bump.
Vehicles 07 00106 g003aVehicles 07 00106 g003b
Figure 4. Acceleration and angular velocity magnitude and moving average: (a,b) engine idle; (c,d) regular braking; (e,f) emergency braking; (g,h) damaged road; (i,j) speed bump.
Figure 4. Acceleration and angular velocity magnitude and moving average: (a,b) engine idle; (c,d) regular braking; (e,f) emergency braking; (g,h) damaged road; (i,j) speed bump.
Vehicles 07 00106 g004aVehicles 07 00106 g004b
Figure 5. Peak of acceleration against peak of angular velocity of all datasets; (a) WL = 10; (b) WL = 30; (c) WL = 75; (d) WL = 100. The dotted blue lines represents the polygonal boundary that encloses all the non-emergency points.
Figure 5. Peak of acceleration against peak of angular velocity of all datasets; (a) WL = 10; (b) WL = 30; (c) WL = 75; (d) WL = 100. The dotted blue lines represents the polygonal boundary that encloses all the non-emergency points.
Vehicles 07 00106 g005
Figure 6. Euclidean distances from emergency braking points to the non-emergency boundary at different window lengths.
Figure 6. Euclidean distances from emergency braking points to the non-emergency boundary at different window lengths.
Vehicles 07 00106 g006
Table 1. Summary of related works.
Table 1. Summary of related works.
Paper TittleType of DetectionProcessorDetection SensorSensor OrientationThreshold
[8]AccidentArduino MegaAccelerometer sensor
(ADXL335), Gyroscope sensor (MPU6050), Vibration sensor (SW-18010P)
Normal
(xy plane)
-
[20]AccidentESP8266 MCUAccelerometer sensor (MPU6050)Not explainedNot explained
[7]AccidentRaspberry PiAccelerometer sensor (ADXL 345), tilt sensor, and crash collision sensorNormal
(xy plane)
>20 km/h in 3 s, tilt angle change > 15 degrees, crash collision sensor outputs a value of 1
[6]AccidentArduino Uno3-Axis Gyro accelerometer sensor (MPU-6050)Normal
(xy plane)
X-axis > 80 degrees, Y-axis > 70 degrees, sensitivity of vibration > 4000 mV/G
[5]AccidentNode MCUAccelerometer sensorNot explained0–4 g = no accident; 5–20 g = mild accident; 21–40 g = medium accident; >40 g = severe accident
[18]AccidentArduino UnoAccelerometer sensor (ADXL335), Limit SwitchNormal
(xy plane)
Not explained
[17]AccidentArduino UnoAccelerometer sensor (ADXL335)Normal
(xy plane)
Whenever the value along any of the axes exceeds 3092, which corresponds to 30 g of force, the system detects an accident.
[4]Accident and Emergency brakingArduino UnoAccelerometer sensor (ADXL335), mercury switchNormal
(xy plane)
Rolling threshold values for normal driving = 0–10, for medium rolling = 11–20, excessive rolling > 20. A HIGH to LOW transition in interrupt pin indicates a hard break during vehicle driving.
Table 2. Summary of data acquisitions.
Table 2. Summary of data acquisitions.
NoEvent TypeConditionsNumber of Data
1Engine idleEngine on. Vehicle parked.2
2Regular brakingCruising speed at 50–60 km/h11
3Emergency brakingCruising speed at 10–40 km/h13
4Damaged roadWidth ≈ 40–100 cm. Depth ≈ 7–15 cm. Traversal speed < 20 km/h.16
5Speed bumpHeight ≈ 8–15 cm. Length ≈ 30–50 cm. Traversal speed < 20 km/h.16
Table 3. Execution time of LPF and moving average.
Table 3. Execution time of LPF and moving average.
No.Processing TypeConditionsExecution Time
OPi 5RPi Zero 2 W
1Butterworth LPF2nd order289 µs2.96 ms
5th order322 µs3.5 ms
10th order1.77 ms3.85 ms
20th order2.5 ms6.31 ms
2Numpy’s moving avg.WL: 2519.6 µs225 µs
WL: 4022.6 µs235 µs
WL: 5224.6 µs223 µs
WL: 7528.9 µs283 µs
WL: 10032.2 µs266 µs
3Bottleneck’s moving avg.WL: 251.79 µs14.4 µs
WL: 401.77 µs14.2 µs
WL: 521.76 µs13.9 µs
WL: 751.74 µs13.5 µs
WL: 1001.72 µs13.0 µs
Table 4. Execution time of moving average on ESP-32 microcontroller.
Table 4. Execution time of moving average on ESP-32 microcontroller.
No.Processing TypeConditionsExecution Time
1RunningAverageWL: 25533 µs
WL: 40534 µs
WL: 52535 µs
WL: 75536 µs
WL: 100536 µs
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Pranoto, H.; Wahab, A.; Yoppy, Y.; Sudrajat, M.I.; Mandaris, D.; Supono, I.; Ega, A.V.; Wijanarko, T.A.W.; Nugroho, H.W. Real-Time Vehicle Emergency Braking Detection with Moving Average Method Based on Accelerometer and Gyroscope Data. Vehicles 2025, 7, 106. https://doi.org/10.3390/vehicles7040106

AMA Style

Pranoto H, Wahab A, Yoppy Y, Sudrajat MI, Mandaris D, Supono I, Ega AV, Wijanarko TAW, Nugroho HW. Real-Time Vehicle Emergency Braking Detection with Moving Average Method Based on Accelerometer and Gyroscope Data. Vehicles. 2025; 7(4):106. https://doi.org/10.3390/vehicles7040106

Chicago/Turabian Style

Pranoto, Hadi, Abdi Wahab, Yoppy Yoppy, Muhammad Imam Sudrajat, Dwi Mandaris, Ihsan Supono, Adindra Vickar Ega, Tyas Ari Wahyu Wijanarko, and Hutomo Wahyu Nugroho. 2025. "Real-Time Vehicle Emergency Braking Detection with Moving Average Method Based on Accelerometer and Gyroscope Data" Vehicles 7, no. 4: 106. https://doi.org/10.3390/vehicles7040106

APA Style

Pranoto, H., Wahab, A., Yoppy, Y., Sudrajat, M. I., Mandaris, D., Supono, I., Ega, A. V., Wijanarko, T. A. W., & Nugroho, H. W. (2025). Real-Time Vehicle Emergency Braking Detection with Moving Average Method Based on Accelerometer and Gyroscope Data. Vehicles, 7(4), 106. https://doi.org/10.3390/vehicles7040106

Article Metrics

Back to TopTop