Go Down

Topic: MPGuino MPG Gauge for fuel injected vehicles (Read 13383 times) previous topic - next topic

dcb

Sep 18, 2008, 05:01 am Last Edit: Sep 18, 2008, 05:43 am by dcb Reason: 1
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 [size=14]mpg gauge[/size] 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.

Syvwlch

Event scheduler... I want one!

Can it be broken off and packaged as a library for reuse elsewhere? Perhaps with those microsecond-related functions as well...
----------
Mathieu

dcb

#2
Sep 19, 2008, 08:17 am Last Edit: Sep 19, 2008, 08:28 am by dcb Reason: 1
re: library, I'm not arduino savvy enough, but help yourself to this implementation.  If you can add a function hook to the timer0_millis++ section that the library sets when it is loaded and then coordinate with the timer_0_clock_cycles parts and the appropriate registers then it is doable without using another timer.


FYI, just noticed 0012 was available and I tried loading it.  It looks like you can only get the mpguino code to fit with 0011 for now.  I really feel like I'm abusing the ide to be running so close to the size limit in 0011 anyway, was worried it might not fit in 0012.

Binary sketch size: 16772 bytes (of a 14336 byte maximum).  Is there any obvious things that have grown since 0011 that might be removable?  I struggle with the C.



Syvwlch

#3
Sep 19, 2008, 08:28 am Last Edit: Sep 19, 2008, 08:30 am by Syvwlch Reason: 1
All I know is the list in the announcement in the forum contains some things that are acknowledged to increase sketch sizes.

I'll take a dive in your code and see if I can steal the event scheduler et al. Thanks again!
----------
Mathieu

Digger450

Great work on this project Dave!  Any update on the kit from Spiff?

dcb

#5
Sep 22, 2008, 02:07 pm Last Edit: Sep 22, 2008, 02:11 pm by dcb Reason: 1
Thanks Dig,

re: spif, haven't heard.  I've raised a little scratch from selling a couple prototypes so I'm working on a kit/pre-fab deal to help fund the project directly (and keep more folks from getting in over their head on the DIY).

bill2009

very nice - seriously.

but I did grin when I saw the chip with its legs in the air.  

retrolefty

Nice project, ugly construction, but if it works that's what counts  ;D

Thanks for sharing.

Lefty


koyaanisqatsi

Very nice!  I like automotive projects, esp ones that do efficiency stuff.

Just curious though, why is the input being taken from the injector pulses rather than measuring the flow of fuel on the gas line?  I know some cars have a bypass fuel system, but that could be handled pretty easily.
What about elevensies? Luncheon? Afternoon tea? Dinner? Supper?

retrolefty

Quote
Very nice!  I like automotive projects, esp ones that do efficiency stuff.

Just curious though, why is the input being taken from the injector pulses rather than measuring the flow of fuel on the gas line?  I know some cars have a bypass fuel system, but that could be handled pretty easily.


Not my project of course but if fuel consumption can be determined by the duty cycle of a fuel injector as shown that has to be a whole lot cheaper, simpler and more reliable then any kind of flow meter. Once the initial calibration constant values are known, it's a simple digital input pulse timing routine.

Lefty

dcb

"ugly construction"

LOL, well I'm a get it working first kinda guy,  no fair critiquing prototype construction ;)

I have learned a few things since then though:




DMerriman

I've reworked the MPGuino (MPGduino?) a little by separating the display from the "logic" -- the display board can now be mounted separately from the Arduino-side stuff, which should make for smaller and neater installation. Also, I've added a small 2x2 jumper to allow for easier selection of backlight polarity. Finally, I've added a photocell and resistor that can be used to automagically dim the backlight at night, in bad weather, or whenever the interior of the vehicle is "dark" to help preserve night vision or keep the display from being a nuisance/distraction.
Schematics and board layouts on my blog: http://sites.google.com/site/adifferentlemming/Home/projects/arduino

Scott S.

I was reading my April 2009 copy of IEEE Spectrum (My first, I only recently bothered to pay for membership) and I noticed an article about the MPGuino, so I thought it proper enough to bump it to the top.

It is on page 20, and also online at:
http://www.spectrum.ieee.org/apr09/8370

Cheers.
- Scott

designer2k2

Nice  :)

i will take the code pieces displaying the numbers on the LCD, that looks nice  8-)
http://www.designer2k2.at

YacMan1

hey im a do it yourself kinda guy and was wondering if someone could help me out on this project by making a parts list of everything i need to get this thing created. my brother is a programmer so im not real concerned with that so much as that parts i need and how many. if anyone could help out it would be greatly appreciated. h3r31am0n7h3r0ad@gmail.com
thanks
-YacMan

Go Up