Cost-E ffective Vehicle Monitoring System for Detecting Unacceptable Driver Behaviors on Road

— Number of subscribers for private vehicle monitoring is increasing worldwide, especially in the developing countries because of the rapid growth of private cars and appointed drivers. GPS based car location and speed monitoring offers only a narrow window to observe the driver behavior on the road. Installation of cameras and other expensive sensors might not be feasible for all users and the collected data size will increase tremendously. To monitor the driving pattern of the drivers in the absence of the owner, we propose a cost-effective solution that is easily implementable with the help a smartphone or a cheap dedicated device with appreciable accuracy and versatile features. Application of an accelerometer sensor, together with the GPS module, provides the means to identify rough driving which includes hard brakes, fast accelerations, sharp turnings, over speeding on the roads. Besides these, the proposed algorithm also can identify reckless lane change, frequent acceleration-deceleration, crossing speed bumps without slowing down and especially unauthorized carriage of people or goods when the owner is not present. With supplementary sensors at a very little increase in cost, the proposed method can also be extended to monitor other concerns as like the proper use of indicators while turning, unnecessary use of air conditioning by wasting fuel and maintaining the right gear while driving etc.


INTRODUCTION
In recent years, the number of private cars and their drivers have seen a tremendous increase, especially in the developing countries. As a result, car related incidents also increased which in most of the cases is because of reckless driving on the highways. Because of car owners' tendency to appoint drivers instead of driving themselves, remote monitoring of car's condition and driver's behavior is therefore a muchneeded service in developing countries where drivers are easily found. However, with the availability of cheap drivers, their unethical behavior has become very common now-adays. Recently, the incident of drivers picking up unauthorized passengers without the car-owner knowledge is concerning everyone, especially who need their private cars to move about the city for picking and dropping family members at different destinations throughout the day. Another concern of the car-owners is whether the driver is driving safely and economically. Reckless lane change, frequent acceleration-deceleration and crossing road bumps without slowing down could end up in a fatal accident that will cost not only life but also take economic toll. Therefore, the research field of vehicle and driver behavior monitoring is certainly not a new one.
There is quite a number of researches and studies relating to this field. While a portion of these works use in-vehicle sensors or external hardware and sensors, the other portion uses latest smartphone sensors. Most of the earlier works and some of the new works in this field falls on the first category. Ferreria et al. [1], in their paper, gathered driving data from 70 drivers using Driver Monitoring System to explore the effects of journey characteristics on driver behavior. Husni et al. [2] proposed a system to predict car's maintenance necessities and monitor car's functions using IoT. They claim that their system will increase car's efficiency and reduce fuel consumption. In [3], Wu et al. used motion sensor data and physical models to develop a novel driver behavior identification system. Howlett et al. investigated the feasibility of using Neural Network analysis on the time varying voltage wave form created from spark plug to perform fault diagnosis on engines [4]. All of them either used built-in sensors or installed dedicated devices for data collection.
In [5] by Mohan et al., they presented Nericell, a system to monitor traffic conditions and road conditions using smartphone sensing components like microphone, accelerometer, GPS sensor, GSM radio etc. Singh et al. [10] also use smartphone inbuilt sensors to detect driving behavior. In [6], Fazeen et al. used inbuilt accelerometers to asses driver behavior and road conditions. They used a highpass filter to filter the sensor readings and set thresholds for different driving incidents like acceleration, lane changing etc. Gazali et al. proposed a system to detect vehicle overtaking resulting in inconsistent driver behavior using  [7]. In the work by Johnson et al. [8], they presented MIROAD, a system to detect different driving incidents. They used sensor fusion based on smartphone and Dynamic Time Warping method. In [11], Dai et al. compares driver's driving patterns collected using smartphone sensors with typical patterns of drunk driving for early detection of possible drunk driving. You et al. [12] present Carsafe, a driver safety Android application that uses machine Learning algorithms along with computer vision to detect drowsiness in drivers. The app uses phones front camera to detect if driver is distracted or drowsy and back camera to monitor road condition. In [13], Chen et al. propose a system to identify abnormal driving in real time with high accuracy. They studied six types of behaviors in driving, namely Swerving, Weaving, Fast U-turn, Sides lipping, Sudden braking and Wide turning, to recognize their unique patterns and applied to detect abnormal driving.
A significant portion of related works in this field use camera footage to assess road condition and driver's condition. In [14], Li et al. uses deep Neural Network on data from inertial sensing components and camera videos to detect unusual driving maneuvers. Jo et al. [15] proposed a system to assess driver's drowsiness and distraction using video camera footage. Their system performs drowsiness detection when driver is looking ahead and distraction detection when driver is looking elsewhere. However, the trade-off is between employing cost-effective apparatus and the accuracy detail of the driving pattern detection. Specially, in the case of camera-based methods where either a smartphone or a separate camera hangs in front of the driver, facing toward him can cause driver discomfort. Besides incorporation of more sensors not only increase the installation cost but also make the data bulky for real-time processing. Especially for multi-sensor application, variety of data need lots of processing although the result is more reliable and accurate.
To address these concerns, this paper proposes a system to remotely monitor car's conditions like, the number of passengers in the car, and driving behavior of driver, like, frequent lane-changing, hard braking, fast acceleration etc with the application of least of sensors i.e. accelerometer sensor combined with GPS module. The novelty of this work is to maximize the utility of accelerometer and GPS data to fully use it in versatile applications by extracting the embedded information which might not surface without proper processing. For the preliminary study purposes, we used smartphones with built-in accelerometer and GPS sensors since it will be carried by the driver himself thus eliminating any installation charge. However, we can easily convert the system to make a dedicated device with in a very little cost that can be installed in the vehicle to collect and transmit the data to the server continuously.
The rest of the paper is organized as follows. Theory behind the proposed method is explained in section II. Materials and methods used for the study is described in details in III. Results of the experiments are presented in section IV. Finally, concluding remarks with the future direction are given in section V. For proper interpretation of the collected data, the device must be aligned with the car's axes of co-ordinates. As shown in Fig. 1 (a), a smartphone is placed on the dashboard of the car so that the lateral (side to side), longitudinal (back to front) and remaining upward (bottom to top) directions can be defined as the x, y and z-axis, respectively. The accelerations in these three directions are recorded as a time-series data and different incidents on the road can be identified from the analysis of these data (see Fig. 1 (b)) given that the directions were maintained throughout the data collection time. The GPS data will provide the locations of the incidents.

