Shop OBEX P1 Docs P2 Docs Learn Events
Auto computer - tester with BS2 — Parallax Forums

Auto computer - tester with BS2

franklin9090franklin9090 Posts: 59
edited 2004-12-17 17:41 in BASIC Stamp
I would like to create a device to test my car (Mitsubishi)'s computer (Electronic Control Unit).

From what I understand the ECU puts out pulses of 12 volts on certain pins. By having a device that can count the pulses and display the count on an LCD, I could diagnose my car's problems. Incidentally, there is a pause between pulses, for example, there may be three pulses then a pause, three more pulses than a pause.

So, here are my questions...
1) is this something I should consider using a BS2 for?
2) I believe I can use the "pulse-in" command in PBasic, is this correct
3) How do I make sure that my BS2 can handle the 12V·pulses without destroying my BS2
4) what kinds of devices, capacitors, resistors, etc. should I consider in this process
5) can anyone give me some pointers on how to design this thing?

Unfortunately, I don't know the duration of the pulses or the pause in between, and I am a BS novice.

Any input would be appreciated.

Comments

  • KenMKenM Posts: 657
    edited 2004-12-12 10:41
    Franklin,

    Are talking about reading OBD-II diagnostic trouble codes?

    If that is the case·I can likely help in this area, and the task can be accomplished with your BS2.

    1. Exactly what model and year is your vehicle?

    2. What do you need to do to envoke the diagnostic code? (typically this might require shorting together two pins of a special connector)

    Ken
  • Larry~Larry~ Posts: 242
    edited 2004-12-12 15:15
    Please send me any info you are willing to share
    Larry Gaminde
  • franklin9090franklin9090 Posts: 59
    edited 2004-12-13 19:40
    >Are talking about reading OBD-II diagnostic trouble codes?

    Yes, but I am not sure my car gives off OBD-II codes...

    >If that is the case·I can likely help in this area, and the task can be accomplished with your BS2.

    >1. Exactly what model and year is your vehicle?

    I have a 1989 Mitsubishi·Mirage

    >2. What do you need to do to envoke the diagnostic code? (typically this might require shorting together two >pins of a special connector)

    I am not sure which wires to short, but from the auto repair manual, the ECU gives off 12volt pulses. The Chilton manual does not say how long the pulses are or how long the pauses are in between " waves" of pulses. Supposedly, if there are three pulses, the oxygen sensor is not working, etc.

    I have seen some examples of the use of an AD0831 A/D convertor but I am unsure if it can take the 12 volt pulses. Not only that, I am unsure how to count the number of pulses and the pauses in between the·pulses.

    From the little information I have, the ECU is supposed to give off the pulses if the car is cranked.
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-13 20:08
    Do you have the factory service manual for your car?
    I doubt the Chilton or Hayes would have it....but what you're after is the engine type.· Now I don't mean a 4cyl 2liter.
    There should be a...."build" tag somewhere on your car that would tell you the engine model code.
    You can look this up on the net and it should give you a clue what you have for code protocols.

    Looking down the list for OBD2....your car definately wouldn't have that as it didn't start until 1994/5.·
    You could have ODB1· (or just OBD?)

    Here's a quick blurb:

    What Communications Protocol does my vehicle use?

    As a rule of thumb, GM cars and light trucks use SAE J1850 VPW (Variable Pulse Width Modulation). Chrysler products and all European and most Asian imports use ISO 9141 circuitry. Fords use SAE J1850 PWM (Pulse Width Modulation) communication patterns.

    There are some variations among captive imports such as the Cadillac Catera, a German Opel derivative, which uses the European ISO 9141 protocol. If you have first hand knowledge of other such variations, please send them in and, together, we can build a more complete listing.

    On 1996 and later vehicles, you can tell which protocol is used by examining the OBD II connector:

    J1850 VPW--The connector should have metallic contacts in pins 2, 4, 5, and 16, but not 10.
    ISO 9141-2--The connector should have metallic contacts in pins 4, 5, 7, 15, and 16.
    J1850 PWM--The connector should have metallic contacts in pins 2, 4, 5, 10, and 16.

    If your vehicle has this style connector, but doesn't have these pins populated, you probably have a pre-OBDII vehicle. To add some confusion, even having the connector with the contacts shown above is not a guarantee of OBD II compliance. This style connector has been seen on some pre-1996 vehicles which were not OBD II compliant.

    The '95 Mirages do have a form of OBD2 but it's listed as not fully compliant.

    Anyhow, so far as how to read the codes....you kinda need to know how fast the pulses are coming.
    Then read up in the help file on the·COUNT command.
    Does the unit just fire out pulses in a fairly constant pattern?· or is there a morse-like coding to it?

    You shouldn't put more than 5Volts on a stamp pin....you'll need to throw a resistor in series with your signal.
    When we play with RS232 and don't want to fuss with a level shifter, we throw a 22kohm resistor on the IN line (Rx on the stamp).· Since the RS232 levels are around +/-12Vdc this resistor will help us protect the pin from blowing.
    HOWEVER, that being said, you should really know the current on your line (connect an Ammeter in line with the line you 'eventually' want to connect to the stamp).· I'd suspect that since it's a 'signal' line, that it wouldn't have too much current on there....

    I'll let others voice their opinions though! burger.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-13 20:56
    You CAN put more than 5 volts on a stamp pin IF you have a 22Kohm resistor in series. The PIC chip on the Stamp is quite robust -- it will take 25 mA before melting down, AND it has protection diodes in place to 'clip' excess voltage. It can do this successfully IF you limit the current with a series-resistor.

    Thus, you can connect +-12 volts to a BS2 pin -- IF you put a 22 Kohm resistor in series with it. (12 volts / 22 Kohm == 0.5 mA).
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-13 20:58
    AH....I stand corrected!

    Thanks Allan!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • franklin9090franklin9090 Posts: 59
    edited 2004-12-13 23:14
    >Do you have the factory service manual for your car?
    No, but based on the Chilton's manual, the ECU gives off 12 volt pulses. The number of pulses indicates the problem, for example,·3 12 volt pulses with a pause (repeated), may indicate a problem with an oxygen sensor.

    All (the few there are) codes are in the Chilton's manual.

    I don't think my car is OBD II compliant, its too old (1989).

    steve_b => thanks for the info. on OBD II, sound pretty complex....

    allanlane5 => thanks for the info. on "You CAN put more than 5 volts on a stamp pin IF you have a 22Kohm resistor in series"

    It sounds like I can put a 22K ohm resistor in series and attach it to one of my BS2 pins, and use the COUNT command to count the number of pulses. One of the problems I have outstanding is how to determine the length of the duration to use to the perform the count over.

    Of course, then I need to output the count info. to an LCD.
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-13 23:39
    You need to hook up a meter ( an oscilloscope would be preferable--but an analog voltmeter might be fast enough to catch it).
    Just time the pulses as they come out....the time from the beginning of the first pulse to the end of the last pulse (time between those PAUSES) is the time you need to use for your duration I guess.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • franklin9090franklin9090 Posts: 59
    edited 2004-12-14 16:31
    Steve_b,
    Unfortunately, I don't have an oscilloscope or analog voltmeter (I have a digital). I wonder if there is another way to determine th duration of each "wave" of pulses.

    Also, I wonder if anyone has a diagram that might illustrate how I would hook the BS2, etc. up?
    I am a newbie to using the Basic Stamp 2 and· could use all the help I can get.·· :-)

    Thanks.
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-14 18:47
    If you're not in a panic to set this up...then take them time to go through old posts and some of the articles on the parallax website.

    Trust me, if you're going to play with the stamp, you'll want to know how to use it....rather than hook it up like other ppl say (also helps to know it end to end when troubleshooting).

    If you go to the parallax website, you can find the Education material (which is a great way to start -- BABY STEPS) and there are all sorts of Nutz & Voltz articles there as well.



    As far as building this 'diagnostic tool'....how will you know it's giving you the proper data.· What I mean is....if I hook up a temp sensor...how do I know it's accurate; I have to compare it against a thermometer or some other 'calibrated' temperature source.

    So, you can tell the stamp to look for 3pulses and say that it's the O2 sensor....or 20 pulses for high charging voltage....but how will you know for sure.

    It might be nice to 'borrow'/'rent' a diag tool and compare it to what your stamp is seeing.· This would also help you gage what to look for in regards to pulse counts and widths....sometimes trial & error works too!· Just make a guess!



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • franklin9090franklin9090 Posts: 59
    edited 2004-12-15 16:52
    steve_b,

    please see my comments below....

    >If you're not in a panic to set this up...then take them time to go through old posts and some of the articles >on the parallax website.

    >Trust me, if you're going to play with the stamp, you'll want to know how to use it....rather than hook it up >like other ppl say (also helps to know it end to end when troubleshooting).

    I agree with you on this one. My general philosophy has been to select a project to implement and then challenge myself to learn the technology required to fulfill the project. I have had a BS2 in my possession but had not found a project for it. But now, since I have a problem related to the ECU in a car, I think I have a viable project to partake in and learn the BS2.

    >If you go to the parallax website, you can find the Education material (which is a great way to start -- BABY >STEPS) and there are all sorts of Nutz & Voltz articles there as well.

    ·Thanks for the sound advice.

    >As far as building this 'diagnostic tool'....how will you know it's giving you the proper data.· What I mean >is....if I hook up a temp sensor...how do I know it's accurate; I have to compare it against a thermometer or >some other 'calibrated' temperature source.

    >So, you can tell the stamp to look for 3pulses and say that it's the O2 sensor....or 20 pulses for high charging >voltage....but how will you know for sure.

    You pose interesting questions which I think I can address to a limited extent. My Chilton's manual recommends an analog voltmeter be hooked up to the ECU and that the sweeps of the meter be counted. My concern with this technique was my ability to count the sweeps ( I was afraid they may be too fast or that I would be in an awkward position under the dash and not be able to read the meter adequately). So, I thought if I had a microcontroller counting the sweeps for me, all I would have to do is read the meter. Plus, I don't totally trust the Chilton's manuals, since they tend to be written in a generic fashion (same text for several model cars).

    In addition, I have a digital VOM, so I would have to get my hands on an analog one...

    >It might be nice to 'borrow'/'rent' a diag tool and compare it to what your stamp is seeing.· This would also >help you gage what to look for in regards to pulse counts and widths..

    I had considered this, after your last recommendation. In addition, I have done some reading and have found out that a PC could be used as an oscilloscope but is limited to 20MHZ. I also read that for auto diagnostic purposes, 10 MHz would be sufficient. So, this may be an option, but it seems that these PC based osciloscopes use the sound card and it is unclear how to hook up the interface between the PC/sound card and the device you are testing.

    Not only that, it means getting a PC out to the car with power and all..... urgh.......

    >..sometimes trial & error works too!· Just make a guess!

    I thought about trial and error too...... but would like a better solution, if possible....

    I have a book called "The Microcontroller Application Cookbook" that illustrates various way to interface the BS2. In one of the circuits looks like this:

    BS2 (p0) ---- 74HC14 ---|-- R2K--- +
    ································ |--R1K---· -

    I hope my diagram makes sense. Basically, the 12VDC input would come through the two resistors (on the right) and would be stepped down the 5VDC to be fed into the 74HC14. The book doesn't explain what the 74HC14 is, but explains that it smooths the voltage spikes.

    There is also an example of an optoisolator....I like this approach because it protects my BS2 and I could use it on other projects.

    In both cases, I would be challenged to try them. As I said before, I usually like to start with a project and then build on it.

    From a circuit standpoint, I think either one of these is fine, but they still don't solve my pulse count/pause problem.
    Hmmmm.... need to do more research.
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-15 20:13
    Here's a quick little circuit I threw together to 'isolate' some serial data lines (RS232 lines).
    Since RS232 is 12volts, it makes sense that it would work with your 12volt pulses as well.

    Did you happen to pick up an A/D converter with your stamp gear?
    What I'm thinking is....
    If you can peg down a program to sample, using your A/D, about 10 or 20 times per second, then you could, in effect, graph your own oscilloscope.
    Use the StampDAQ software off of Parallax's website (it's free!! smilewinkgrin.gif ).· I THINK this plots with time so you could get an idea of the period of your pulses.
    I haven't played with it much, but there was another thread in the BASIC Stamp forum for logging serial data to be read by Excel...which you could then graph.·
    Measuring the pulses is no big deal....it's the pause in between each 'batch' of pulses that you want to recognize!·

    OR...just had to look up the command....use the COUNT command over a given duration.· This tells the number of 0-1-0 or 1-0-1 transitions in a given period.· This basically does the same thing as the whole stampDAQ way.· All you're after is the timing of the pulses....so, if you know there are 3pulses at the moment, then just adjust your duration time so that you only get a pulse count reflecting the 3 pulses.

    The downside of this, as it says in the help file for COUNT, that while the sine wave transitions through the threshold level, you may get false counts from noise...here is where the recommend using the 74HC14...which is a schmidt trigger.· Not sure how to describe this guy....but he basically buffers your switching so that it's not as susceptible to false noise triggers.· (Used in debounce circuits with mechanical switches).

    If this post seems a bit 'here and there'....I've had a bunch of calls on the phone and keep getting distracted! haha



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

    1024 x 820 - 77K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2004-12-15 21:17
    Have anyone successfully interfaced the BS2 to an OBD-II car computer?· Even from way back in the Yahoo Groups I remember threads on this subject, but don't recall anyone saying they had done it.· Let's face it, I'm sure there are alot of us here who'd love to be able to build our own handheld Auto-Tester that' OBD-II compliant.· Maybe have a nice 20X4 LCD Display, membrane keypad, etc.· All my searches in the past found sites that touched briefly on the protocol, but were almost always ads for someone else's tester that you could buy.· If I could build it myself, I would.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs
    ·
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-15 23:50
    I used to have a nice link to a couple of sites...but they only stated the protocol as VPWM or PWM...nothing much else.
    Although the ISO (european) ones do go in to a bit of the HEX codes returned....

    Anyhow, I have been itching for some sort of project, and being that my warrantee is running out on my Jeep, I'll be tinkering with it more (Not sure if that's wise! haha)



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2004-12-16 02:24
    I guess I can see the reluctance on sharing the information by those who stand to profit from it's use...But there are enough of us Hackers out there who like the information for non-profit use.· I myself make anything I come up with freely available if it's not part of an NDA design.· However, I am surprised at the number of things people hack, and the sheer lengths they go to getting technical information.· Things like Furbies!· Cue-cats!· Robosapiens!· Electronic toys!

    Yet here is something that would be common to more people (More people have cars than furbies, I hope!) and yet there are no hacker pages out there that I can find.· Well, maybe some day if I get about a million other projects done I will get in there and find out myself...By then it will probably be OBD-IV or something!· eyes.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs
    ·
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-16 02:53
    I totally agree....open source is definately the way to go....
    But I remember when the Internet was in it's infancy and lots of things were free....seems like every place is 'pulling back' and starting to charge!

    I wonder if the standards are copyrighted or something and that people can't open publish them; although, there ARE books about it.

    I saw plenty of tools for sale and a few places selling interface ICs just.· I'm sure the Stamp can handle all the standards with a bit of tweaking here and there.
    I think I'll take this one on.·

    REading out the data should be somewhat easy....but it'd be nice to have a semi-intuitive display that wouldn't JUST give you the trouble-code, but would tell you what the code means.· There are LOTS of codes....would hate to run out of room and have to mess with an Eprom...although I really should experience using one! tongue.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • franklin9090franklin9090 Posts: 59
    edited 2004-12-17 17:41
    Steve_b,
    >Here's a quick little circuit I threw together to 'isolate'...
    Thanks.

    >Did you happen to pick up an A/D converter with your stamp gear?
    I haven't picked a A/D converter, do you recommend one over the use of a 74H and resistors??

    >If you can peg down a program to sample, using your A/D, about 10 or 20 times per second, then you could,
    > in effect, graph your own oscilloscope.
    >Use the StampDAQ software off of Parallax's website (it's free!!· ).
    When you said "peg down", what do you mean?
    I have to admit the StampDAQ would seem to give me the timing and the pulses...
    It doesn't seem to be realtime, but I don't need that any way.

    >Measuring the pulses is no big deal....it's the pause in between each 'batch' of pulses
    > that you want to recognize!·
    I hear you there...!

    Chris Savage,
    >Have anyone successfully interfaced the BS2 to an OBD-II car computer?·
    I was hoping to interface it to a car built in 1989 (pre-OBD), but if it could be done in a universal fashion
    usable by all car owners, it would be great.

    Steve_b,
    >....but it'd be nice to have a semi-intuitive display that
    User friendly software.... hmmm...
    Need to do some more research....
Sign In or Register to comment.