MPGuino started out as an impressive use of the Arduino platform to monitor a vehicle's fuel consumption or MPG (Miles per Gallon). One that will actually pay for itself too. A small group of folks banded together and created an open platform called http://tvkchaitanya.com where you will not really find much information concerning this device, but there are lots of information in a forum at http://www.ecomodder.com, where you will find tons of useful and fun ways on improving gas mileage for any car. To explain what these folks did for the average working Joe, who can't quite afford a car newer than 1995, is just amazing. It still works for just about any car with fuel injection, but for cars built before 1996, there is no OBD-II option.
Discussion thread for this page: Wiki talk page for MPGuino
Where to get preassembled units?
DSchmidt Technologies (User:JellyBeanDriver)
If the list is missing some seller, feel free to modify it.
Advisory: There is a known issue with some early 90s/late 80s vehicles with "peak and hold" injectors that we do not currently have a solution for. To see if you are impacted, the easiest way is to measure the ohmage of an injector. More details are here: http://ecomodder.com/forum/showthread.php/late-80s-early-90s-gm-tbi-advisory-6863.html
Advisory: Chrysler vehicles with returnless fuel supply systems will have MPGuino fuel economy figures that will be thrown off by an average of 3% from actual, on an otherwise properly calibrated MPGuino. This is currently unavoidable. Tweaking MPGuino fuel calibration on these vehicles will only minimize this error, but will not eliminate it. Ford (and presumably other vehicle manufacturers) returnless fuel supply systems do not have this problem. More information here: http://ecomodder.com/forum/showthread.php/advisory-chrysler-returnless-fuel-supply-systems-26165.html
Preassembled units are now available: http://opengauge.org/mpguino/ . Note: as of late april 2010, the preassembled version has a metric option.
If you are using the kit, refer to http://spiffie.org/kits/mpguino/assemble.shtml . Otherwise, follow the Schematics. Note: there are some significant delays being reported with the kit.
Or for the do-it-yourself type, here are the schematics. This should be enough for most of you. There are two assemblies that are possible to build. The Arduino or the IDuino.
- The only inputs are leads for the VSS and the injector, and a 12vdc supply. That is it.
- The Analog pins in this schematic show pins 0, 3, 4, and 5 are used as digital I/O, therefore, Analog pin 0 is Digital pin 14 then count up from there.
- After assembly, use the Mpguino_tests to verify your interface wiring.
Arduino Assembly Schematic
IDuino Assembly Schematic
Latest circuit diagram: http://opengauge.googlecode.com/svn/trunk/mpguino/mpguino.png
Identifying connections on your car
(generic instructions that should work with most vehicles)
unplug the injector lead(s) from the injector(s)
turn on the ignition but not the starter
select the/an injector plug (with the wires on it).
look for 12 volts on one of the plug leads.
use the lead that does NOT have 12 volts on it as the tap for the injector.
While tracking fuel consumption is most useful, and cars generally have speed and distance instrumentation already (speedometer/odometer), it is most convenient to identify a signal to use for tracking vehicle distance/speed. Unfortunately there isn't a generic way to do this. You have to locate a schematic for your vehicle and do some guessing and testing, or follow someone elses instructions who has already been there on your particular model. We are looking for a 0-12 volt signal here, and some cars might not even have a speed sensor stock or it may need some conditioning/amplifying before being used with the mpguino.
This should be always on, when the car is off or in run or start, always on. Use a voltmeter on the lead under off/run/start/accy if in doubt.
Table of Car Settings
If you have mpguino data for your car, add a line for it here (by year/make/model)
|Car Year Make Model||Engine||Transmission||VSS (count/mile)||usec/gal||Inj DelayuS||Notes|
|1987 Pontiac Fiero GT||2.8L||3 Spd Auto||4000||0251500000*||VSS at A10, Inj at D16|
|1994 Acura Integra GSR||1.8L DOHC||5 Spd Man||8189||0179214737|
|1995 Acura Integra LS 2DR||1.8L DOHC||5 Spd Man||8188||0201012289*|
|1997 Audi A6 Quattro||2.8L||Automatic||13406||128027612||72uS||1|
|1989 Chevy Celebrity||3.1L||4 spd auto||4002††||0251500000|
|1993 Chevy Suburban k1500 4x4||5.7L V8||Automatic||8000†††||0038823529*||*||2|
|1994 Chevy Astro Van||4.3L Vin 'Z'||4 Spd Auto||4002||0055314688*||3|
|1990 Chrysler Lebaron 4dr||3.0L (6G72)||Automatic||16250||27550990|
|2005 Dodge Magnum SXT||3.5L SOHC||Automatic||10000††††||125884406||5|
|1995 Dodge Neon Sport||2.0L SOHC||5 Spd Man||9926||0057442679||4|
|1993 Ford Escort||1.9L SOHC||5 Spd Man||15809*||0374855321*|
|1999 Ford Escort ZX2||2.0L ZETEC||5MT||15900||0266400000||6|
|1994 Ford Ranger||3.0L (Vulcan)||5 Spd Man||8000||233667407|
|1991 Geo Metro Xfi||1.0L||5 Spd Man||8231||0488554960|
|1992 Geo Metro||1.0L||5 Spd Man||8208*||0500000000*||*initial settings, will revise as appropriate|
|2000 GMC Sierra Extended Cab 4x4||5.3L V8||Automatic||8000||0108507850|
|2002 Honda Civic EX Coupe||1.7L||4 Spd Auto||8208||0272500000*||72us|
|1999 Honda Civic HX Coupe||1.6L||5 Spd manual||*||*|
|1995 Honda Civic DX Sedan||1.5L||5 Spd manual||8214||0199405064|
|1994 Honda Civic VX 49-state||1.5L lean burn||5 spd manual||8208||0279235000|
|1996 Honda civic LX 4dr||1.5L lean burn JDM DUAL VTEC||5 spd manual (VX)||8208||0262922450||*first calibration ** set revs2/ rpm to 1 for japanese (rpm's off by 1/2 @ stock position)|
|2007-8 Honda Fit||1.5L||Automatic||8295||0312000000|
|199X Jeep Wrangler**||4.0L I6||Manual||????||????|
|2006 Jeep Wrangler||4.0L I6||6 Sp Manual||16000*||*|
|1992 Mazda B2600i||2.6L||5 spd Man||8390||0208212230|
|2003 Mazda Protege5||2.0L||5 Spd Man||8203||0188390461|
|1995 Mazda Familia (Protege in US)||1.5L (Z5-DE)||5 Spd Man||8000*||0354882375*|
|1995 Mercedes E320 w/ASR||3.2L||4 Spd Auto||160000#||0147666000*||??us|
|1990 Mitsubishi Eclipse GST||2.0L||5 Spd Man||16364||126180393|
|1997 Nissan Primera||2.0L (SR20VE)||5 spd man||2486||Still fine tuning VSS but is within 0.18km of correct speed.|
|2003 Nissan Xterra XE||3.3L||Automatic||4100||179218375|
|1989 Pontiac 6000||2.8L||4 spd auto||8000||0251500000|
|1989 Pontiac Grand Prix||3.1L||4 spd auto||4000||TBD|
|1992 Plymouth Acclaim||3.0L (6G72)||3 Spd Auto||6000||?|
|1992 Pontiac Trans Sport||3.8L||4 Spd Auto||8005||0178435000|
|1992 Saturn SL1*||1.9L||5 spd man||10000||Vss Grn/wht d kik panel pos T|
|1993 Saturn SL2,SC2,SW2,S2*||1.9L||9800||0034611836|
|1995 Saturn SL2*||1.9L||5 Spd Man||27500||0175000000||Preliminary estimates based on known approximate values|
|1997 Saturn SL2,SC2,SW2,S2||1.9L||10000||0289967320|
|2005 Subaru Impreza Outback Sport, 2.5RS||2.5L N/A||5MT||8000||183165000*|
|1994 Suzuki Swift GA Sedan||1.3L SOHC||5 Spd Man||7880*||0468436463*|
|1990 Toyota Camry LE||2.0L (3S-FE)||Automatic||8396*||1584108048*|
|1993 Toyota Camry||3.0 V6||Automatic||8187*||0157633351*|
|1995 Toyota Camry LE||2.2 (5SFE)||Automatic||4000*||0258096273*||VSS Violet/Yellow, Location 2 Right Connector in ECM|
|1993 Toyota Tercel||1.5L (3E-E)||4 Spd Man||8208||0415667401|
|1998 Toyota Tercel||1.5L 5E-FE||5 spd manual||8204*||0308743446*|
|1990 Toyota Corolla DX||1.6L 4A-FE||3 Spd Auto||8226||0326980000||ECU 26P-12 (yellow): Fuel injector; ECU 16P-13 (violet/white): VSS|
|1994 Toyota Corolla DX||1.8L 7(A-FE)||4 Spd Auto||8208||0273600000*|
|2005 Toyota Corolla LE||1.8L||Automatic||8184||0225218193|
|1991-3† Toyota Previa||2.4L (2TZ-FE)||4 spd auto OD||7885*||0250463822*|
|1991 Volvo 240||2.3L (B230F)||5 spd manual||20000*||0274677364*||VSS is 20000 or 196000|
|1994 Ford Bronco||5.8L (351W)||E4OD||16003||142487047|
|Car Year Make Model||Engine||Transmission||VSS (count/mile)||usec/gal||Inj DelayuS||Notes|
(*)Calibration still under way.
(**)The infamous 1996 Jeep Wrangler was never produced. Jeep did not manufacture a Wrangler for that Model Year. It was cut off in 1995 and resumed in 1997. 1986-1995 Wrangler YJ's had Square Headlights, and in 1997, they went back to round headlights, if that helps the owner distinguish which model year they have.
(†)My reasearch shows all gen 1 Previas have the same VSS pulse but injectors may be different on supercharged models.
(††)Vehicle is getting pulses from cruise control circuit. 8000 PPM may be expected if tapping into speedometer circuit.
(†††)Vehicle is getting pulse from cruise control circuit tapped at the red/white wire that goes into the throttle servo box located fender side of the brake booster. This wire is post VSS buffering I believe.
(††††)VSS signal obtained with XSVI-6522-NAV Chrysler CAN interface car stereo adapter, which provides a navigation radio VSS signal of 10000 pulses per mile.
(#) Honest. This is the VSS output from the E-Gas module taken from Pin 2 of X2/4 (4-pole at passenger kickpanel). The Speedo's VSS has low voltage. You must have the VSS Debounce set to ZERO for this to work.
1. Audi (97 A6) speedometer has K=6703 on bezel. That's pulses per mile. MPGuino counts VSS both rising and falling = 13406. uSec per gallon is based on the fuel flow signal from the ECU. The latest uSec/Gal is based on 32 tanks of gas and is accurate within +/-1%.
2. Without Inj DelayuS info for these TBI injectors, accuracy is impossible as small changes here make a big difference. My estimated usec/gal based on instant mpg set to known mpg of 10.5mpg was 0022,000,000 but the calculated usec/gal for the 55# orange/black injectors is 0196,363,636.36
3. A lot of GM TBI engines use peak and hold injectors. All the Vin Z 4.3L trucks used peak and hold injectors in this year range so until a perfect solution is found they don't reliably read the fuel rate. for a list of known cars with peak and hold injectors see: http://ecomodder.com/forum/showthread.php/late-80s-early-90s-gm-tbi-advisory-6863.html For discussion on solutions see http://ecomodder.com/forum/showthread.php/gallons-per-hour-error-6841.html
4. Units are litres and kilometres - the 075m Metric version was used.
5. Chrysler returnless fuel supply systems will cause MPGuino fuel delivery calculations to be thrown off by an average of about 3%, on an otherwise perfectly calibrated unit. Chrysler owners with an MPGuino should calculate usec/gal figures that use a fuel pressure of 65 psig (448 kPa), which assumes a constant intake manifold vacuum of 7 psig - this should minimize any fuel economy calculation errors that result. More information here: http://ecomodder.com/forum/showthread.php/advisory-chrysler-returnless-fuel-supply-systems-26165.html
6. Ford (and presumably any other vehicle manufacturer besides Chrysler) returnless fuel pressure supply systems feature computer-controlled fuel pumps that vary fuel pressure according to intake manifold vacuum, just like an older engine-vacuum controlled mechanical fuel pressure regulator. The MPGuino should work fine with vehicles using this returnless fuel supply system.
Excel spreadsheet to figure microseconds/gallon from Lbs/hr or cc/min (thanks wagonman76) 
A little more detail on the Theory and a few more pics - Theory of Operation
Injector Selection Guide Calculator. If you know your engine's horsepower, and the number of injectors, it will give you a best guess 
Injector list with flow rates: 
Online repair manuals including electrical diagrams
VSS values for many models '86-'95 (Rostra Precision Controls)
VSS values for many models '96-'08 (Rostra Precision Controls)
Atmega328 Chip upgrade for Atmega168 mpguino users: 
Screens and Functions
| MG Instant MPG | S Instant Speed |
| GH Instant GPH | C Current MPG |
| IM Instant MPG | S Instant Speed |
| CM Current MPG | D Current Miles |
| IM Instant MPG | S Instant Speed |
| TM Tank MPG | D Tank Miles |
4. "BIG Instant":
| Instant MPG |
5. "BIG Current":
| Current MPG |
6. "BIG Tank:":
| Tank MPG |
| MH Current MPH | MG Current MPG |
| MI Current Miles | GA Current Gallons |
| MH Tank MPH | MG Tank MPG |
| MI Tank Miles | GA Tank Gallons |
9. "EOC mi/Idle gal":
| CE Current EOC Miles | G Current Idle Gallons |
| TE Tank EOC Miles | G Tank Idle Gallons |
10. "CPU Monitor":
| C% Max %CPU utilization | T Tank run time |
| Free Memory (bytes) |
Modifications for metric mode:
MG->LK (Miles Per Gallon -> Liters per 100KM)
GH->LH (Gallons Per Hour => Litres per Hour)
IM->IL (Instant MPG -> Instant L/100KM)
CM->CL (Current MPG -> Current L/100KM)
TM->TL (Tank MPG -> Tank L/100KM)
Big number screens:
MPG->L/K (MPG -> L/100KM)
MH->KH (Miles Per Hour -> KM per Hour)
MG->LK (Miles Per Gallon -> Liters per 100KM)
MI->KM (Miles -> KiloMeters)
GA-> L (Gallons -> Liters)
G-> L (Gallons -> Liters)
There is also a setup screen that displays the first time the program is run and by pressing all three buttons at once. It walks you through the following setup variables. Use left and right buttons to select the digit you wish to change or the OK or Cancel (XX) items. Use middle button to rotate the current digit or select OK or XX if that is where the cursor is. Selecting OK will save the currently displayed value to the current variable and advance to the next variable. Selecting XX will just advance to the next variable.
Contrast - This comes up first on a brand new run and changes on the screen are immediate so if you can't see anything try pressing middle button a few times.
VSS Pulses/Mile - use this to adjust displayed speed/miles. If the speed/miles displayed on the mpguino is low then decrease this number by the percentage that it is off and vice versa for high readings. Most asian cars will be a multiple of 8204 and GM will be 10000, we are hoping users will contribute model specific data here. (Note: Later versions of the code have a setting for VSS Debounce, default is 2 mSec. With high VSS values, this needs to be set to 1 or zero)
MicroSec/Gallon - use this to adjust displayed fuel consumption. You may want to readjust this initially to get a ballpark MPG reading (after VSS Pulses/Mile is deemed accurate), then calibrate it with a couple fillups. If the mpguino displayed MPG is high or the displayed tank gallons is low at fillup then reduce MicroSec/Gallon by the percentage that the gallons are low or the displayed mpg is high. Like the vss pulses, this would benefit from user contributions about what values work for what specific cars.
Pulses/2 revs - not currently used, but a single injector on a 4 cylinder sequential system will make 1 squirt in 2 revolutions. Hope to be able to base RPM on this at some point.
Timout(microSec) - defaults to 7 minutes. If there are no injector or speed signals from the car and no buttons are pressed in that time then the display backlight turns off. When activity resumes the display will turn back on and the current trip will reset and the tank trip will be restored to the point of last activity.
Tank Gal * 1000 - not currently used, but defaults to 13300 or 13.3 gallons.
Injector DelayuS - Represents the mechanical delay of the injector in microseconds. Advanced topic.
Current button assignments as follows,
left: cycle through screeens in reverse
middle: cycle through pre-defined brightness settings
right: cycle through screeens forward
left+middle: tank reset
right+middle: current reset
left+middle+right: go to setup screen
For Identifying where to tap into the fuel injector:
1. turn on the ignition, leave engine off.
2. Unplug an injector.
3. With a voltmeter, measure the voltage on each injector connection. One should be 12 volts and the other should be more like 0.
You will want to tap into the one that is at 0 volts.
For finding the VSS hookup, there are several approaches, but at the bottom of Technical Support is a tool that might help you identify the VSS wire location and color. Also here is another online source of ECU pinouts, I'm sure there are more: ECU Pin-out Diagrams :: Innovate Motorsports Application Notes
IMPORTANT, you must be very deliberate when hooking up the mpguino to your cars battery power. There have been several cases where people had to reflash their atmegas and it is noted in the datasheet that the flash memory can be corrupted if the power requirements are interrupted. So line up those pins and get it hooked up the first shot.
On my(user:dcb) saturn I tapped into an injector ground lead, and used ground and battery voltage and speedo (possibly vss) signal from the ecu plugs.
Will unplugging the ECU of my vehicle mess anything up?
No, granted you make sure you restore the original connections/plugs.
Do I need to disconnect the negative terminal of my battery before connecting the MPGuino to my vehicle?
It is generally a wise idea to do so when working with any vehicle wiring or power, as is the case with this project.
What if my LCD text is messed up or frozen?
First, try power cycling the unit. Unplug the power source, wait 20 seconds, then plug it back in. This wait period is important. If you plug it back in too soon you may freeze the bootloader in a loop and you will have to reload the program:  Copy and paste the code into the Arduino 0011 Alpha program which you can download from: , Then "upload to I/O board" on your MPGuino using a USB cable. The correct baud rate for upload is 19200, on the spiffie kit MPGuino.
"Make sure the jumper is correctly placed for the power source that you are using. You can also try simultaneously pressing the left and right buttons in order to reinitialize the LCD.
When connecting the injector lead to the MPGuino, do I need a signal from each injector?
No, you only need one injector signal. Make sure it is the 0V side of the injector that receives the ECU signal.
Can I use any LCD, or am I stuck with the one in the parts list?
You may use another LCD, but the connections and source may have to be changed in order for the LCD to function properly. It is best to stick with either the green LCD or the blue LCD. A number of users prefer the Green LCD as it has less glare in daylight, but others like the looks of the blue one. This red LCD has been used successfully.
What power source should I use for my MPGuino?
You should tap into battery. In other words, you don't want switched power (i.e., power that is only on when the key is turned). A couple of places to start would be the power and ground leads of the ECU or the non-switched power of your stereo head unit. Consult wiring diagrams or documentation for more details for your specific vehicle.
What are good starting values for VSS pulses per mile and injector uSeconds/gallon?
For the injector numbers, please look at this post. The injector number can be fine-tuned after comparing the gallons displayed on the MPGuino with the actual gallons used to fill up. Repeat for a few fillups to get a more accurate reading. Multiply or divide the usec/gallon by the factor you are off in order to fine-tune the number. For the VSS, start with a multiple of 8204 for foreign cars and 10000 for GM vehicles. In order to get a more exact number, you need to calibrate it based on a known distance and multiply (or divide) by the factor that you are off. Repeat until you are satisfied with the accuracy.
Why is analog pin 0 labeled as digital pin 14?
They are one in the same. digital pin 14 is analog 0, digital pin 15 is analog 1, and so on.
Can this be used on a carbureted engine?
mluckham's version - Canadian version for kilometers. Based on v0.75.
mluckham's version - Canadian version for kilometers. (v0.79 mluckham's fork)
mluckham's version - Canadian version for kilometers. (v0.80 mluckham's fork)
mluckham's version - Canadian version for kilometers. (v0.81 mluckham's fork)
mluckham's version - Canadian version for kilometers. (v0.82 mluckham's fork)
alin151's version - Canadian version, based on v0.86.
t vago's version - Has support for MAP based compensation for Chrysler Returnless Fuel Supply Systems and a bunch of other features (supports both metric and imperial units), feature list is extremely long. Copying and pasting code into arduino IDE 1.6.5 and uploading with the arduino IDE works without issue.
Feel free to add custom versions if you find.
Official SW Release notes
Development has ended for now. For list of "hacks", go to http://ecomodder.com/wiki/index.php/Code_hacks
Here are the latest release notes as of this writing. Get the latest SW from:
04/24/2010 updates for v0.86
1. Metric options, litres, km, l/100km
Setup is still in english for simplified table of car values, metric display is option at end of setup (left + right buttons), will convert values to metric at display time if metric=1.
Uses Litres/Kilometers, and consumption is in Liters/100KM
2. Added another decimal place to the big numbers (more useable in L/100km mode)
i.e. it can display X.XX or XX.X or XXX depending how large the number is.
1. upgraded to atmega328.
2. switched to npn backlight driver, driven from vehicle voltage through a 1 watt resistor rather than regulator.
3. tied in the analog vss and vcc to facilitate analog inputs.
4. added pads for all unused pins (except reset), now experimetors can easily get to rx, tx, aref, 2 analogs and 2 pwm pins.
5. Turned down brownout detection (we are not writing except at config)
6. Disabled self programming for stability.
7. CPU Utilization = 49.86%, Free Ram = 1189 bytes, Free Flash = 13920 bytes
06/06/2009 updates for v0.82
1. Running at 20mhz now (crystal change on prebuilt). CPU utilization down to %49.18 (from %60.13) and signal sensing should be %25 more accurate. 247 bytes free ram, 1996 bytes free flash.
2. Went back to thinner font on big numbers.
3. changed setup shortcut behavior. left+right will automatically advance to next setup value (like going to x and hitting middle).
06/06/2009 updates for v0.81
added InjTrg setup parameter. Set this to 1 if you need to change the trigger direction on injector pulse detection (i.e. if using audi/vw/tdi fuel consumption signal).
03/19/2009 updates for v0.80
No functional changes, but from .80 on there will be a mpguino.cpp file added to the repository. The .75 mpguino.pde file will remain for the arduino crowd, but needed to get away from the arduino framework to make more room with the existing hardware and try and solve some potential reliability issues for the preassembled units (now shipping with v.80) .
Changed programming method to isp (instead of bootloader) and using the following fuses after much experimentation: lock 0x2b , do not allow any spm commands from anywhere, should help prevent flash corruption. efuse 0x07 , change reset address to 0x00, min bootsize (just in case) hfuse 0xdd , 2.7v brownout detection, had lots of problems with 4.3v setting, i.e. unit resets when starting car. lfuse 0xef , maximum delay on power up.
2190 bytes free (yay, elbow room).
Note: I'm still using the gcc and avrdude that came with the arduino-0011 install.
02/02/2009 updates for v0.75
added the instant gph fix per fx57. See http://ecomodder.com/forum/showthread.php/instant-gph-jitter-fix-6861.html for details.
MAC USERS reflashing V0.75 with arduino 0011: If you get a sketch too big message, comment out( /*....*/ ) the section of code in this post: 
10/01/2008 updates for v0.74
added a small serial transmitter function. The guino now outputs the following data over the serial port at 9600 baud every half second: instantmpg,instantmph,instant.injHius,instant.injP ulses,instant.vssPulses
So "realtime" laptop/cellphone integration should be a snap if your guino has a usb/rs232 connection or you can build one and you can gather the data on the laptop/cellphone. This also has applications for remote displays.
I also added a #define usedefaults so that you can build the guino without a lcd if you intend to only use it with a laptop/cellphone. It will simply skip the setup screen/loading of eprom values.
Since all the interesting data is already going over the serial port now, I removed the debug ifdef branching.
9/20/2008 updates for v0.73
added large comment about only running on arduino 0011 to top of program
fixed strange instant bignum eoc display
added VSS Delay ms setup parm (default to 2, can set to 0 but distance accuracy may suffer)
added "move to next field" in editor, press left and right simultaneously to move to OK, XX, first digit.
replaced RPM with GPH on custom screen, more universal.
Updated eprom loader/saver. Keeps track of number of parameters in eprom so a new version can default new setup parameters.
updated addEvent to just call the event if time parameter is 0
9/10/2008 updates for v0.72
to get to setup, use left and right buttons now. No middle button there, so less accidental resetting of current or tank trip.
Added eoc miles/Idle gallons screen after tank data. Tracked for current and tank. Layout: Current EOC Miles, Current idle Gallons Tank EOC Miles, Tank idle Gallons
removed raw screens
default contrast set for green display 95
Default to metro values, 500000000 us/Gallon, 8208 vss pulses/mile, 3 pulses/2 revolutions
instantmpg returns 999999 in eoc now
used ishi's formatter, and jmilk's brightness suggestion to get it to fit.
sketch 14104 bytes, 303 bytes ram free, cpu %51
9/8/2008 updates for v0.71
1. Settled on 1/2 second average for vss. Metro is reasonably smooth now.
2. Added Custom screen as first screen with following layout. INSTANT MPG, MPH RPM, CURRENT MPG Tweak doDisplayCustom function to put different values if you like.
3. Added rpm (you have to get the pulses per 2 revolutions parm right)
4. Added instant gph function (not displayed by default)
Notes, instant mph is a small bit wobbly on the signal generator and rpm also seems to read a bit high. But it is definitely an improvement.
I also had to ifdef out tons of stuff when in debug mode just to get the Serial library to fit. So bignumbers and parameter editor won't work in debug mode as-is.
sketch size: 13814 bytes, free mem 325, CPU% 52.42. We are for all practical purposes at the limit without a major re-write or some serious optimization and retest work, or an atmega328, or?
8/9/2008 updates for v0.70
More experiments with vss processing. Instant mph is very smooth on saturn but still jumps a bit on the metro. Distance reading on metro appears reasonably accurate (102.6 miles on odo, 102.18 on mpguino using 8208 vsspulses/mile). So the guino is doing a pretty good job of counting the vss pulses, it is a little erratic in timing the pulses though.
want to add EOC miles to the trip next, don't know if it will fit sketch size: 12884
8/1/2008 updates for v0.69
Added event handler and added debouncing on vss. Still trying to clean up reed switch vss signal via software with no luck. will make separate post for vss issue.
Added instantaneous mph (mpg is next), this looks at the time between vss peaks to determine the speed instead of the number of pulses in the last half second, which was jumpy at slow speeds. We are getting really really tight on space. That might also be an issue when 0012 comes out (don't know when).
8/1/2008 updates for v0.68
Removed all dependencies on timer0 so we should be arduino 0012 compatible. This also establishes an ISR under our control for scheduling events. Disabled Timer0 so use millis2(), delay2(), etc.
Knocked off a few hundred bytes by converting LCD to a namespace instead of a class.
7/10/2008 updates for v0.67
Incorporated LCD timings from Yoshi, removed pin 15 code and power up detection code.
moved source code to google/svn Revision 32: /trunk
other happenings: did a test with the scope regarding the voltage drop at peak pulse. I had the guino set a pin high and low within the interrupts receiving high and low and the pulse widths were the same except the generated one was perfectly square. So that is a good thing. Will need to test exactly what voltage level is acceptable.
The power supply on the scope died I think I just need a new TL431C or NTE999 though. I didn't get a chance to witness the vss bounce, the scope died during the attempt.
I am planning on moving all timing critical code to timer 2 with an event handler. I need real interrupt style debouncing for the vss and might as well use it as an event scheduler for debouncing the buttons as well as whatever else. This move will also allow for arduino0012 compatability.
6/27/2008 updates for v0.66
ADDED AN ONBOARD VARIABLE EDITOR!!! VARIABLES STORED IN EEPROM!! Now you can upgrade and not lose your settings and make adjustments in the car. Refer to post 1[/url] for screens and edit usage.
Updated screens descriptions in post 1
Checked source into sourceforge.net, linked post 1 to sourceforge (ran out of room again and wiki didn't like the extension .pde).
Sketch size 11734, 448 bytes free
6/26/2008 updates for v0.65
Added 7 minute activity timeout. It saves the state of the persistent trips (just tank for now) at the point of last activity and after 7 minutes of no injector pulses/vss pulses/or button presses, it turns off the LED backlight and sets up current to be reset and tank to be restored when activity resumes.
Despazed the buttons and Screen labels so they display for a second and accidental double button presses are minimized.
Running out of excuses (and room) to no do the user input/eprom setup screen thing Sketch size 10502 bytes.
6/23/2008 updates for v0.64
Fixed instant/tank screen (was displaying instant/current on that screen).
Improved LCD reinit on reprogram/reset. Can (usually) tell if LCD needs reinitializing. Press left and right buttons to force an LCD init if necessary. Want to free pin 15 for future tasks if it works well enough.
Added a bit of default verbiage to debug mode.
Working on a portable scope deal.
6/20/2008 updates for v0.63
Wrote 64bit arithmetic routines, yay no more messing with "ifs" when it should be math!
Noticed double vss count didn't make it in .62, fixed.
Subtracting 500uS from each injector pulse.
Added cli/sei around top of loop trip copy.
Made big font a smidgeon bolder.
Code updated, sketch size 9812, CPU 54%, free mem 602