Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 34

Thread: Yet Another OBDII VB6 Class

  1. #11

  2. #12
    Maximum Bitrate carabuser's Avatar
    Join Date
    Aug 2003
    Location
    CA
    Posts
    464
    So anyone used it yet?
    Current Status: For Sale

    Specs
    - 1.5Ghz Toshiba Laptop (available - no screen)
    - Indash Motorized 7" VGA TS
    - DeLorme GPS (sold)
    - Power Inverter (sold)
    - Pioneer HU (sold)

  3. #13
    See me in my wet t-shirt. stevieg's Avatar
    Join Date
    Aug 2003
    Location
    Warwickshire, UK
    Posts
    1,887
    Quote Originally Posted by carabuser
    So anyone used it yet?

    Yes!!!

    I'm using it! It works - My app isn't finished yet, but it's a re-hash of this:

    OBDII / Elm MPG meter. Almost working but not quite!

    The OBDII stuff is working very well. I've successfully had it running for hours on end pulling out the data. My MPG calculations seem to be a bit iffy though - I am having trouble finding a comprehensive list of all the basic formulas for temp, mass air flow etc for when I'm converting from the output long to it's 'real' value! I found one a long time ago when I first started on this, before your VB6 class, but can't find it now, so having a little trouble double checking everything.

    I haven't tested standby/resume properly yet - my only try resulted in failure but I was thinking about polling for the standby system call and disconnecting, then on resume reconnecting if it causes any issues - my main thing is getting the instant MPG quick and reliable.

    But yes... It works!
    Ford Focus MP3 : www.stevieg.org/carpc Blog Updated 29 January 2009!
    Car PC Status: Complete - Undergoing Software Redevelopment

  4. #14
    Maximum Bitrate knubile's Avatar
    Join Date
    Sep 2004
    Posts
    505
    Any progress on this? I'm wondering if MPG calculations are possible using OBD-II.

  5. #15
    Low Bitrate Erorus's Avatar
    Join Date
    Feb 2005
    Location
    NEPA
    Posts
    100
    Quote Originally Posted by knubile
    Any progress on this? I'm wondering if MPG calculations are possible using OBD-II.
    PHP Code:
    Function GetMPG(tMAF As VarianttSpeed As VarianttLTFuelTrim As Variant) As Variant

    ''MAF is maf_air_flow sensorTo convert from what the OBD returnsvalue=OBDData 0.01
    ''tSpeed is vehicle speed in MPHTo convert from what the OBD returnsvalue=OBDData 0.621371192
    ''tLTFuelTrim is long-term fuel trimTo convert from what the OBD returnsvalue=0.7812 * (OBDData 128)
        
        If 
    IsNull(tMAF) Or IsNull(tSpeed) Or IsNull(tLTFuelTrimThen
            GetMPG 
    Null
            
    Exit Function
        
    End If

        
    Dim tMPG As String

        
    '' Do MAF over an hour
        tMAF 
    tMAF 60
        tMAF 
    tMAF 60

        
    '' Turn into KG/litre equivalent
        tMAF 
    tMAF 1000

        
    '' Get petrol flow based on 14.7:1
        tMAF 
    tMAF 14.7

        
    '' convert litres to gallons
        tMAF 
    tMAF 0.219969157

        
    '' convert long term fuel trim to percentage
            tLTFuelTrim 
    = (tLTFuelTrim 100) + 1

        
    '' Calculate MPG
        tMPG 
    = (tSpeed tMAF) * tLTFuelTrim

        GetMPG 
    FormatNumber(tMPG1TrueFalseFalse)
    End Function 
    The problem I have with this is the air flow sensor is very optimistic, and you probably run richer than this formula indicates. It says I average around 60-90MPG when cruising on the hwy and up to 200+ MPG when coasting. However, it does change when you have the pedal down, etc. I forget where I stole this code from.

  6. #16
    See me in my wet t-shirt. stevieg's Avatar
    Join Date
    Aug 2003
    Location
    Warwickshire, UK
    Posts
    1,887
    Quote Originally Posted by Erorus
    PHP Code:
    Function GetMPG(tMAF As VarianttSpeed As VarianttLTFuelTrim As Variant) As Variant

    ''MAF is maf_air_flow sensorTo convert from what the OBD returnsvalue=OBDData 0.01
    ''tSpeed is vehicle speed in MPHTo convert from what the OBD returnsvalue=OBDData 0.621371192
    ''tLTFuelTrim is long-term fuel trimTo convert from what the OBD returnsvalue=0.7812 * (OBDData 128)
        
        If 
    IsNull(tMAF) Or IsNull(tSpeed) Or IsNull(tLTFuelTrimThen
            GetMPG 
    Null
            
    Exit Function
        
    End If

        
    Dim tMPG As String

        
    '' Do MAF over an hour
        tMAF 
    tMAF 60
        tMAF 
    tMAF 60

        
    '' Turn into KG/litre equivalent
        tMAF 
    tMAF 1000

        
    '' Get petrol flow based on 14.7:1
        tMAF 
    tMAF 14.7

        
    '' convert litres to gallons
        tMAF 
    tMAF 0.219969157

        
    '' convert long term fuel trim to percentage
            tLTFuelTrim 
    = (tLTFuelTrim 100) + 1

        
    '' Calculate MPG
        tMPG 
    = (tSpeed tMAF) * tLTFuelTrim

        GetMPG 
    FormatNumber(tMPG1TrueFalseFalse)
    End Function 
    The problem I have with this is the air flow sensor is very optimistic, and you probably run richer than this formula indicates. It says I average around 60-90MPG when cruising on the hwy and up to 200+ MPG when coasting. However, it does change when you have the pedal down, etc. I forget where I stole this code from.

    It looks like my botched attempt at MPG conversion I think.

    I didn't think it was accurate as it could be either, and haven't actually used it in real-life.

    Any idea what could be done using the OBD to get a more accurate measure?
    Ford Focus MP3 : www.stevieg.org/carpc Blog Updated 29 January 2009!
    Car PC Status: Complete - Undergoing Software Redevelopment

  7. #17
    Low Bitrate
    Join Date
    Jun 2007
    Posts
    76
    does anyone have this class working?
    If so, could you post a sample app to be looked at?
    Thanx

  8. #18
    Newbie
    Join Date
    Aug 2005
    Location
    Ohio
    Posts
    12
    Quote Originally Posted by takissd View Post
    great! will that work with vb.net??? if yes, how?
    You can attempt to convert it into .NET. But its very possible it will get botched up. At least that's been my experience with most of the .NET conversions I've done.
    2006 Nissan Maxima SE
    2002 GMC Envoy SLT
    Digital Deviation

  9. #19
    Low Bitrate
    Join Date
    Jul 2006
    Posts
    67
    Hi guys, I am programmer too. While I am mostly involved in database/plsql programming I have fooled around with C/C++ and some VB. Assembly too!
    Can anyone tell me if there would any substantial performance difference between a typical serial communication tool for OBDII written in C/C++ versus VB/.net ? Think CAN too.

  10. #20
    Low Bitrate
    Join Date
    Jun 2007
    Posts
    76
    Sample app that I am trying to get to work with this class, I am not sure how to "pass a mscomm control, the port number, and a timer control to it" ?
    Can some one help get me started with this?
    Attached Files Attached Files

Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Able to get voltage from OBDII?
    By aoLhaTer in forum Engine Management, OBD-II, Engine Diagnostics, etc.
    Replies: 10
    Last Post: 07-18-2007, 09:26 PM
  2. FS: OBDII diagnostic interface
    By deskcom in forum Classified Archive
    Replies: 0
    Last Post: 12-09-2004, 11:24 PM
  3. @ Leddy OBDII
    By gyro in forum NeoCar Media Center
    Replies: 4
    Last Post: 12-08-2004, 06:43 PM
  4. Pick my Programing class for me!
    By Sonicxtacy02 in forum Off Topic
    Replies: 14
    Last Post: 11-23-2004, 08:59 PM
  5. 1994 Saab 900 & OBDII
    By Shark in forum General Hardware Discussion
    Replies: 2
    Last Post: 11-03-2003, 08:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •