PDA

View Full Version : Obdii Vpw



DynamoBen
- 12th June 2006, 07:22
I recently came across an article published in Circuit Cellar last year that describes a automobile Fuel Consumption Gauge. The devices ties into the OBDII system and gathers data and then actuates the gauge to display fuel consumption.

www.circuitcellar.com/advertise/ cc-advertising/Lightner-183.pdf

After reading the article I thought it might be fun to do this with a pic and PICBasic. After a little searching I found the following website which nails down the hardware side but I'm a little lost on software. (I don't read C so I am unable to port the code to PICBasic)

http://home.pacific.net.au/~ijhope/pcm/vpw_to_rs232.htm

I would assume I could read the VPW strings with Pulsin, and write with Pulsout but I'm not certain about that.

NOTE: I know about the ELM Electronics ELM322. (I own one) I'm looking to directly interface with the buss.

Thoughts, help, suggestions.

schu4647
- 12th June 2006, 13:08
I have never done this, as I have a NeoVi, but this site looks promising. These IC's look like they do the entire conversion for you. Keep in mind every automaker does it a little different and you need to know how to intperpret the data. Here is the site:

http://www.elmelectronics.com/index.html

Looks like they have a chip for every variation of the protocol.

schu4647
- 12th June 2006, 13:13
Actually looking at those, they are just PIC's that somone programmed and is selling. I thought they were VPW specific IC's.

DynamoBen
- 12th June 2006, 16:23
If you take at look at my initial post:

"NOTE: I know about the ELM Electronics ELM322. (I own one) I'm looking to directly interface with the buss."

To be honest I not only have the ELM322, but I have all five of the elm devices. I was a beta tester for the most recent release. I'm interested in tying my pic to the data bus like the article did.

I own, have read, and understand the SAE documents pertaining to the communications protocol. The commands for communication are standard. (J1850) The thing at differs between manufacturers is at the physical level vpw, pwm, iso, and can. I'm just not sure how to implement vpw in PICBasic and would like to.

schu4647
- 12th June 2006, 19:47
I aplogize, I did research between reading your post and posting a reply. I would do it the exact same way you are proposing. It sounds like an interesting project. I would think it would work as long as you have time to send the message out on RS232 between bus messages. I don't have the protocol in front of me, and it has been a long time. I wouldn't think it would be that difficult. I would think it would really only take 4 tests. If the bus is low for long, low for short, high for long, high for short. Throw it all in a for next loop to capture the whole message. I would only be worried about missing part of the next pulse width while you are testing the previous one. It would defanitely work though if you get that aspect of the the timing down, and you don't get backed up by sending the RS232 out. I saw some VPW tranceivers out there, that seemed to make the send and receive side a little simpler. It has been a long time since I did VPW, I am more into CAN now. Hope it works out for you.

DynamoBen
- 12th June 2006, 22:36
The intention is not to do a VPW-RS232 convert, that is why I who the ELM chips. I am just interested in getting a pic onto the buss and communicating.

schu4647
- 13th June 2006, 00:54
receiving will be easy. Sending will be tough. You device needs to be quite when higher priority messages communicate. There has to be a VPW handler IC out there. I searched but can't find one. Only thing I can find a tranceiver. I can find them for LIN and CAN though.

schu4647
- 13th June 2006, 01:02
I think this might help a lot. I am looking through a J1850 book and it shows a few examples. They use a HIP7010 or HIP7030A2 as the handler. This should take care of the protocol aspect. Hook it into a HIP7020 Transceiver and you should be good to go. I didn't study the data sheet too much, but I think this will simplify things. Here is a link to the data sheet for one of the handlers.

http://www.intersil.com/data/fn/fn3644.pdf

DynamoBen
- 13th June 2006, 01:09
One Problem:

http://www.intersil.com/support/ps.asp?once=y&partNumber=HIP7010&R1=B

HIP7010B=Retired
HIP7010B96=Retired
HIP7010P=Retired


