● Case study
BlackBox
A phone-based car black box: live telemetry, event detection and CSV export.
The idea
Turn any Android phone into a car "black box". Using the sensors every phone already carries - accelerometer, gyroscope and GPS - the app records a drive the way a dashcam or flight recorder would, then exports the raw data for analysis.
The interface borrows the feel of a modern car dashboard: a few large, glanceable cards, clear Start / Stop / Share buttons colour-coded for safety, and a red REC indicator so it's always obvious when data is being logged.
Features
- Live readouts: speed (km/h), longitudinal G-force and yaw rate.
- Performance summary: top speed, 0-100 and 100-0 km/h, distance.
- Automatic detection of hard braking, hard acceleration and turns.
- Full CSV log of every sample, shareable to any app.
- Runtime location permission handled inline on Start.
- Dashboard-style UI with cards, a pulsing REC dot and animations.
How it works
The app fuses three data sources. Android's SensorManager streams linear acceleration (converted from m/s² to g for readability) and the gyroscope's yaw rate; Google's Fused Location Provider gives speed, position and distance.
Events are flagged with thresholds plus a short dwell time, so a single noisy spike doesn't trigger a false positive - for example, braking harder than −3 m/s² held for 300 ms.
timestamp,lat,lon,speed_kmh,g_long,yaw,distance_m,event 1731612000123,46.2044,6.1432,52.3,-0.34,0.08,812.0, 1731612000345,46.2044,6.1432,41.1,-3.20,0.05,815.0,BRAKE 1731612000720,46.2045,6.1433,0.0,0.02,0.61,815.0,TURN_Droite
Every sample is appended to a CSV; events (BRAKE, ACCEL, TURN) are tagged inline, ready for Excel or Python.
A look at the app
Where these sensors are used
The same signals power real safety systems: a sudden negative G is how phones and cars detect crashes and fire airbags or emergency calls; yaw-rate sensors feed ESP / stability control to catch skids; and GPS combined with acceleration profiles drives fleet management and usage-based insurance.
Results
A working, self-contained Android app. Recording, event tagging and CSV export all run end to end, ready to open in Excel or Python. The 0-100 and 100-0 timings are GPS approximations rather than lab figures, and the detection thresholds are tuned by hand - honest trade-offs for a learning project.