EcoModder.com

EcoModder.com (https://ecomodder.com/forum/)
-   OpenGauge / MPGuino FE computer (https://ecomodder.com/forum/opengauge-mpguino-fe-computer.html)
-   -   OBD MPGuino gauge (https://ecomodder.com/forum/showthread.php/obd-mpguino-gauge-2702.html)

jmonroe 06-01-2008 05:08 PM

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 (http://ecomodder.com/forum/showthrea...ge-1428-9.html)

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.

dcb 06-01-2008 05:46 PM

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.

Magister 06-05-2008 04:39 PM

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)

LostCause 06-10-2008 12:09 AM

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) :eek:
Junkyard, maybe? It does drop down to $3 after the first 200...:p

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

Magister 06-10-2008 09:36 AM

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)
http://prj.perquin.com/obdii/obdii_avr.gif

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

LostCause 06-10-2008 11:20 PM

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

RuHaSs 06-11-2008 06:18 AM

Here are a few open source projects on OBDII maybe can get some ideas.

http://www.obddiag.net/
http://www.sterntech.com/index.php

Magister 06-11-2008 09:25 AM

Quote:

Originally Posted by RuHaSs (Post 33649)
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!

Magister 06-19-2008 01:04 PM

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:
http://lemondedefred.googlepages.com/33290.gif
(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 :)

Magister 06-23-2008 12:53 PM

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)


n8thegr8 06-24-2008 02:41 PM

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

scratch 06-25-2008 08:20 AM

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

Magister 06-25-2008 09:19 AM

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.

n8thegr8 06-25-2008 11:34 AM

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.

cjy7720 06-27-2008 10:30 AM

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

Magister 06-27-2008 10:36 AM

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

cjy7720 06-27-2008 12:38 PM

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

Magister 06-27-2008 01:14 PM

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!

Blue07CivicEX 06-27-2008 01:19 PM

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.

Magister 06-27-2008 01:38 PM

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!

n8thegr8 06-27-2008 03:54 PM

Well, this is what I've done so far, ignore the serial stuff, I was doing that out of naivety, (actually, it might work if you have a rs232>OBDII adapter), feel free to take whatever you want out of it. Basically all I was interested in was instant mpg, speed, and rpm at the moment, so all the calculations and such should work. The display code definitely works as tested, haven't hooked it into a vehicle yet though. I'm waiting on a serial>usb adapter for my laptop to continue work on it.

Code:

/*
    OpenScanGauge
*/

#include <LCD4Bit.h>
#include <stdio.h>

LCD4Bit lcd = LCD4Bit(4);

double vss;
double maf;
double mpg;
int rpm;

//pins to use for data
int busneg=0;
int buspos=1;

//arrays to store values returned from ECU
char vss_byte[10];
char maf_byte[10];
char rpm_byte[10];

//hex commands for speed, MAF, and rpm
char* vss_cmd[6] = {"61", "6A", "F1", "01", "0D", "8B"};
char* maf_cmd[6] = {"61", "6A", "F1", "01", "10", "C7"};
char* rpm_cmd[6] = {"61", "6A", "F1", "01", "0C", "96"};

//array to look up binary values for hex chars
char* hexconvert[15][2] = {{"0","0000"},{"1","0001"},{"2","0010"},{"3","0011"},{"4","0100"},{"5","0101"},{"6","0110"},{"7","0111"},{"8","1000"},{"9","1001"},{"A","1010"},{"B","1011"},{"C","1100"},{"D","1101"},{"E","1110"},{"F","1111"}}
char vss_str[5];
char mpg_str[4];
char rpm_str[5];

void setup() {
  lcd.init();
}

void loop() { 
  getValues();
  printOutput();
}