B. x-axis data analysis: sharp turns and lane changes
The x-axis data represents the acceleration along the lateral direction of the car (see Fig. 1(a)). Acceleration in this direction stems from couple of reasons. Firstly, the excessive centrifugal force due to sharp turns at road-bends gives a high acceleration value. Left turn or right turn can be identified from the polarity of the data about the zero line. The centrifugal acceleration, is quantified as (1) Here, v is the velocity, r is the radius of curvature and g is the acceleration due to gravity. Thus, both the velocity and the radius of curvature contributes to this acceleration. The maximum velocity for turning thus can be fixed at a given place if we set a threshold for maximum value of .
The radius of curvature can be estimated from the GPS data (latitude and longitude converted in Cartesian coordinates) which helps us to set the maximum allowable velocity (in order to define a sharp turn as a function of curvature) while taking a turn. If we have three consecutive latitudes, and corresponding longitudes, , the radius of curvature, r of the turn can be calculated as (2) Where the parameters g, f and c are calculated form the following matrix inversion to solve the equation of a circle (3) Another source of centrifugal acceleration is the sharp/frequent lane changes while driving at a very high speed. Here too the polarity gives the direction of change (from left lane to right or vice versa). However, the lane change is reflected as a slow variation in the baseline of the acceleration data (see x-axis data in Fig. 1(b)) compared to the sharp turns.
The high frequency vibratory noise in x-axis data is due to the unevenness of the road surface which can be eliminated before data analysis by wavelet filtering. The trend line then becomes visible and lane change/sharp turns detection can be performed with higher accuracy.

C. y-axis data analysis: hard brakes and fast accelerations
Data from y-axis can be analyzed for detecting hard brake or fast accelerations and also their frequency. Specially at the intersections or jam prone areas this sudden speeding or braking could raise the probability of collisions. Fast acceleration/deceleration can be detected by checking whether the rate of change of y-axis acceleration, exceeded a predefined threshold, as In [16], this threshold is taken as 3m/s 2 for detecting hard brakes or fast acceleration. However, this could be subjective and depended on the traffic density-based risk factors. Not only the event of fast accelerations and hard brakes but also the frequency of it is registered in the proposed system because this reckless behavior increase the possibility of accident. In such situation, the driver can be warned automatically by the system or manually by the owner who will be notified beforehand.

