Go Back   EcoModder Forum > EcoModding > Instrumentation > OpenGauge / MPGuino FE computer
Register
Now


Reply
 
Submit Tools LinkBack Thread Tools
Old 06-01-2008, 05:08 PM   #1 (permalink)
EcoModding Lurker
 
Join Date: May 2008
Location: St. Louis
Posts: 19

silverciv - '01 Civic EX 2dr
90 day: 36.13 mpg (US)
OBD MPGuino gauge

Anyone interested in developing an OBD Arduino based fuel economy gauge should post here. So far, I have been working on one based around an ELM323 OBD to RS232 adapter. Some previous discussion on this was on the other thread (Any interest in developing an open source fuel economy gauge/computer?)

Currently, I was able to connect to the ELM and send it commands. However, when sending OBD commands (010c), the response is "ELM INIT:...>" without ERROR or OK and no real data is received.


(Support Ecomodder.com & get rid of these annoying ads!)      
 
__________________
  Reply With Quote
Old 06-01-2008, 05:46 PM   #2 (permalink)
dcb
Master EcoModder
 
Join Date: Feb 2008
Location: 3rd rock
Posts: 947

pimp mobile - '81 gs 250 t
90 day: 96.29 mpg (US)
I'm definately interested, but I have to wait. Just a couple thoughts in case this takes off w/out me.

There are so many things that you can display from the obd port that this probably would be a good 4x20 LCD candidate.

Since this is a "higher end" version than the injector based gauge, it's probably ok that it costs a little more (i.e. elm chips, bigger LCD, etc).

Also, I *think* all cars are coming out with the CAN bus now, don't know if that is just North America or what. I did see an atmel CAN processor recently (OBD support built in), but do not know how 'duino compatable that will be, if 'duino is even in the cards for the obd effort (would be nice to not have to learn another platform).

Anyway, there is a lot of interest in the obd approach. It can obviously be a useful tool for your average driver. I do hope something comes of it, at least for the hobby crowd who want complete control of the display AND mpg feedback. The scangauge is not terribly expensive though, so building your own obd mpg gauge will probably be even more of a niche than the injector based version.

Last edited by dcb; 06-01-2008 at 05:51 PM.
  Reply With Quote
Old 06-05-2008, 04:39 PM   #3 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 50

Titine - '07 Elantra GL
Wink

Hi,

New comer here, I wanted an SGII but I find it pricey, then I discovered your project, pretty cool!

I will have to buy a *duino kit to test, with an LCD screen. And I guess an ELM323 for my car. A few months ago I started to look at various obd2 solution including ELM, jeff interface, palm, 486 laptop, etc.

(I am currently working on a digital and analog I/O low level module on an Atmel AT91, an ARM 32bits RISC, so I know the stuff, and if I have time I will work on your code too).

Great project guys, continue!!

EDIT:
I am wondering if we really need an ELM chip, or if we just communicate directly in the OBD-II protocol, like the "Atmel AVR 2004 Design Contest Project" at http://www.circuitcellar.com/AVR2004/first.html
Maybe wait also for the Atmel 328P to have more RAM?

We should bring also the "xarias" guy here for some help.

EDIT2:
Here's how to connect the OBD-II connector directly to an Atmel:
http://prj.perquin.com/obdii/
(see Microcontroller-OBD interface, second picture)

Last edited by Magister; 06-06-2008 at 03:42 PM.
  Reply With Quote
Old 06-10-2008, 12:09 AM   #4 (permalink)
Liberti
 
LostCause's Avatar
 
Join Date: Feb 2008
Location: California
Posts: 504

Thunderbird - '96 Thunderbird
90 day: 27.75 mpg (US)
A nice pricepoint might be tough. Anything much above $50 and the SGII starts to make more sense.
  • RS232 Freeduino ~$15
  • 16 x 2 LCD ~$10
  • ELM 323 ~$15
  • Assorted Parts ~$3
  • OBD-II plug ~$7 (5 minimum)
Junkyard, maybe? It does drop down to $3 after the first 200...

If it's possible, I say drop the ELM. The ELM327 will help with the "one size fits all" aspect as it does every interface...but $30...eek.

- LostCause

Last edited by LostCause; 06-10-2008 at 12:33 AM.
  Reply With Quote
Old 06-10-2008, 09:36 AM   #5 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 50

Titine - '07 Elantra GL
I doubt you need an ELM323, on AVRFreaks a couple of people did it without an ELM. Search "obd" on their forums, some people even give some C codes to do it. It seems the ELM is slow too.

I'm sure we can drop the ELM.

