# Using mobile sensor data to encourage safer driving

[Grab](https://yomu.fyi/company/grab) · Laiyi Lin · Oct 25, 2022

**Type:** Problem & solution

## Summary

Dedicated vehicular inertial measurement units are prohibitively expensive to install across large fleets, while customer feedback lacks the coverage required to assess driving safety comprehensively. To monitor driver behavior at scale, Grab processes smartphone sensor data collected via a mobile telematics SDK at high sampling frequencies. A custom orientation algorithm calculates Euler roll and pitch angles from gravity and resolves yaw through principal component analysis to align phone measurements with vehicle axes. The pipeline applies low-pass or Kalman filtering to handle varying noise levels, followed by threshold peak-finding algorithms to detect harsh acceleration, braking, and cornering. Speeding events are identified by comparing GPS speeds against known map limits or aggregated speed profiles derived from free-flowing traffic.

## Context

Installing dedicated vehicular inertial measurement units across all driver and delivery partners is prohibitively expensive, while customer feedback provides low-frequency and incomplete coverage of driving behaviour.

## Approach / What changed

Grab collects mobile sensor data via a telematics SDK, aligns phone coordinates to the vehicle using Euler angles and principal component analysis, filters sensor noise, and applies thresholding algorithms to detect unsafe acceleration, braking, cornering, and speeding.

## Takeaways

- Phone sensor coordinates are aligned with vehicle orientation by computing roll and pitch from gravitational acceleration and determining yaw through principal component analysis.
- Sensor noise is handled adaptively using low-pass filters for clean data and Kalman filters or variational decomposition for high-noise signals such as motorcycle rides.
- Speed profiles correct for sampling bias by reweighting fixed-interval GPS ping counts with speed values and filtering for free-flowing traffic where speeds exceed the median.

**Tags:** [Data Pipelines](https://yomu.fyi/topic/data-pipelines), [Monitoring](https://yomu.fyi/topic/monitoring), [Scalability](https://yomu.fyi/topic/scalability)

[Read original post](https://engineering.grab.com/using-mobile-sensor-data-to-encourage-safer-driving)
