python-OBD

The ‘obd’ module for python is now available on pypi.

https://pypi.python.org/pypi/obd/0.1.0

or

$ pip install obd

When I initially set out to create a HUD for my car, I made the mistake of assuming that there were already python packages for handling OBD-II connections. While there were many projects implementing OBD-II (most of which forked from pyobd), I found that many of them bundled their connection code with their UI code. To fix this, my front-end project turned into a back-end project.

The obd package serves as a back-end for projects using sensor data from a vechicle’s OBD-II port. This module seemlessly handles querying and decoding of data, and returns response objects with values and units. Derived from the popular pyobd project, this package attempts to decouple the serial operations by encapsulating them in a python module. Since the initial fork of pyobd, it has been substantially overhauled. Here’s a brief summary of the changes:

  • Command Tables were extended up to PID 5F
  • Supports mode 2 commands (same as mode 1, but captures a freeze frame of when a DTC occured)
  • pyobd ‘Sensor’s became ‘OBDCommand’s, since not all commands return sensor values
  • Keeps better track of which commands are supported by the car
  • Commands can now be accessed by name, or by mode and PID value
  • Decoders were rewritten to return native metric units (as recieved from the car)
  • Full parsing of the status command (0101)
  • Simplified many operations through better use of the python stdlib

As always, the code can be found on my GitHub!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s