void printOutput() {
  lcd.clear();
  lcd.cursorTo(1,0);
  lcd.printIn("MPG: ");
  lcd.cursorTo(1,5);
  mpg = (710.7 * vss) / maf;
  sprintf(mpg_str, "%f", mpg);
  lcd.printIn(mpg_str);
  lcd.cursorTo(1,9);
  lcd.printIn("Speed: ");
  lcd.cursorTo(1,16);
  vss = vss * 0.6214;
  sprintf(vss_str, "%f", vss);
  lcd.printIn(vss_str);
  lcd.cursorTo(3,0);
  lcd.printIn("RPM: ");
  lcd.cursorTo(3,5);
  sprintf(rpm_str, "%d", rpm);
  lcd.printIn(rpm_str);
  delay (1000);
}

void getValues() {
    pwm_send(vss_cmd);
    vss_byte = pwm_read();
    vss = vss_byte[5];
    pwm_send(rpm_cmd);
    rpm_byte = pwm_read();
    rpm = .25 * (rpm_byte[5] * 256 + rpm_byte[6]);
    pwm_send(maf_cmd);
    maf_byte = pwm_read();
    maf = .01 * ((256 * maf_byte[5]) + maf_byte[6]);
}

void pwm_send(char* cmd[]) {
    char bincmd[] = hex2bin(cmd[]);
    pinmode(busneg, OUTPUT);
   
    //send SOF and drop back to neutral
    AnalogWrite(buspos, 255);
    digitalWrite(busneg, LOW);
    delayMicroseconds(32);
    AnalogWrite(buspos, 0);
    digitalWrite(busneg, LOW);
   
    //loop through array of bits
    for (int i=0; i < 48; i++) {
            //send 0
        if bincmd[i] = '0' {
            analogwrite(buspos, 255);
            digitalwrite(busneg, LOW);
            delaymicroseconds(16);
            AnalogWrite(buspos, 0);
            digitalWrite(busneg, LOW);
        }
        //send 1
        else if (bincmd[i] = '1') {
            analogwrite(buspos, 255);
            digitalwrite(busneg, LOW);
            delaymicroseconds(8);
            AnalogWrite(buspos, 0);
            digitalWrite(busneg, LOW);
        }
    }
    //send EOF to be here
}

char[] pwm_read() {
    pinmode(busneg, INPUT);
    //code for reading values here (complex methinks)
}

//convert hex command to binary
char[] hex2bin(char* cmd[]) {
    char bincmd[];
    int binloc = 0;
    for(int i=0; i < 6; i++) {
        for(int j=0; j < 15; j++) {
            if (cmd[i][0] = hexconvert[j][0]) {
                for (int k=; k < 4; k++) {
                    bincmd[binloc] = hexconvert[j][1][k];
                    binloc++;
                }
              }
        }
        for(int j=0; j < 15; j++) {
            if (cmd[i][1] = hexconvert[j][0]) {
                for (int k=; k < 4; k++) {
                bincmd[binloc] = hexconvert[j][1][k];
                binloc++;
                }
            }
        }
    }
    return bincmd;
}


Magister 06-27-2008 03:55 PM

I made changes in my previous code, check message
http://ecomodder.com/forum/showthrea...html#post37505
As always, untested as I have no hardware!!

Magister 06-27-2008 03:58 PM

LOL we posted at the same time :)

tom43571 06-28-2008 12:58 PM

I have been working on my own obd II MPG Gauge for a while now using the elm323 and the pic16f877a but have run into quite a few snags. I think im going to give up and start working with you guys. Hopefully I can be of some help. I have ordered all of the parts and went with the 16x2 LCD. I have not ordered an obd cable yet but I am thinking of ordering the standard male 10 pin for $5.

n8thegr8 06-28-2008 05:08 PM

yeah, I built my cable with the connector from mouser for my usb>obdII reader I built (also a pic btw, pic18f2455) I mainly built it for diagnostics and for checking my arduino up against. SO...I'll only be working on PWM, as that's the only car I have access to, BUT the code should work on VPW as well with slight modifications (vpw uses only the 1 data line instead of 2, but same logically and physically otherwise).