D. z-axis data analysis: estimate of passenger count
Analysis of the z-axis data can offer versatile applications. Firstly, the crossing of any speed bump (due to speed breaker or raised manholes) induces damped oscillation in the car which is recorded in the z-axis acceleration data [17]. The amplitude of the acceleration depends on the speed at which the car hits the bump which can be verified by the GPS data-based speed calculation. Also, the time period of the decaying oscillation is proportional to the mass of the car (which includes the mass of the passenger as well). The time period of any spring mass system is defined by (5) Therefore, as estimate of the number of passengers can be made from the frequency analysis of the z-axis acceleration data after it hits a bump. Also, it can be verified whether the car crossed the bump with a proper speed as well from the speed data at the event of hitting a speed bump. This will ensure the durability of the car's suspension mechanism [18]. Before starting to analyze the acceleration data, in is required to remove the idle data points (where the car was stationary either for traffic signal or due to waiting at will). For that, we need to analyze the velocity of the car (see Fig. 2 (a)) and find the time instances where it was not moving. Thus, the time samples can easily be removed from the acceleration, GPS and velocity data as shown in Fig. 2 (b) to obtain spatial uniformity (see the reduction in number of total data samples).

E. GPS data analysis
We need to analyze the GPS data for identifying the turn locations as well to distinguish sharp lane changes from fast turns. To do so, three consecutive GPS latitudes and longitudes are to be analyzed taking the middle sample as the origin (by subtracting its values from other two samples) as shown in Fig. 3. For any right or left turn, the product of slope m1 and m2 will be negative since there will an adjacent quadrant change. Otherwise the product will be positive. This will give the location (along with time) where the car took a turn.

