Car-logger - part 3
Overview
A self-hosted, real-time, inexpensive open source car tracker built with Raspberry Pi Zero W, Nextcloud, and optionally Home Assistant.

I’ve had a few earlier tries at car position logging, read those first if you’re interested: Car logger 2.
Background
Goal: logging and sharing location of my non-connected car, for practicality and fun.
Earlier tries was using a phone, but that had problems. No Android phone will switch back on if it runs out of power without manual intervention.
Prerequisites
I needed power from the car, but want it to cut off when the ignition is off. My 12 V outlets didn’t. So I used a fuse holder with outlet to accomplish this. To that I attached a 12 to 5 V converter.

Also I chose to go without any battery or UPS, so the Pi has to deal with unclean shutdown every time. For this I run the SD card read-only using rpi-readonly.
Hardware
I had little experience with Arduino at the time of start, but lots with Pi, so I used a Pi Zero. Mainly for it’s low power consumption.

I first tried Diymall-G-mouse-Glonass GPS dongle, but reception was very bad, so switched to BN-808-USB-GPS.
For uplink I used a cheap 3G USB modem Tolkien-Portable and a data-twin SIM card.
Backend
I started writing a backend in 2014, BigBrotherGPSweb, but didn’t get very far. Fortunately someone has filled my need. Nextcloud, a self-hosted dropbox alternative, has a plugin called PhoneTrack. It has nice features like public sharing, users, filters, etc. and use Openstreetmap. SSL for transport encryption.
For home automation I use Home Assistant, so I also wanted the data there as well.
Map in Nextcloud/PhoneTrack:

Status in Home Assistant:

Software
I found no premade solution to use wifi triangulation in python, so I wrote wifindme (available from pip, python 2 and 3). It can use Mozilla, radiocells.org or, with small changes, Google. Use what has best coverage where you need it.
For the actual reporting I wrote LocationReporter. It can use wifi triangulation, GPS or both. It will use wifi while the GPS is warming up, and when GPS fails. The results can be sent to both my backends.
Problems
- PhoneTrack could be easier to use on a phone.
Improvements
- The setup should be moved to the trunk, out of sight.
- I really should get a case and mount the parts properly.
- The Pi Zero has bluetooth, so I could fetch data from OBD and upload it. Unfortunately my cars OBD doesn’t supply very interesting info (no battery voltage, fuel consumption, fuel status).
- Should be enough to send data to either Nextcloud or Home Assistant, not both.
- A switch for private mode or you-don’t-have-to-post-every-ten-seconds mode could be nice.
- Radiocells.org let’s you download the data set for local use. Local wifi lookup is very fast, so this would make wifi triangulation faster, and less data used and leaked.
Conclusions
I’m happy with the results. It’s been running for months now without problems. And it’s good sharing our position real-time on long drives.