Hybrid Cloud GPS Tracking
Building a GPS tracking system for bikes and vehicles that keeps data local while still working anywhere.
After having a bike stolen from my garage, I decided to build a GPS tracking system. But I didn't want to pay a monthly subscription or depend on a third-party service that could disappear. The result is a hybrid approach — local-first with cloud fallback.
Requirements
- Real-time tracking when I need it (theft recovery)
- Trip logging for rides and road trips
- No monthly fees or subscription services
- Self-hosted data storage and visualization
- Long battery life for the bike tracker
- Works anywhere with cell coverage
The Hardware
For Bikes: LilyGo T-SIM7080G
A compact ESP32-based board with:
- GPS receiver
- LTE-M/NB-IoT cellular modem (uses a prepaid SIM)
- Solar charging capability
- Deep sleep mode for extended battery life
Total cost: ~$35 plus a prepaid data SIM (~$3/month for the tiny amount of data GPS pings require).
For Vehicles: Raspberry Pi + GPS HAT
The car has constant power, so battery life isn't a concern:
- Raspberry Pi Zero W
- Adafruit GPS HAT
- Powered via a USB adapter that switches off with the ignition
The Software Stack
On-Device
The bike tracker runs custom firmware that:
- Wakes up every 5 minutes during the day, checks GPS position
- If position changed significantly, sends an update via MQTT over LTE-M
- In "theft mode" (triggered via Home Assistant), wakes up every 30 seconds and streams location continuously
- Sleeps deeply at night to conserve battery
The Hybrid Architecture
This is where it gets interesting. Data flows through two paths:
Local path (primary): Device → MQTT → Home Assistant → InfluxDB → Grafana
- Works when I'm home and devices are on my local network
- Zero cloud dependency, zero latency, zero cost
Cloud path (fallback): Device → MQTT → Mosquitto broker (VPS) → Home Assistant
- A tiny $5/month VPS runs Mosquitto as a relay
- Only used when I need tracking away from home
- Data still flows back to my local InfluxDB for storage
OwnTracks Integration
For the phone-based tracking (useful for comparing my location with the bike's), I use OwnTracks configured to point at my local Mosquitto broker. It's a drop-in replacement for Google's location sharing, but self-hosted.
Mapping and Visualization
All GPS data lands in InfluxDB and gets visualized in Grafana with map panels. I can:
- View real-time location of all tracked devices on a map
- Replay historical trips with speed/elevation data
- Set up geofencing alerts (bike leaves the house → instant notification)
- Export GPX files for ride tracking
Results
Six months in:
- The bike tracker lasts about 2 weeks on a charge with solar supplementing
- Trip logging works flawlessly for both bikes and vehicles
- The geofencing alert triggered once when I forgot I lent my bike to a neighbor — working as designed
- Total ongoing cost: ~$8/month (SIM + VPS)
Takeaway
You don't need a $300 AirTag or a $15/month subscription service to track your stuff. With some off-the-shelf hardware and open-source software, you can build a tracking system that's more capable, more private, and cheaper in the long run. The hybrid local/cloud approach gives you the best of both worlds — privacy and reliability when at home, accessibility when you're not.