A. Data Collection
Data was collected using a HUAWEI Y6 Pro 2019 Smartphone with built-in GPS and accelerometer sensor. The GPS data was captured by 'GPS Logger' mobile application (developed by BasicAirData [http://www.basicairdata.eu]) and saved as a .txt file in the phone directory in which GPS based velocity is also provided by the application. The sampling frequency was 1Hz (maximum available resolution -'1 second interval') for GPS data collection.
The 3-axes accelerometer data was collected using 'Accelerometer' mobile application developed by 'Keuwlsoft' [https://www.keuwl.com/apps.html] with 50Hz sampling frequency in AC mode (alternating coupling) to eliminate DC offset due to phones position.
As for the vehicle, TOYOTA Corolla AXIO (1400 kilogram) was used driven by a domestic driver (38 years of age with 11 years of driving experience). To minimize frequent braking because of pedestrian interference, data was collected during night time in a residential area. The track was travelled twice, first with 'NORMAL' driving and later with 'AGGRESSIVE' driving. The device was placed on the dashboard fastened by adhesive tape. All the data files were saved in the smartphone and then transferred to a Laptop. MATLAB 2019b was used for offline data processing, analysis and interpreting the result (driver behavior).

B. Data Propressing
Before analyzing the acceleration data, we used (Debauches) wavelet filtering of order 5 with level 4 (see Fig.  4 for z-axis data denoising) in order to remove high frequency noise. Fig. 4(a) shows the raw data after removing the idle locations and 4(b) shows the signal after removal of the high frequency noise in the z-axis data. The remaining intrinsic noise was eliminated by thresholding (with 0.5m/s 2 ). Finally, the clean data is fed into different functions designed for specific purpose (see Fig. 5). Data from x-axis goes to a zero-crossing register for calculating the time interval between successive zero-crossing (see Fig. 5(a)) incident so that the duration of lane change and turning can be measured along with the acceleration value. Data from y-axis goes to a counter that records the number of occurrences of hard brakes and sharp acceleration based on [16] as shown in Fig. 5 (b). For this purpose, the time samples when the acceleration exceeds the threshold are represented as a delta spike with the magnitude representing the amount of excessive acceleration over the threshold (2m/s 2 ). The remaining z-axis data is fed to a peak detector function to calculate the time period of the damped oscillation and also the magnitude of it. Thus, the information about the time periods (T1, T2 and T3 as shown in Fig. 5 (c)) are extracted to obtain the mass of the car using Eq. (5).
The velocity of the car during the crossing of the speed bump or pot holes are readily available from the GPS based velocity data. The location of the speed bump can be registered based on a trigger function that detects high value of acceleration in the preprocessed z-axis data. Corresponding y-axis data can be utilized to assess whether the car was decelerating before hitting the bump (which would be the expected practice). Otherwise, we can record this reckless for future reference.  Fig. 6. Routes for collecting data. In the first trip, the driving was normal followed by an agreesive driving on the same road. Fig. 6 shows the route that was travelled for data collection. There were 7 turns to come back to the starting point (red dot) after driving normally, followed by another aggressive trip. Detection of turning events was verified by GPS data where the products of the slops in consecutive data points were negative. Otherwise, the occurring of a large acceleration along x-axis was contributed by sharp lane change.

A. Sharp turns and lane change identifications
It should be remembered that due to the unevenness of the road, the car can generate acceleration along x-axis however the duration will be very short which can be filtered out with the help of GPS data (sampled at 1sec interval). Duration for at least 2sec was considered to be regarded as the occurrence of a lane change or take turn. Table 1 shows the result of data analysis from both of the normal an aggressive driving. For every turn if the acceleration crossed the threshold limit, we marked it with a '√', otherwise with a '×' in Table I. In datafile, we scored the detection with a '1' or a '0', respectively, in order to calculate a percentage for numeric evaluation. Similarly, the count of sharp lane changes on the road segments in between two turns are recorded along with the total count for the whole trip in both driving style. From the result, it is evident that the percentage of sharp turns and lane changes are quite high in aggressive driving compared to the normal driving. Although the result will differ if the threshold values changed based on traffic condition and road quality.

B. Occurance of hard bakes and fast acceleration
Detection of hard brakes or fast accelerations is very straight forward. The time instances when the car exceeded the predefined thresholds are recorded with the amplitude of excessing acceleration over the limit. It is done to get a weighted score which will not only reflect the frequency of the occurrence but also the severity of them. Therefore, the score is given as 'average' excess acceleration with occurrence frequency. Score for the normal driving was found to be 0.2 with frequency of 2 while that for the aggressive driving was 0.45 with a frequency of 6.

C. Estimation of passenger count
Before estimating number of passengers from the time period of the oscillation of the car, we had to calibrate it for the specific car. Therefore, the fundamental frequency of the oscillation with the driver inside was calculated from the zaxis acceleration data. Then using Eq. (5) with the known value of time period, T and combined mass (car plus the driver), m we calculated the spring constant of the car's suspension. A theoretical line is then plotted as shown in Fig.  7 for an increment of mass by 55kg (average). To verify the theory, we then increased the number of passengers one at a time who had average weight of 56.6kg with standard deviation of 7.8kg. Each time the same speed bump was crossed maintaining the same velocity and the time period was calculated from the fundamental frequency. As seen from the figure, the practical time period matched the theoretical line with 0.8%. With the help of the time period ranges, number of passengers was estimated accurately. However, the accuracy will if the mean passenger weight does not lie in the vicinity of the average mass considered for deriving the calibration line.
It is to be remembered that the oscillation frequency does not depend on the velocity of the car while hitting a bump, however the amplitude of the acceleration depends on it. Therefore, by detecting the occurrence of a high value of acceleration along z-axis it can be easily determined whether the car driver detected the road bump in time and started to decelerate or ignored it completely with the help of y-axis data. In our study, we slowed down in front of the bump for both driving mode for the car's safety.

V. CONCLUSION AND FUTURE WORK
In this paper, we described a cost-effective system for car owners to monitor driver's driving behavior and car conditions remotely using least of sensor to reduce data size without compromising the accuracy. Our system can estimate the number of people inside the car in real time and assess driver's driving behavior by detecting lane changing and hard braking or fast acceleration incidents using accelerometer data from smartphones. The GPS data not only gives the velocity and the location of the car but also can distinguish between closely related events. Thus, we have utilized the information embedded in these two data to a greater extent. Our system is cost effective as no additional hardware or sensors are needed, and it has a high potential to be used in a wide scope of applications. Car owners can use our system to ensure their drivers are not picking up passengers without them knowing. They can also check if the driver is driving recklessly in the absence of the car owners. Industries and companies can use our system for efficient fleet management. Our system can be used to implement a large-scale system for automated traffic rule violation detection. We are now working on expanding the scope of driving behavior assessment by detecting if the driver is driving in the wrong side of the road. This will be included in our future work. For our future work, we will also include the estimation of fuel consumption by a vehicle which will encourage drivers to drive economically and save fuel thus provide a complete solution of this pressing concern.