Inspiration

In motorsport, the gap between a crash and the flag that warns other drivers is measured in seconds, and every second matters. At the 2021 Azerbaijan GP, Lance Stroll crashed at high speed and the official Safety Car call came 37.7 s later. We wanted to know: if an AI watched every car's telemetry at once, how much earlier could it raise the flag? Our replay called that Safety Car at +5.0 s.

How we built it

Fast Flag runs on a replay of historical FastF1 data, streamed tick by tick (~4 Hz per car) so that every component only sees data up to the current moment, never the future.

  • Detection: physics-based detectors built on a reference racing line and speed profile per circuit. A big speed loss with no brake input means an impact; a car far below the expected speed means it has stopped.
  • AI: an IsolationForest anomaly model flags unusual driving, and a risk model estimates each car's chance of an incident.
  • Race control engine: per-sector and track-wide flag state machines that recommend yellow, double yellow, VSC, Safety Car or red flag, with hysteresis so flags never flicker.
  • Dashboard: a live pit-wall map with risk-coloured cars, an alert feed, and a strip comparing our flags to the official race control feed.
  • Hardware: a Python bridge drives an Arduino Uno marshal panel over USB serial: green and yellow LEDs for three track zones, Safety Car and red flag LEDs, and a buzzer on every escalation.

We measure each incident's lead time as

$$L = t_{\text{official}} - t_{\text{ours}}$$

On our holdout race, the 2026 Azerbaijan GP (run once, nothing tuned on it), we caught 7 of 10 incidents with 1 false alarm in 1.6 race hours, and recommended both Safety Cars earlier than the race control feed, median 44 s ahead.

Challenges we faced

  • No cheating with time: keeping every part strictly causal, and locking the holdout race away from all training code.
  • Rare events: crashes are a tiny fraction of the data, so we judged ourselves on false alarms per hour instead of accuracy.
  • Messy edge cases: replays that loop and seek, cars whose telemetry dies after a crash, and several marshal sectors sharing one physical zone.
  • Hardware limits: one Arduino, no WiFi, USB power only. We cut the LCD and servo, fixed a shared-resistor bug where only one LED would light, and added a handshake because the Uno resets whenever the serial port opens.
  • Two people, one night: we built in parallel against shared JSON contracts and a mock server, so each side could be tested before the other existed.

What we learned

  • A strong result is only believable with an honest benchmark, so a holdout race and clear wording mattered as much as the model.
  • Simple, explainable signals (like "lost 100 km/h without braking") often beat complex ones for safety decisions.
  • Defining contracts early lets a small team move fast without breaking each other's code.
  • Hardware humbles you: current limits, pin budgets and reset behaviour cost us more time than any model.

Built With

Share this project:

Updates

Submission history