Have you ever walked out your front door to the location where you thought you left your car and found that it is MISSING? Has my car been stolen? Has it been towed? Have I.... forgotten where I parked it?
Parking on the notoriously hazardous streets of Philadelphia, this happens to me a couple of times a month. Cars being towed without notice is a big problem here so having a map with the definitive location of where I left my car would be very helpful.
I have below display featured in my entryway. The left-side display is a modified version of my Simple Weather Display and the right side is the parking display.
Using a Tasker script and an ePaper display powered by a Raspberry Pi, I created a display that will show a map of where my car is that is automatically updated whenever I park.
(The location featured on the map is NOT the location of my house or car.)
The gif below has been shortened. The display actually takes quite a while to refresh, so the original video was full minute and forty-four seconds long.
How does this work?
Please note: This is not a plug-and-play project. The project is highly dependent on several things that may not work for you. Please don’t just copy my files and expect the project to work. Read and understand my outline and then create your own program using my work as a guide.
I have the location of my parked car stored in a Google Sheet. This location is automatically updated by my phone, whenever I disconnect from my car’s bluetooth unit.
The display is powered by a Raspberry Pi. A Python script pulls the coordinates from the sheet every ten minutes. If the location changes and the car is on the map, the display will update to show the map and the car’s dot. If the car is off the map, another display will be shown, showing that the car is off the map.
Getting the parked location
In order for this display to work well, the location of your car has to be fed automatically. I used a Tasker script, which I talk more about in a section below, but that script could probably be replicated using Apple’s Shortcuts. However, both of those are dependent on a device that has the automation running being the one who connects your phone to bluetooth. If you share a car, this may not be the case.
Another option that I explored was to have an extra Android phone in the glove compartment of the car at all times, transmitting the location to a service like OwnTracks or Life360. You wouldn’t have to use Google Sheets as a database -- you could use an API to directly get that information. This solution would require you to pay for a data plan for that device which could cost up to $30/month. I couldn’t find any dirt-cheap data plans and the convenience of knowing where my car is parked isn’t worth that much to me.
I use an Android automation app called Tasker to automatically update a Google Sheet with my location. My Tasker script is triggered whenever my phone disconnects from my car’s bluetooth. You may be able to replicate this with iPhone’s built-in Shortcuts app.
I am using a 7.5” red/black/white ePaper display from Waveshare. I highly recommend using the 7.5” or larger versions. If you don’t like the look of the red version, there is a yellow/black/white version as well.
Make sure you buy the version of the display with the HAT. This will allow you to plug your display directly into the Raspberry Pi. There are instructions for building your own, but I definitely don't know how to do that and you probably don't either.
The map image must be a png of exactly the resolution of the display that you are using. The resolution of my display is 880 x 528 pixels.
Getting the coordinates from the Google Sheet
I use the Google Sheet Python package to get the coordinates. It may be easier to have your coordinates stored somewhere else. I find it tricky to follow the quick set-up instructions right on my Pi through SSH, so I usually run through them on my desktop and then copy the token over. Don’t forget to install the packages on your Pi, too!
Convert coordinates to pixels on the map image
You will be receiving your car’s location in coordinates, but you need to define where the dot will show up on the display in pixels. In order to convert between the two, I wrote a script. It will need the input of the pixels and coordinates of two points as reference. I like to choose two intersections on opposite corners of the map image, so I can get the coordinates and pixel locations as correct as possible.
My friend Andrew helped me write a script for an earlier version of the project that used a map that was at an angle. His hard work was invaluable, even though I did not end up using that script.
Correcting the coordinates for accuracy
The streets in my neighborhood are really narrow, and the accuracy of the coordinates is usually somewhere around 15 feet. For aesthetic purposes, I wanted my dot to show up exactly in the middle of a street, and not on a sidewalk or a house.
I created a function that takes a list of all the roads in my neighborhood and finds the point on one of the roads that is closest to my car’s coordinates. Instead of manually copying and pasting a bunch of coordinates to define the roads, I used geojson.io to add the lines on top of the roads and my function is built to take in that geojson file.
It is important to note that every street inside of my map image was a straight line and my function is only built to handle geojson features that are lines defined by two points. If you have a street that has a turn, you will have to create two separate, straight line segments to represent the street.
Currently the display shows only the location of my house and the location of the car on top of the map image. In the future I would like it to show more information. I named all of the streets in my road network geojson file, so I could easily have the map display text that says "The car is parked on Main Street".
Some streets in my neighborhood are permit-only and I do not have a permit, so it would be helpful for the map to display:
The car is parked on Main Street
2 hr parking: Mon-Sat, 8am-10pm
I haven't been able to find an up-to-date list of the permit rules for the streets in my neighborhood, so it would probably take me a full weekend to bike around and record the rules. But this is something I might like to do in the future.