● Case study

BlackBox

A phone-based car black box: live telemetry, event detection and CSV export.

Year2025
RoleSolo build
ContextSéminaire de programmation · UNIGE
StackKotlin · Jetpack Compose · Material 3 · Sensors · GPS

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

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.

Recording screen detail: speed, G-force and rotation read live from the sensors
Recording: speed, G-force and rotation read live from the sensors.
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

BlackBox idle screen
Idle - performance summary and Start.
BlackBox recording screen
Recording - live speed, G-force and yaw.
BlackBox CSV share sheet
Exporting the CSV to mail, cloud or messaging.

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.