Mathieu MoranandCopilot 975526667e Optimize backlog upload speed for tracking rows
The upload loop previously always slept the full 30s UPLOAD_INTERVAL
between batches, even when a full batch was just sent (meaning more
rows were likely still queued). With GPS/OBD rows logged every 5s
locally, an offline/stale device could build up a large backlog that
took a very long time to drain at 100 rows/30s.

- Bump TRACKING_BATCH_SIZE 100 -> 500 (cuts round-trips per backlog).
- Only sleep the full UPLOAD_INTERVAL once actually caught up (a
  short batch came back); while a full batch keeps coming back, drain
  back-to-back with a short CATCHUP_INTERVAL (1s) instead.
- server/app.py: add a sane MAX_TRACKING_BATCH_POINTS (5000) cap on
  the tracking/batch endpoint as a defensive guard against a runaway
  client, independent of the Pi's own batch size.

Verified against the real deployed server: a simulated 1250-row
backlog now drains in 3 batches (~0.35s server round-trip time) instead
of 13 batches spread across ~6.5 minutes of idle sleeping.

Co-authored-by: Copilot <[email protected]>
2026-08-08 20:16:31 -04:00

yaris-obd 🚗📡

A Raspberry Pi 3-based OBD-II + GPS tracker for my 2013 Toyota Yaris — reads live vehicle data over USB, tracks position with a SIM868 GNSS/GSM HAT, and serves it all from a local web UI you can pull up on your phone by connecting to the car's own WiFi hotspot. Fully usable offline: no internet needed in the car, offline map tiles included. Also handles pulling dashcam footage off a USB dashcam for local/remote backup.

rené lévesque bangers i have a dream

Listen on Spotify

Screenshot

UI

Features

  • 📊 Live OBD-II data (speed, RPM, DTC codes) over a cheap USB ELM327-compatible adapter
  • 🛰️ Real GPS tracking via a Waveshare SIM868 GNSS/GSM/Bluetooth HAT, plotted live on an offline Leaflet map (pre-cached map tiles — no internet needed in the car)
  • 📶 Self-hosted WiFi hotspot so you can load the web UI on your phone from inside the car, with automatic fallback to your home WiFi when in range (http://yaris.local — no port number)
  • 🎥 Dashcam file retrieval — detects a USB dashcam automatically (any brand/folder layout, no hardcoded device path) and copies its footage locally
  • 🗄️ Local SQLite trip logging, with an optional MongoDB remote sync path
  • 🔌 Runs fully headless as a systemd service, autostarting on boot

Hardware

Part Notes
Raspberry Pi 3 Model B Web UI host + hotspot
Waveshare SIM868 HAT GNSS (GPS) + GSM/GPRS, unused Bluetooth
USB OBD-II adapter PL2303-based, ELM327-compatible (originally Bluetooth, switched to USB)
USB dashcam Any brand — detected as generic USB mass storage
2013 Toyota Yaris The patient

See PLAN.md for full hardware bring-up notes (SIM868 jumper/UART setup, antenna gotchas, etc.) and the detailed project history.

Getting started

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python3 app.py

The app serves on http://<host>:5000. On the Pi it also runs as a systemd service (see deploy/) and is reachable with no port number at http://yaris.local once the mDNS + port-redirect setup described in PLAN.md is installed.

Project status

This project was revived after a couple of years on the shelf. Progress is tracked phase-by-phase in PLAN.md — currently through Phase 8 (dashcam retrieval), with the remote server/upload phase still to come.

S
Description
rpi obd app with way less features... yet
Readme MIT
4.6 MiB
Languages
Python 43.5%
Kotlin 21.6%
HTML 15%
JavaScript 13.2%
Shell 5.1%
Other 1.5%