Skip to main content

A Python library for interacting with OBDII.

Project description

PyPI version Python Version from PEP 621 TOML PyTest CI status Documentation Status (ReadTheDocs) Discord Support Server invite

Overview

Connect to any vehicle through its OBDII port and start reading real-time data from Python in a few lines of code.

Plug in a USB, Bluetooth, WiFi or Ethernet adapter, then query engine speed, fault codes, fuel level, VIN, and much more.

Whether you’re building a diagnostic tool, a performance data logger, a custom dashboard, a smart home integration, or just learning how vehicles communicate, this library handles the complexity of vehicle communication, so you don’t have to.

Installation

Python 3.8 or higher is required.

Install from PyPI using pip:

pip install py-obdii

For more installation options, see the Installation Guide.

Usage Example

from obdii import Connection, at_commands, commands
from obdii.utils.scan import scan_ports

# Find first available OBDII device connected via serial
ports = scan_ports(return_first=True)
if not ports:
    raise ValueError("No OBDII devices found.")

# Connect to the adapter
with Connection(ports[0]) as conn:
    # Query adapter firmware version
    version = conn.query(at_commands.VERSION_ID)
    print(f"Version: {version.value}")

    # Query vehicle's engine speed (rpm)
    response = conn.query(commands.ENGINE_SPEED)
    print(f"Engine Speed: {response.value} {response.units}")

More examples in the examples folder and Usage Guide.

Emulator Support

You don’t need a physical OBDII device to start developing.

You can use the ELM327-Emulator library to simulate an OBDII adapter and vehicle responses.

Setting Up the ELM327-Emulator

  1. Install the library with the sim extra options:

    pip install py-obdii[sim]
  2. Start the ELM327-Emulator:

    python -m elm -p "REPLACE_WITH_PORT" -s car --baudrate 38400

For platform-specific instructions, see the Emulating a Vehicle guide.

Hardware Requirements

For real-world usage, an ELM327-compatible OBDII adapter is required to connect to your vehicle.

  • USB: reliable, plug and play

  • Ethernet: reliable, low latency

  • Bluetooth: wireless, convenient

  • WiFi: wireless, mobile compatible

More information on connecting to different adapter types can be found in the Connection Guide.

Compatibility

All ELM327 protocols are supported, covering vehicles from the mid-1990s through today.

Protocol Support

ID

Protocol

Specifications

0x01

SAE J1850 PWM

41.6 Kbaud

0x02

SAE J1850 VPW

10.4 Kbaud

0x03

ISO 9141-2

5 baud init, 10.4 Kbaud

0x04

ISO 14230-4 KWP

5 baud init, 10.4 Kbaud

0x05

ISO 14230-4 KWP

fast init, 10.4 Kbaud

0x06

ISO 15765-4 CAN

11 bit ID, 500 Kbaud

0x07

ISO 15765-4 CAN

29 bit ID, 500 Kbaud

0x08

ISO 15765-4 CAN

11 bit ID, 250 Kbaud

0x09

ISO 15765-4 CAN

29 bit ID, 250 Kbaud

0x0A

SAE J1939 CAN

29 bit ID, 250 Kbaud

0x0B

USER1 CAN

11 bit ID, 125 Kbaud

0x0C

USER2 CAN

11 bit ID, 50 Kbaud

Support & Contact

Found a bug?

Have a question?

Your feedback is greatly appreciated and helps improve this project.


Follow our updates by leaving a star to this repository!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_obdii-0.10.4b0.tar.gz (654.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_obdii-0.10.4b0-py3-none-any.whl (54.3 kB view details)

Uploaded Python 3

File details

Details for the file py_obdii-0.10.4b0.tar.gz.

File metadata

  • Download URL: py_obdii-0.10.4b0.tar.gz
  • Upload date:
  • Size: 654.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_obdii-0.10.4b0.tar.gz
Algorithm Hash digest
SHA256 bd4e7346307ae7c2c907d1d2400b48193bd65544fafb5e5f589bf94803fd708a
MD5 05dc69134d68ee50d375769048dfc419
BLAKE2b-256 93d8fd8477c88f2a4a4df6f86dd5c66c81f78443ade5072cce574d1f2f1367c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_obdii-0.10.4b0.tar.gz:

Publisher: publish-to-pypi.yml on PaulMarisOUMary/OBDII

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_obdii-0.10.4b0-py3-none-any.whl.

File metadata

  • Download URL: py_obdii-0.10.4b0-py3-none-any.whl
  • Upload date:
  • Size: 54.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_obdii-0.10.4b0-py3-none-any.whl
Algorithm Hash digest
SHA256 b58c408c21a632a7789924db53154dfdd532eb4614f8c6311b74f1d0f69d2e1f
MD5 4d19f5a6670d7557572630b2b2f951fa
BLAKE2b-256 cf70eb0a50656b79c81c670de1376d0c6d82405e77e8c2453bf63b911526891b

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_obdii-0.10.4b0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on PaulMarisOUMary/OBDII

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page