To init the OBDII you send 0x33 at 5 bauds then you switch to 10400 bauds and send some commands, plug the Atmel directly on the OBDII like this:
(ISO protocol only)


You could also switch to an AT90CAN128 to speak CAN to your car I guess?

Last edited by Magister; 06-10-2008 at 09:48 AM.
  Reply With Quote
Old 06-10-2008, 11:20 PM   #6 (permalink)
Liberti
 
LostCause's Avatar
 
Join Date: Feb 2008
Location: California
Posts: 504

Thunderbird - '96 Thunderbird
90 day: 27.75 mpg (US)
Lightner's article, posted above by Magister, is very well written and in depth. He offers schematics to properly handle the vehicle's 12V power supply and an in depth examination of the J1850 VPW protocol. The end of his article claimed circuit cellar (magazine running the story) would cover all the protocols in the future, but I haven't been able to find them.

In any case, I found the calculations necessary to convert OBD-II PID's to MPG. The information is also posted in the main instrumentation forum. All from Bruce Lightner's mind:

The calculation depends on whether your car has a MAF sensor or not.

MAF Sensor:

MPG = (14.7 * 6.17 * 454 * VSS * 0.621371) / (3600 * MAF / 100)
= 710.7 * VSS / MAF

14.7 - grams of air to 1 gram of gasoline - ideal air/fuel ratio
6.17 - pounds per gallon - density of gasoline
4.54 - grams per pound - conversion
VSS - vehicle speed in kilometers per hour
0.621371 - miles per hour/kilometers per hour - conversion
3600 - seconds per hour - conversion
MAF - mass air flow rate in 100 grams per second
100 - to correct MAF to give grams per second

No MAF (Uses MAP and Intake Temp to approximate MAF):

IMAP = RPM * MAP / IAT
MAF = (IMAP/120)*(VE/100)*(ED)*(MM)/(R)

MAP - Manifold Absolute Pressure in kPa
IAT - Intake Air Temperature in Kelvin
R - Specific Gas Constant (8.314 JM/K)
MM - Average molecular mass of air (28.97 g/M)
VE - volumetric efficiency measured in percent
ED - Engine Displacement in liters

This method requires tweaking of the VE for accuracy.

I have no idea if these are the methods the SGII uses. The accuracy will be off due to approximations (AFR ~14.7, etc). All the information is from the brilliant mind of Bruce Lightner.

- LostCause
  Reply With Quote
Old 06-11-2008, 06:18 AM   #7 (permalink)
EcoModding Lurker
 
Join Date: May 2008
Location: Big City
Posts: 5
Here are a few open source projects on OBDII maybe can get some ideas.

http://www.obddiag.net/
http://www.sterntech.com/index.php
  Reply With Quote
Old 06-11-2008, 09:25 AM   #8 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 50

Titine - '07 Elantra GL
Quote:
Originally Posted by RuHaSs View Post
Here are a few open source projects on OBDII maybe can get some ideas.

http://www.obddiag.net/
Use an ELM, I don't know if we want it.

very interesting, and the schematics are available as well as the sources!
__________________
  Reply With Quote
Old 06-19-2008, 01:04 PM   #9 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 50

Titine - '07 Elantra GL
Ok it seems we do not need a "jeff interface" or transistors to connect the K line to the TX/RX of the chip, a single Motorola/Freescale chip already exist that does everything: the MCZ33290EF
Quote:
The MC33290 is a serial link bus interface device designed to provide bi–directional half–duplex communication interfacing in automotive diagnostic applications. It is designed to interface between the vehicle’s on–board microcontroller and systems off–board the vehicle via the special ISO K line. The MC33290 is designed to meet the “Diagnostic Systems ISO9141” specification.
It's the chip used in the Blafusel "KL interface serial cable" and also a obd2-lcd device.

To use it, it's very easy, PD0 and PD1 are direct connect to the Atmel chip:

