Pages: [1] 2   Go Down
Author Topic: MPGuino MPG Gauge for fuel injected vehicles  (Read 12173 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
God Member
*****
Karma: 1
Posts: 513
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley ):




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.
« Last Edit: September 17, 2008, 10:43:18 pm by dcb » Logged

New Jersey
Offline Offline
Full Member
***
Karma: 0
Posts: 193
Ard at work
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

----------
Mathieu

0
Offline Offline
God Member
*****
Karma: 1
Posts: 513
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


« Last Edit: September 19, 2008, 01:28:32 am by dcb » Logged

New Jersey
Offline Offline
Full Member
***
Karma: 0
Posts: 193
Ard at work
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
« Last Edit: September 19, 2008, 01:30:02 am by Syvwlch » Logged

----------
Mathieu

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
God Member
*****
Karma: 1
Posts: 513
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
« Last Edit: September 22, 2008, 07:11:22 am by dcb » Logged

ottawa, canada
Offline Offline
God Member
*****
Karma: 6
Posts: 990
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

very nice - seriously.

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

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Thanks for sharing.

Lefty

Logged

Atascadero, CA
Offline Offline
Sr. Member
****
Karma: 2
Posts: 468
Arduino addict
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

What about elevensies? Luncheon? Afternoon tea? Dinner? Supper?

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
God Member
*****
Karma: 1
Posts: 513
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"ugly construction"

LOL, well I'm a get it working first kinda guy,  no fair critiquing prototype construction smiley-wink

I have learned a few things since then though:



Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Massachusetts
Offline Offline
Full Member
***
Karma: 0
Posts: 113
Electrical Engineers Rule the World.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

- Scott

Austria
Offline Offline
Sr. Member
****
Karma: 3
Posts: 260
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice  smiley

i will take the code pieces displaying the numbers on the LCD, that looks nice  8-)
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1] 2   Go Up
Jump to: