@@ -1,10 +1,10 @@
|
||||
# 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.
|
||||
A Raspberry Pi 3-based OBD-II, GPS, and dashcam system for my 2013 Toyota Yaris. It reads live
|
||||
vehicle data over USB, tracks position with a SIM868 GNSS/GSM HAT, logs everything locally, and
|
||||
serves a web UI over the car's own WiFi hotspot. The dashboard and pre-cached map work fully
|
||||
offline, while trip data and dashcam footage sync to a self-hosted remote server whenever an
|
||||
internet uplink is available.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
@@ -30,27 +30,38 @@ i have a dream
|
||||
|
||||
## Features
|
||||
|
||||
- 📊 **Live OBD-II data** (speed, RPM, DTC codes) over a cheap USB ELM327-compatible adapter
|
||||
- 📊 **Live OBD-II data** over a cheap USB ELM327-compatible adapter: speed, RPM, coolant
|
||||
temperature, fuel level, throttle position, MIL status, stored DTCs, and odometer when the ECU
|
||||
supports it. Includes automatic background reconnects, serialized queries, and clear
|
||||
adapter/ELM327/ECU diagnostics
|
||||
- 🛰️ **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)
|
||||
offline Leaflet map (pre-cached map tiles — no internet needed in the car). The module powers
|
||||
itself on through the HAT's GPIO PWRKEY wiring after a Pi power cycle
|
||||
- 📶 **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)
|
||||
with automatic switching back to home WiFi when it is available (`http://yaris.local` — no
|
||||
port number)
|
||||
- 🎥 **Dashcam file retrieval** — detects a USB dashcam automatically (any brand/folder layout,
|
||||
no hardcoded device path), copies its footage locally, verified against real hardware
|
||||
no hardcoded device path), mounts it read-only, and safely copies footage locally. Verified
|
||||
against a real 28GB/87-file import
|
||||
- ☁️ **Remote upload** — a self-hosted server (Flask + Postgres, `server/`) receives trip/GPS
|
||||
logs and dashcam footage over the internet (via Cloudflare Tunnel or a plain port-forward).
|
||||
Dashcam videos upload in resumable 40MB chunks (works around tunnel body-size limits and keeps
|
||||
the Pi's memory footprint flat regardless of file size); a UI toggle can pause dashcam uploads
|
||||
independently while trip logs keep syncing
|
||||
- 🗄️ Local SQLite trip logging, retried/synced to the remote server with automatic backoff
|
||||
- 🔌 Runs fully headless as a `systemd` service, autostarting on boot
|
||||
- 📡 **Optional cellular fallback** through the SIM868 for small trip-log uploads when normal
|
||||
WiFi/Ethernet is unavailable (dashcam video stays off cellular)
|
||||
- 🗄️ **Local-first SQLite logging** with retry-safe remote sync and automatic backoff
|
||||
- 🖥️ **Offline web UI** built with Flask, Jinja, Bootstrap 5, Socket.IO, Chart.js, and Leaflet,
|
||||
all served locally with a shared responsive page shell
|
||||
- 🔌 **Headless Pi deployment** as a self-restarting `systemd` service with a 10-second BCM2835
|
||||
hardware watchdog, verified across a real reboot
|
||||
|
||||
## Hardware
|
||||
|
||||
| Part | Notes |
|
||||
| --- | --- |
|
||||
| Raspberry Pi 3 Model B | Web UI host + hotspot |
|
||||
| Waveshare SIM868 HAT | GNSS (GPS) + GSM/GPRS, unused Bluetooth |
|
||||
| Raspberry Pi 3 Model B Rev 1.2 | Web UI host, logger, uploader, and WiFi hotspot |
|
||||
| Waveshare SIM868 HAT | GNSS (GPS) + optional GSM/GPRS uplink, 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 |
|
||||
@@ -67,22 +78,27 @@ 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/](./deploy)) and is reachable with no port number at `http://yaris.local` once the
|
||||
mDNS + port-redirect setup described in [PLAN.md](./PLAN.md) is installed.
|
||||
The app serves on `http://<host>:5000`. On the Pi it runs as a `systemd` service and is reachable
|
||||
with no port number at `http://yaris.local` after installing the mDNS and port-redirect setup.
|
||||
Deployment helpers for the app service, hotspot watcher, port redirect, and hardware watchdog are
|
||||
in [deploy/](./deploy); see [PLAN.md](./PLAN.md) for the complete Pi setup and hardware notes.
|
||||
|
||||
For the remote server (receives trip logs + dashcam uploads), see [server/README.md](./server/README.md).
|
||||
|
||||
## Project status
|
||||
|
||||
This project was revived after a couple of years on the shelf. The first 11 planned phases are
|
||||
done and the full pipeline — OBD/GPS logging, offline web UI, WiFi hotspot, dashcam retrieval, and
|
||||
remote upload — has been verified against real hardware end-to-end, including a full real dashcam
|
||||
import and upload run. A phone-relay upload feature was built and tested but ultimately removed:
|
||||
real-world testing showed it hit a fundamental phone-OS limitation (a browser page can't use WiFi
|
||||
and cellular simultaneously), so it couldn't actually deliver on its "upload from the road without
|
||||
the Pi's slow WiFi" goal — see [PLAN.md](./PLAN.md) for the full writeup. That capability is now
|
||||
planned as a native Android app (further down the roadmap) instead. Only the SIM868 cellular
|
||||
fallback (for uploading while out of WiFi range) remains untested (no SIM card available yet).
|
||||
Full phase-by-phase history and the current roadmap (dashcam/video file browsers, OBD hardening,
|
||||
power-loss resilience, trip history, alerts, and more) are in [PLAN.md](./PLAN.md).
|
||||
This project was revived after a couple of years on the shelf. Phases 1-13 and 15 are complete:
|
||||
real GNSS, hardened OBD support, offline maps/UI, automatic WiFi hotspot switching, local logging,
|
||||
dashcam import, resumable remote upload, deployment, and the shared UI foundation are implemented.
|
||||
The pipeline has been exercised on the real Pi and dashcam, including a complete 28GB import and
|
||||
remote upload. Actual OBD PID availability still needs the first in-car test.
|
||||
|
||||
Phase 14 is partially complete: the Pi's hardware watchdog is deployed and reboot-verified.
|
||||
Read-only-root storage hardening is deferred until persistent storage is moved off the SD root
|
||||
partition, and clean shutdown still needs delayed-power or ignition-sense hardware.
|
||||
|
||||
The browser-based phone relay was removed after real-world testing confirmed that mobile browsers
|
||||
cannot reliably use the Pi's WiFi and cellular data simultaneously. A native Android companion is
|
||||
planned later instead. The next roadmap work is the dashcam/local-video browsers, followed by trip
|
||||
history, Pi health, alerts, settings, and a final UI polish pass. Full phase history, verification
|
||||
notes, and current scope live in [PLAN.md](./PLAN.md).
|
||||
|
||||
Reference in New Issue
Block a user