Discontinued, this has been the case for all the ICs that peform this type of function. I even checked Motorola/Freescale, they used to make chips similar to the above. However they have moved these functions onto their microcontrollers and discontinued the outboard chips.

schu4647
- 13th June 2006, 01:10
That wipes me out of ideas. I guess PIC's have limitations.

DynamoBen
- 13th June 2006, 01:30
More detail on VPW:

http://www.intel.com/design/intarch/papers/j1850_wp.htm

DynamoBen
- 13th June 2006, 06:28
After looking this over I think the inbound vpw could be read by either looking at the pin state and comparing it with Timer1 or using the CCP module and having this occur in the background. I have determined that Pulsin would be too slow to grab the whole packet.

I'm kind of leaning toward the CCP module after reading the following.
http://ww1.microchip.com/downloads/en/DeviceDoc/41215B.pdf
(see tip #3 and #4)

The problem is I have never used the CCP module before. Anyone have any experience with it? Advantages/Disadvantages to CCP versus Pin State/Timer1?
Examples might be helpful.

Acetronics2
- 13th June 2006, 12:24
Hi, Ben

as your injectors and odometer wiring are accessible, may be it would be simpler to take the infos at the very source ...

I remember Elektor magazine committed such a project ( in analog mode ...) 10 or 15 years ago ... If you want, I dig into my old papers ...

I crossed it some weeks ago ...

Alain

PS: from circuit cellar source, It would be much better to re-build the project from the C files downloaded ...ohhhhh, yeah , here it's PbP World ... sorry !!!

DynamoBen
- 13th June 2006, 16:25
Acetronics, you’re missing the point. I'm interested in creating code to read and write to the vpw buss. (I can't stress that enough) I'm not interested in a work around or using the off the shelf code from the circuit cellar project.

I have used the ELM devices in numerous projects and am now looking into bypassing this device and putting the pic directly on the buss.

Acetronics2
- 14th June 2006, 07:52
Hi, Ben

I see ... you were only talking of a fuel gauge, in your first post.

Alain

srspinho
- 20th June 2007, 15:02
Hi friend,

I know it´s a bit late for this post, but here we go ...

I was making some experiments with my new Opel Corsa (Brazillian version - small 1.0 litre engine - 79 Hp)

The car is good, but I don´t use gasoline, but Alcohol. The performance is good but the consumption is very high,
specially on heavy duty or high speed.

I did a small "on-board" (with lot of help from this forum) computer for my old Opel Corsa, but without Fuel Consumption display.

Now, i Would like to implement that function.

I Did some search on internet and I foud this :

http://www.eelkevisser.nl/fuel.htm

Don´t worry about the display. This display is just an I2C module made for GM/Opel cars, like Astra, Corsa Meriva etc.

They are monitoring the Car´s speed sensor and the Injector´s "on-time"

My doubt is : do you think the method used by the author really eficient ?

Did you have some progress on implementing the GM VPW ? (i´m still trying with an old GM´s corsa ECU on my desk - but with out success).

Regards

Sérgio

Acetronics2
- 20th June 2007, 15:26
Hi, Sergio

The mesuring method is quite simple and widely used ... it's based on the on-state duration of the injector ... ( your car has a single injector for the 3 (?) cylinders ...)

the more it stays open, the more Alcohol you drink ( or may be your car drinks ??? )

Pression is a constant, so fuel rate is linearly proportionnal to time ... now just have to find mileage info and make the division ...

and convert result into the Opel displaying protocol ... of course.

Alain

srspinho
- 20th June 2007, 18:21
Thanks ALain,

actually, my car can "drink" gasoline, alcohol or both, mixed. The car´s ECU control the correct amount of fuel.

My car has 4 cylinder and 4 injectors (1 injector for each cylinder). Should I measure the "on-state" for each cylinder ?

I´m counting pulses from the speed sensor using Timer 0 (as a 250ms timer) and Timer 1 as a tick counter.

Can I use the CCP module (to measure the on-state time) without my timers stop working ?