I have found a few more resources about it, and also, I now have a noob knowledge of how differential bus works :P. apparently, you send the signal on the bus+ line, and send the complement of that signal on the bus- line, so from what I understand, when high on bus+, you need to pull bus- low, and vice versa. If I am wrong, PLEASE correct me. Anywho, so I don't think I need any extra hardware to bit bang it, so I'll be working on functions for sending the triggers and converting the hex code to the appropriate high's and low's. Here's a little more about pwm (and vpw for that matter) for those interested:

SAE J1850 Description, Electrical Interface Bus

tom43571 06-28-2008 05:19 PM

I have never worked with the quino board before. Do I need anything special to connect my lcd and my MCZ33290EF or is it just plug and play?

n8thegr8 06-28-2008 06:30 PM

the arduino platform is generally pretty flexible. Nearly all of it's pins can be reassigned to do certain tasks. typically, all you need to do to hook it up to a peripheral is wire it to whichever pins you want to use to drive it. Check out the playground on Arduino - HomePage. they have a lot of really good examples and code to get you started. I would also suggest looking into the 4bit LCD library, so it will cut down on how many wires you have to connect and free up some pins to use for other things (cuts it from 8 wires to 4), that's what I use with my lcd.

tom43571 06-29-2008 09:27 AM

Here is a link to the other project I was trying to do. I tried contacting the author but it appears he lost interest in the project.

OBD2 LCD - Data Readout Tool - Digital Gauges - Home

Here is a couple other useful links

http://www.obd2lcd.com/images/obd2paper.pdf
OBD-II PIDs - Wikipedia, the free encyclopedia

n8thegr8 06-29-2008 11:33 AM

sweet, that looks like a pretty neat little project. I've turned up some more on VPW and PWM, they both use "bit symbols", so it's not the fact that the bus is high or low that matters, it's for how long the bus is high or low (in microseconds). This is going to be interesting, I got started on the code to generate the necessary pulses. Here's some more reading material for those interested in the timings for bits:

Third draft of Eval Eng article

The one of interest for PWM is the very last table at the bottom of the page.

tom43571 06-29-2008 01:39 PM

In the mpguino forum they used the pulse width but last I read it was innacurate in terms of MPG. Wouldnt it be more accurate to use your liters x 14.7% to get your fuel use per revolution and multiply that by your rpm. With a little conversion you get gallons per hour. Divide MPH by GPH and get MPG. I dont know if that would be easier or not but as long as your getting MPG I guess it doesnt matter.

dcb 06-29-2008 02:50 PM

Man I love the energy you guys are putting into this :)

Quote:

Originally Posted by tom43571 (Post 39514)
In the mpguino forum they used the pulse width but last I read it was innacurate in terms of MPG.

FYI, Yoshi has been reporting mpg results within 1% on a prius by monitoring pulse width.

n8thegr8 06-29-2008 05:30 PM

If I'm not mistaken, I think you guys are confusing measuring pulse width off the injectors (MPGuino wasn't obdii was it?) with what I'm talking about. The "Pulse width" I'm carrying on about is the J1850-PWM OBDII protocol. The J1850 protocol uses VPW (a single wire) or PWM (a balanced bus 2-wire) at the physical level to send the bits. My car (1998 mustang) uses the PWM flavor of the J1850 protocol.

It should be every bit as accurate as a scanguage, because it's pulling the same information and running the same formula against it (calculating based on speed and MAF reading from the OBDII port rather than reading off the injectors).

dcb 06-29-2008 06:04 PM

Correct, mpguino hooks up directly to the fuel injector, no obd involved. Same technique as Yoshi's supermid basically.

I would think an obduino could possibly improve on the scangauge accuracy if it is a concern, by cranking up the polling rate and/or taking more variables into account as available on certain cars.

Keep up the good work guys :)

LostCause 06-29-2008 07:44 PM

