The Truckputer Project

 

Engine data being displayed live on an iPhone.

 

I had been running a ScanGauge II in my truck for several years, but decided I wanted some features that it didn’t provide. It could only display 4 fields of data at once. Using a phone or tablet I knew it could display more information and have additional features, such as auto-brightness, high resolution color, and touchscreen functionality.

I’ve developed software that runs on a Raspberry Pi that pulls live data from the truck via an OBD-II Bluetooth reader and allows any wifi capable device to load a webpage which shows that data. At the same time all of this data, along with current GPS data from my Garmin GPS III+, is logged to a database for later analysis. My goal is to display this information the way that Strava displays workout data on a map. This will allow me to create a visualization of things such as engine coolant temperature in relation to a mountain pass climb/descent.

Design decisions

I searched for a full featured OBD-II software library. OBD-II has been around since 1996 and I knew there was support for it in just about any programming language. One of the most full featured and stable libraries I came across was python-OBD. I hadn’t worked with Python before so I learned it and wrote a script that watches for the truck to start then begins putting data into memcached and PostgreSQL.

I decided I didn’t want to write a native iPhone application. This was development overhead I didn’t need and I wanted the data to be viewed by anything with a web browser, including Android phones or tablets. This also makes testing and debugging easier from the web browser on my development machine or a laptop. So I wrote a simple olde timey AJAX based web page that polls for new data. The Tomcat web server is running on the Raspberry Pi. I wrote a servlet that keeps reading the values out of memcached and serves them as a small JSON file to the web browser.

It may seem a bit heavy handed to replace a simple OBD-II tool like the ScanGauge II with a smartphone, wifi, and a Java web server, but the flexibility and powerful features that come with this technology stack are worth it to me.

If you’d like to talk about how I could help you with your own business or home projects please send me an email.