brendan-w / python-OBD

OBD-II serial module for reading engine data
GNU General Public License v2.0
1.02k stars 360 forks source link

python-OBD

A python module for handling realtime sensor data from OBD-II vehicle ports. Works with ELM327 OBD-II adapters, and is fit for the Raspberry Pi.

Installation

$ pip install obd

Basic Usage

import obd

connection = obd.OBD() # auto-connects to USB or RF port

cmd = obd.commands.SPEED # select an OBD command (sensor)

response = connection.query(cmd) # send the command, and parse the response

print(response.value) # returns unit-bearing values thanks to Pint
print(response.value.to("mph")) # user-friendly unit conversions

Documentation

Available at python-obd.readthedocs.org

Commands

Here are a handful of the supported commands (sensors). For a full list, see the docs

note: support for these commands will vary from car to car

Common Issues

Bluetooth OBD-II Adapters

There are sometimes connection issues when using a Bluetooth OBD-II adapter with some devices (the Raspberry Pi is a common problem). This can be fixed by setting the following arguments when setting up the connection:

fast=False, timeout=30

License

GNU GPL v2

This library is forked from:

Enjoy and drive safe!