I think this is working well enough to call it a creation, so say hello to the MPGuino, part of the opengauge.org efforts for improving energy monitoring.
It has numerous screens that display instant/current trip data simultaneously, or instant/tank data, or jumbo mpg numbers for instant/current/tank, or more detailed tank and current trip data. It is proving to be extremely precise at tracking fuel usage and distance (knock on wood)
There has been quite a lot of input/testing/patience from many people on it that made this possible, and I have to send lots of love to the folks at arduino for making it so easy to get started in microprocessors and to everyone for all their examples that they share.
There are some pretty cool/advanced concepts in the code, sorry it isn't better documented at the moment. But some of the highlights:
Event scheduler: predefine your event functions and schedule the next time they should be called (in milliseconds), very useful for debouncing in an interrupt scheme, and anytime you want to schedule some work.
microseconds and elapsedmicroseconds: functions to get the "current" time in microseconds and to determine the elapsed time in microseconds, not exact microseconds mind you but a couple orders of magnitude more precisely than milliseconds. This arrangement also allows you to time just about any number of events simultaneously regardless of how many timers are on the chip.
*note: these functions required the use of a custom ISR on timer 2, the code does not depend on timer1 or timer0 at all. I hope to add some music/tone functions on timer1 at some point and arduino is in charge of timer0
Arrays of function pointers
Class definitions of Objects
Namespaces
Interrupts for injectors, buttons, speed signal
EProm for storing setup values
Progmem to reduce ram usage
String formatting routines
64 bit math routines (standard ones didn't fit)
double digit display precision (except for bignums)
Button/Screen navigation
Value editor
Non consecutive LCD data pins.
CPU utilization and free ram monitor.
And the code is all "cut and paste" (been trying to keep it as simple as possible to get it loaded)
But of course, the coolest thing about it is that this is a real, genuine, useful mpg gauge that folks are already using to learn to drive more efficiently and save gas for whatever reasons you might have for wanting to do that.
The source is kept here:
http://opengauge.googlecode.com/svn/trunk/mpguino/mpguino.pde
Here are a couple installed in my car (you really just need one
):
Here is an arduino friendly wiring diagram: Please note that the lcd is upside down
Here is the very first one I built:
They can also be made from scratch for like $20 if you know what you are doing:
More info (installation, details, etc):
http://ecomodder.com/wiki/index.php/MPGuino
Thanks again,
Dave.