(picture of their PDF available at http://www.blafusel.de/misc/files/obd2_lcd-b.pdf)

So I tried to get one here in Montréal but can not find one, it's a $1.46 chip but as a special order they want to charge me $8 for it, WTF indeed!

If someone bought some at digikey or your local electronics parts store, I will be glad to paypal you $2 to ship one to me in a standard envelop
__________________
  Reply With Quote
Old 06-23-2008, 12:53 PM   #10 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 50

Titine - '07 Elantra GL
I ordered:

- a Freeduino serial V2.0 + LCD display at NKC ($17+$10)
- an OBD plug at CarPlugs.com ($5)
- a sample MCZ33290EF from Freescale ($0)

I should be in business, I will find a 510 ohms resistor somewhere here and some push buttons, it's the only component needed.

I even started to write some codes, I started with standard C but why re-invent the wheel to support digital I/O and all, it's in the Wiring/IDE already. So I went back to the standard IDE, and it will be easier to share with other people.

It compiles, obviously it's not tested, copy/paste in IDE

EDIT July 3rd: Maybe I will not update this post anymore, for all information go to the homepage of the project at http://code.google.com/p/opengauge/

Source is available here:

http://code.google.com/p/opengauge/s...no/obduino.pde

CABLE
-----
To keep compatibility with already existing cable, the OBD-II to DB9F cable is wired like this:

Code:
DB9F			OBD-II
1---------------5 (Signal ground)
2---------------4 (Chassis ground)
3-NC
4---------------7 (ISO K line)
5-NC
6---------------10 (J1850 bus-, future use)
7---------------2  (J1850 bus+, future use)
8-NC
9---------------16 (Battery)
Do not plug it into a PC!!! This goes to an interface only!!!

You can make it yourself with an OBD-II plug available at http://www.carplugs.com/ for $5+$3sh.
Use at least AWG24 wires especially for Battery and Chassis ground.

Or buy an already made cable at http://www.obd2allinone.com/ for $10+$5sh

INTERFACE
-------
The cable goes into an interface to adapt the ISO signal for the Arduino input.
It concists of a small IC, a resistor, a DB9M that will be plugged with the cable mentionned above, and a few wires that connect to the Arduino board.
Schematic is like this:

Code:
                             MC33290
                            +-------+
Arduino pin 3 -------------5|TX  ISO|4-----------------+------- DB9M pin 4 (ISO K Line)
                            |       |                  |
Arduino pin 2 -------------6|RX  GND|3--DB9M pin 1     / between MC pin 4 and pin 1
                            |       |                  \ goes a 510 ohms resistor
Arduino 5V pin output -----7|VDD  NC|2--               /
                            |       |                  |
Arduino 5V pin output -----8|CEN VBB|1-----------------+------- DB9M pin 9 (12V Battery)
                            +-------+
The Arduino is powered by the 12V line coming from the cable too
Code:
Arduino 12V input ------------------ DB9M pin 9 (12V Battery)
Arduino GND input ------------------ DB9M pin 2 (Chassis Ground)
__________________

Last edited by Magister; 07-04-2008 at 03:02 PM.
  Reply With Quote
Old 06-24-2008, 02:41 PM   #11 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: USA
Posts: 32

N8sPony - '98 Mustang
all I gots to say is...AWESOME! I've been working on this exact thing off and on for a while and thought I was completely on my own, nice to know there's others more intelligent than I working on it as well. I built a usb-obdii interface using a pic and it works with pwm, which is what my car uses. I've got an extra set of chips from that project that I could use if it comes down to it, but I'd rather just use straight arduino if I can. Anyone seen any of the low-level info about pwm, besides the message formats and such? So far all I have is my 4x20 lcd hooked up and laid out, and the message frames all compiled, I just have to figure out how to get the right signals sent (whether I need to use a rs232 converter chip or if I could bit bang it or something).

Oh yeah, and another thing I learned from my last project is...SAMPLES!!!! I didn't have to pay for a single chip on that project, plus I have extras now to use if need be
  Reply With Quote
Old 06-25-2008, 08:20 AM   #12 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: Werchter, Belgium
Posts: 1

Wolf - '96 Golf Mk3 TDI
Last 3: 43.6 mpg (US)
Send a message via MSN to scratch
I have an arduino board and I was looking into doing the same thing! I haven't started because I lacked the time... Untill now. I will place a sample order too, allthough it costs money for oversea sampling (6$), its still cheaper as at farnell (actually not, but i need to order 98 pcs at least over there)...
Well, I'm folowing this thread very closely, and I'll try to contribute some code
  Reply With Quote
Old 06-25-2008, 09:19 AM   #13 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 50

Titine - '07 Elantra GL
n8thegr8 and scratch, welcome aboard

My car use ISO (and CAN) but I will focus mainly on ISO protocol.

For PWM unfortunatly I don't know a lot about it :-/

scratch: it costs also $6 for the shipping to Canada, I ordered 2 samples.
__________________
  Reply With Quote
Old 06-25-2008, 11:34 AM   #14 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: USA
Posts: 32

N8sPony - '98 Mustang
Thanks! well, from what I've gathered, and looking at the schematics from the usb adapter I built, there should be no extra hardware needed for pwm, as the pic on that board just drives 2 transistors for 5v (which I think is what the arduino digital pins are, no?). I've also gathered that pwm at the physical layer is a balanced bus of +/- 5v in reference to each other. I'm still trying to get my head wrapped around it, but it's comforting that we should be able to do it without extra hardware.
  Reply With Quote
Old 06-27-2008, 10:30 AM   #15 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: ohio
Posts: 2

Spectra - '08 Spectra EX
Question DIY OBDII MPG Display

I have most of the parts on the way for the freeduino setup. I also have the chip and the LCD coming. Once I have everything connected, Im not sure how to do the programing for the device. If anyone can help me, it would be greatly welcome.


P.S. Sorry if i havent read enough of the other threads on this forum, But im new at this and need help.

Thanks Everyone
  Reply With Quote
Old 06-27-2008, 10:36 AM   #16 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 50

Titine - '07 Elantra GL
Everything about the *duino board can be found here:

Arduino - HomePage

Download the IDE from their web site and install it. Once you have a little program made, in the IDE you can compile it and send it to the board via Serial/USB.

Note that the "OBDuino" project is very very young for the moment, we have the hardware but no software
__________________
  Reply With Quote
Old 06-27-2008, 12:38 PM   #17 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: ohio
Posts: 2

Spectra - '08 Spectra EX
Thanks.

That helps out some. One big problem is that I know NOTHING about programming. And that being the case I should probably give up. If anyone has some code already written that I could use it would be greatly appreceated. Also is there anything else I need?

Current items on the way:

1 freeduino v2.0 board
1 2x16 LCD display
1 MCZ33290EF sample from freescale
1 serial to obdII cable

If there is anything else I need, please let me know.

Thanks
  Reply With Quote
Old 06-27-2008, 01:14 PM   #18 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 50

Titine - '07 Elantra GL
I plan to plug the OBD2 signal (from the freescale chip) on pin 2 and 3 of the board, the RS232 on the board will be used to send debug message on a terminal screen, so you will have to either make an adapter or cut your obd2-serial cable to plug the right pins.

For the moment, no, there is absolutly no "OBDuino" code for the project!! I started to write some code, blindly, as I have no hardware to play with!
__________________
  Reply With Quote
Old 06-27-2008, 01:19 PM   #19 (permalink)
EcoModding Apprentice
 
Join Date: Jun 2008
Location: Albany, ny
Posts: 197

NewBlue - '07 Civic EX
90 day: 40.34 mpg (US)

The Better Half - '97 Ranger XLT
90 day: 25.84 mpg (US)
I will work on getting parts ordered tonight and start building, I might be able to help with the code once I get the hardware.
__________________
2007 Honda Civic Ex
Second Goal = 50mpg
First goal = 40mpg Goal Achieved 3 tank average over 40mpg
Starting point 30mpg ready...... GO.

  Reply With Quote
Old 06-27-2008, 01:38 PM   #20 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 50

Titine - '07 Elantra GL
Thanks Bluecivic!

hé, we're not that far, I go through Albany when I go in vacation

I continued my code to write a function to send an ISO string, a command is 7 bytes length maximum IIRC. The same function will return the response and the number of received bytes.

I plan to have four pointers to function to display the four info in the four corners, prototype something like
void (*topleft)(void);
void (*topright)(void);
void (*bottomleft)(void);
void (*bottomright)(void);

then in the config it will assign what you want, e.g. if you want to have the instant MPG in the top left, the config will assign the pointer of the function to the topleft() one. Let's assume a function cal_inst_mpg() calculate it, the config will just do:

topleft=cal_inst_mpg;

and in the loop() it will do:

loop()
{
// read a couple of value
iso_read_whatever

// display on LCD
lcd.gotoXY(0,0);
topleft();
lcd.gotoXY(8,0);
topright();
lcd.gotoXY(0,1);
bottomleft();
lcd.gotoXY(8,1);
bottomright();
}

but hé, I go too far, let's receive the board and solder it before!
__________________
  Reply With Quote
Reply

Tags
obd2

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
MPGuino release one workspace dcb OpenGauge / MPGuino FE computer 562 Today 11:01 AM
Just some quick info on Scangauge vs. MPGuino NoCO2 OpenGauge / MPGuino FE computer 0 05-20-2008 04:47 PM
Vacuum gauge problems :( DifferentPointofView Instrumentation 3 05-14-2008 11:04 PM
Will Scan Gauge work on mine? bennelson Instrumentation 9 02-19-2008 10:04 PM
All New Nissan Models to Feature Fuel Efficiency Gauge MetroMPG General Efficiency Discussion 1 12-01-2007 10:29 PM




Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC5
All content copyright EcoModder.com