When I built my first digital speedometer/hodometer/termometer for my old opel corsa, I had a perfect signal from my speed sensor : When the car was stoped, I have no pulses. When the car start moving, I had 8 pulses / turn.
But now, I don´t know why, when I start my new opel´s engine, the hall sensor start to send me 2 pulses/sec with the car stoped. When I start moving, it gives me to 10 pulses / Sec.

I have built myself a new speed sensor with a hall-effect sensor inside a rigid plastic capsule. This solution gives me 8 pulses/second (8 small magnets were fixed close to the sensor. It was a really hard work...

I´m still thinking on how to fix the problem on my original speed sensor. As I´m making 4 Timer1 readings / second I will have to work arround this problem envolving the "false" pulses.

Anyway...I did really appreciate your reply ! ! !

Regards !

Sérgio

Acetronics2
- 20th June 2007, 18:35
Hi, Sergio

I didn't know the 1.0l 4 cyl ... just 1.2l 3cyl and 1.4l 4 cyl ... apologies, then.

If your engine is in a good condition ... we can consider all injectors give the same amount ... the error will be very very small.

Considering the injection duration, you can measure for the 4 injectors ... just "for the sport".

Using a CCP is a good Idea for measuring ... as you can use the same "timer" to measure the 4 injectors ( they do not bleed at the same moment ...) and interrupts will tell you only when the result is ready to read ( Capture mode )

Alain

srspinho
- 12th September 2007, 20:57
Hi Alain,

Talking about the Fuel Consumption, have you ever had success on using the following formula to do that ?

( Injector_"on"-time / Fixed_time_interval ) * Revolution time * calibration_constant = L/km.

After some long time and some good experiences (and some bad . . .) me and Sylvio (more Sylvio than me), could calculate the fuel consumption using the Darrel´s Instant Interrupts.

We are reading the car´s speed (via timer 0), setting a 500 ms timer and reading the Injector´s in-time via CCP1 (I´m using a 16F877 and Sylvio a 16F88).

We are using the formula above to calculate the consumption, we are assuming that we have 2 injectors firing on each engine´s revolution.

Everything is ok, but Sylvio told me that when he is driving at 130 Km/h, the formula gives something like 30 Km / Liter (he did a modification on the formula to get this) What is really high (amazingly high…), since he is burning alcohol instead of gasoline.

Do you know if measuring just the on-time of one injector and the speed are really enough ?


Thank you !

Sérgio

srspinho
- 17th September 2007, 18:26
Hello friends !

Well, this last weekend, I did install my On-board computer in my Opel Corsa and drove about 250 km in a short trip to the beach.

I was driving in a very good road with a perfect asphalt. But, the road has some small declivity and some small ascent also.

When I´m driving at 90 km/h / 3500 RPM on 5th gear, in a very plain part of the road I can read a consumption of 14 / 15 Km / L (almost constant) - Normal for my small 1.0 L engine.

But, when in the same conditions I get a small declivity, the engine´s load is smaller so, the car´s ECU control the necessary amount of gasoline which is lower even if the speed and the RPM are the same. In this case I can read 20, 25, 30 km/l

In the other way, if I get a small ascent, the gasoline´s consumption gets really high and I can read something like 7 or 8 Km / L at the same conditions, since the engine needs to burn more gasoline to keep the speed.

I don´t know if it is right, but, I think it makes sense.

Regards !

Sérgio

leisryan
- 12th October 2007, 12:20
Guys
Whatabout if the injector is low impedance and using pwm to regulate current or voltage? how can we measure fuel then? do we need to create a fuel lookup table in a particular RPM range?

Yours trully
ryan

Acetronics2
- 12th October 2007, 14:23
Hi, Sergio

My '2004 Honda Civic 4 doors has a Genuine Fuel meter aboard ...

I confirm what you've seen ... differences due to road declivity are the same ratios ...

That confirms we drive with lead shoes !!!

Now, for absolute values ... just compare what you've put in your tank to what your computer tells ...

a simple ratio coeff. will perfectly fit !!!

Alain

srspinho
- 15th October 2007, 11:34
Thank You Alain !

Sérgio