Noobie Starting New Project
robin.cull at gmail.com
Thu Sep 22 12:23:26 CEST 2005
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
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
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.
More information about the Python-list