I wanted to keep track of fuel consumption (L/100km) for our two vehicles. I wanted to be able to send email to enter data, or use a simple web interface. The email part was important, because I don’t have a data plan on my cellphone, so being able to compose and queue an email at the pump, to have it sent automatically when I was later within reach of a known Wifi network, was a very nice to have.
Implemented in PHP, the result is not that pretty, but it’s nice enough, and the ease of use allows me to keep it updated without too much hassle.
Data entry takes a date (default to today), and distance-price-quantity, aka “KPL”: Kilometrage, Price, Liters.
The webpage has 4 simple text fields to enter those values, and an email just needs to contain the KPL in whitespace-separated format. The webpage has one form per car, and an email just needs to contain the name of the car anywhere in the email (subject or body): “corolla” or “highlander”.
The database is simple enough: date, car ID, KPL (3 fields), and an auto-filled (using MySQL triggers) consumption field. A simple cars domain table links the car ID to it’s user-readable model, make and year, used to display the reports.
Throw in some Google Chart Tools to display graphs, and some general statistics (average consumption, total mileage, total fuel bought (in $ and L), and you’re done!
A nice to have I added later on is a next_service table, which contains a car ID, and a mileage. When data is entered that makes the total mileage of a car reach the mileage indicated in that table, an email is sent to the car owner, to remind him that his next service is due. Not that the dealer won’t remind me anyway, but still…
Here’s what it looks like, for the recent Highlander Hybrid (bought April 2008), and the 2002 Corolla:
The code that makes this work will be open-sourced if anyone is interested.
Or if you’d like to simply use it yourself as-is, I can set you up on my server, no problem. Just poke me.