Noobie Starting New Project

Discussion in 'Python' started by megafrenzy@gmail.com, Sep 22, 2005.

  1. Guest

    I've have an idea for a personal project. I want to access my car's
    OBD-II port via serial to query engine paramters and represent them on
    my PC monitor. The various methods to represent them would be any of
    the following: analog gauge (speedometer), digital readout, and X Y
    Plots/Charts (HP vs RPM, timing advance vs time, etc) - all on the same
    screen. Its probably been done before, but I have a Subaru, which
    allows me to use Subaru Select Monitor Protocol, which is faster (and
    easier to implement) than OBD-II. I also have a small 7" Widescreen VGA
    LCD in my dash, so I need to make sure everything is visable on a small
    screen and "unsqueeze" the image.

    I hope to keep developing the project to do a "virtual dyno", taking
    physical estimates of the car to calculate HP, torque as well as
    logging data to a text file, and other ideas like possibly
    incorporating GPS thru another serial port and maybe even some
    accelerometers (for Tilt and g's)

    I did find software that kinda does some of what I want, but its a case
    of "if you want it done right..."

    I've started using python 2 weeks ago to generate a "command line" file
    parsing program to allow me to take memory data from my excel file
    (saved as text) and generate FORTH commands for my ISOPOD (embedded
    DSP).

    I realy like the python language and all the modules that are
    available, but before I start, I just wanted to get some advice on
    which modules I should be using for the GUI and making charts, or if
    anyone has any examples that might help me along.
    , Sep 22, 2005
    #1
    1. Advertising

  2. Rubinho Guest

    Having looked in these sorts of areas before and having a general
    interest in it, I'd like to make some suggestions.

    I wouldn't go an implement OBD-II yourself in Python, especially not in
    a serial port. There are in fact (at least) 4 different OBD-II
    protocols that I won't rattle off the names of here because I can't
    remember them. You have to do strange things like setting the serial
    port to 5 baud, send a start byte, then set it to 10400 baud and wait
    an indeterminate amount of time for a reply etc. More info here
    (http://www.andywhittaker.com/ecu/obdii_software.htm). People have
    done it like this with varying degrees of success on specific car
    models (VAG-COM for VW and Audi cars for example) but never a generic
    solution.

    There is an implementation (http://freediag.sourceforge.net/) which
    works with various interfaces and protocols but it's not been touched
    since 2003. I could never get this working in my car as it doesn't
    support the OBD-II/CAN protocol. You could wrap this if you think it
    will work for you (UNIX only, no Win32 not even under cygwin).

    There are devices which plug into OBD-II and have a dongle on the end
    which does the OBD-II protocol detection and decoding for you and just
    gives you a serial stream out. These are much more reliable (and much
    more like what the "real" car industry uses). There are many but
    here's one supplier
    (http://www.gendan.co.uk/viewcategory.php?category=117). Googling for
    scantool will find the rest. Using python to either implement the
    proper serial protocol used by these or wrap their existing libraries
    (if they come with one) would, I think, be a much quicker and
    potentially more successful approach.

    As for other sensors, I found a great USB accelerometer
    (www.phidgets.com) which I've used in python. They supply a library
    with a COM interface so I used the pythonwin COM module to access it.
    They also have a more traditional C library (with source) if you want
    to wrap it with python, you'd need to do this if you want to use their
    Linux or Mac OSX libraries. Phidgets make a whole set of cheap sensors
    including temps, pressures etc. all accessible through USB.

    GPS is easy and there are numerous ways to implement NMEA or Garmin
    simple text protocols. Or you could use GPSD
    (http://gpsd.berlios.de/).

    I've been about to start a similar project, just using an accelerometer
    with temporal speed corrections using GPS for a little while now. I've
    got the maths sorted and the framework I just haven't decided on some
    of the finer details I was going to do it in C++ but python seemed a
    much better choice. The only thing that concerns me is a lack of a
    good timer but I must admit I've not looked into it too hard.

    I hope this gets you started.

    Cheers,

    Robin
    Rubinho, Sep 22, 2005
    #2
    1. Advertising

  3. megafrenzy Guest

    Well, I'm not too worried about the serial communications aspect, I've
    developed perhaps a dozen different RS-232, 422, 485, and even SPI,
    CANBUS interfaces in the past year for embedded systems. And also, the
    Subaru protocol is easier than OBDII, no need to change the baud to 5,
    its fixed at 4800 8 N 1 and you can make it faster with a simple
    command.

    Although I did not make it clear, my real questions were with Python's
    graphics. There are so many GUI options and I wasn't sure which one
    would be the best. I'm thinking that pyCard would be the easiest for me
    to pickup, from what I heard on the Python411 podcasts. But based on my
    hardware, could I expect screen refresh rates that can match the update
    rate of the serial port? I'm thinking 10-20 updates per sec would be
    the max I could get out of the serial port, depending on the max baud
    rate (currently undocumented/unknown but at least 38.4k) I could set it
    to.

    And for plotting, there are pleanty of plotting/charing options out
    there. I wanted to get some input on what I could use. I'm looking at
    matplotlip and gnuplot, but there are so many others.
    megafrenzy, Sep 22, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Flare
    Replies:
    1
    Views:
    473
    William F. Robertson, Jr.
    Sep 21, 2004
  2. Maziar Aflatoun
    Replies:
    1
    Views:
    483
    =?Utf-8?B?UGF1bA==?=
    Jan 22, 2005
  3. Greb
    Replies:
    3
    Views:
    485
    Thomas G. Marshall
    Jul 12, 2003
  4. Pingo
    Replies:
    2
    Views:
    325
    Thomas G. Marshall
    Sep 18, 2004
  5. kwele

    Error on starting new Web Services project

    kwele, Jun 4, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    116
    Michelle Hlaing
    Feb 28, 2005
Loading...

Share This Page