In a moment (well, several hours) of extreme geekery I hooked up my GPS, my cell phone and a few hundred lines of software to my car to update my website with my current position and speed while I am on the road. If I am actually driving you’ll see a little map on the left showing where I am and how fast I’m going. If I’m not driving I hide the map.

Since I wasn’t able to watch myself drive around on the map I made it so that the data is all recorded into a database and then I wrote this to play back the data. It’s being played back at about 3x normal speed but the speedometer at the bottom is real data. Right now this plays back everything I’ve recorded. I’ll be changing it soon so I can pick start and end times to playback. It takes about 20 seconds to get going cause I was sitting in my driveway setting stuff up.

Pretty fun, huh?

And for the more curious among you, here’s how it all works:
As I’ve written before, I recently installed a Mac Mini in my car to play music. That’s the base of the system. Additional hardware is my Garmin eTrex Vista GPS, GPS data cable, my cell phone and a cell phone data cable.

The data path goes something like this:
GPS sends NMEA formatted updates every second to the Mac Mini over the data cable. gpsd receives the data from the GPS, parses it and makes it available to the rest of the system. My car controller software that I’ve written reads the latitude, longitude and speed from gpsd every second and uses the cell phone’s Internet connection to make a GET request to a special page on my website, passing along those three values. The page records the values in MySQL (database) along with a timestamp and then it writes the values out to a XML file on the filesystem. The map on this site is using the Google Maps API along with AJAX to request that XML file every second and update the displayed map.

Since I don’t want the cell phone dialed up all the time and I’d like to be able t turn off the mapping when i want to I added some new voice menu commands to my system. I can say “Connect To Internet” and the Mac will dial up and I can “Disconnect From Internet”

Future plans involve a dedicated GPS (with an external antenna) and a dedicated cell phone or data card. I’d prefer a data card but I would need a USB one, or a USB to PCMCIA adapter and I can’t find either. With that and an EVDO account my car will be online all the time and I’ll be able to add more stuff like streaming Internet radio stations and live webcam from the front of the car.

This project has really been a blast. I can just keep adding to it and there’s all kinds of unique problems to solve to get things going. I’m having a lot of fun.

Leave a Reply

Your email address will not be published.