Like Nate posted, the only way to universally determine MPG via OBDII is to use the MAF sensor (or convert to MAF via the MAP & IAT sensors). The equations are posted earlier in this thread.

Fuel injector pulsewidth is not a standard OBD-II PID...

Great work guys. I wish I could contribute code as this is a project I really want to see hit fruition. :)

- LostCause

tom43571 06-29-2008 08:06 PM

Sweet. I think I get it now. Please correct me if im wrong, VPW uses k-line and 12v while PWM uses k and L-line plus 12volt. I wish I had some hardware here to get going on this. Does this mean that the VPW will be using only 2 pins of the OBD(Pins 7 and 16)?

n8thegr8 06-29-2008 08:58 PM

actually, the K and L lines are for ISO only I believe, pwm uses J1850 bus+ and bus-, which are 2 seperate lines (pins 2 and 10), and VPW just uses the the J1850 bus+ (pin 2). K and L lines are on pins 7 and 15 for ISO, and I dunno much about CAN.

I also now know how you can have a -5v, lol. That was confusing the hell out of me. it's measured in reference to each other, so an active drive high is 5v on bus+ and 0v on bus-, and a drive low just swaps the polarity. This is getting intense, lol. So far the only code I've driven is the SOF, but I've set up the arrays for converting hex to binary and such.

My code will only support J1850, since I don't have anything else to test with, but if someone wants to add my code to theirs to make it more comprehensive once I get something working, that's cool by me.

tom43571 06-29-2008 11:58 PM

N8THEGR8 are you using the freeduino and the MCZ33290EF chip or are you using your previous OBDII project for all of this? Im just trying to get on the same page as you, I am going to be using the freeduino setup and was thinking of hooking it up based on the schematic on post 9 when the hardware arrives.

n8thegr8 06-30-2008 09:10 AM

yeah, I guess I shoulda explained myself, lol. I'm doing this on an arduino single sided serial that I built from scratch (MasterNater: Arduino Finished!!! and MasterNater: SO MUCH DONE!!!). Just your basic, plain jane arduino.

Since the arduino can drive +/-5v with the digital and analog pins, I'm *attempting* to do this without any additional hardware (no mcz chip, just connecting the arduino 100% directly to the OBDII port), that's why I was stating that it'll only work on pwm and vpw systems, but my code should be easy to add to someone elses project that does run ISO to get it running multiple protocols.

Do you know which protocol your vehicle uses? because you might want to consider that in order to direct which way you go. You can look up the model and year here: ScanTool.net - Resources - Compatible Vehicles

I've finished the method for converting hex to binary, now I should just be able to loop through the array of bits to drive the data, hopefully. I still don't know how successful I'll be, as I still kinda feel like I'm fumbling in the dark, lol.

Magister 06-30-2008 09:44 AM

The MCZ33290EF is for ISO K line only, I am working on it, n8thegr8 works on the PWM/VPW stuff that I don't have a clue about :)

I received my OBD-II plug, yeah :) waiting for the remaining...

BTW n8thegr8, in my code I posted on page 1, I use some function like iso_write_data() or iso_read_byte() whatever, maybe it would be good to have only one generic program that does the calculation/display/etc so we will not work on the same thing? And you can work on pwm_read_data() or pwm_write_byte() and so on.

EDIT: I updated the code on first page to my latest version. It should display instant gasoline consumption, in L/100 or US MPG. Too bad I can not test it LOL.

n8thegr8 06-30-2008 03:28 PM

Interesting, that sounds like a good idea. I updated my code on page 2 as well with what I have so far if you want to take anything from it. I haven't even compiled it yet, and I'm the kind of coder that throws crap together and lets the debugger sort it out, lol, but it's lookin good to me so far. It's pretty rough, but I commented it so you can get an idea of what i'm *trying* to do, lol. Maybe we could create a header file containing our common data/functions? or maybe start a google code project page, lol. hrmmmm....damn, I'd really like to start testing this.


All times are GMT -4. The time now is 03:00 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com