A Python library for interacting with OBDII.
Project description
A modern, easy to use, Python ≥3.8 library for interacting with Vehicles via OBDII devices.
Overview
This library lets you interact with almost any vehicles through the OBDII (On-Board Diagnostics II) port.
Connect through an OBDII adapter via USB, Bluetooth, WiFi, or Ethernet to monitor sensors, read diagnostic data, retrieve trouble codes, and access a wide range of vehicle information.
Whether you’re building:
A Diagnostic Tool
A Performance Data Logger
A Car Maintenance Tracker
A Custom Dashboard Display
A Vehicle Option Unlocker
A Smart Home Vehicle Integration
A Fleet Management System
A Real-time Vehicle Health Monitor
An App to learn about Automotive Systems
Or any other automotive applications..
The library handles the complexity of vehicle communication and provides the foundation you need for developing your automotive projects.
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
Install the library with the sim extra options:
pip install py-obdii[sim]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
Bluetooth: wireless, convenient
WiFi: wireless, mobile compatible
More information on connecting to different adapter types can be found in the Connection Guide.
Compatibility
Supported Vehicles
Almost every vehicle from 2008 onwards should be compatible (CAN Protocols). In future updates additional protocols and olders vehicles will be supported.
Protocol Support
ID |
Protocol |
Specifications |
Supported |
|---|---|---|---|
0x01 |
SAE J1850 PWM |
41.6 Kbaud |
No |
0x02 |
SAE J1850 VPW |
10.4 Kbaud |
No |
0x03 |
ISO 9141-2 |
5 baud init, 10.4 Kbaud |
No |
0x04 |
ISO 14230-4 KWP |
5 baud init, 10.4 Kbaud |
No |
0x05 |
ISO 14230-4 KWP |
fast init, 10.4 Kbaud |
No |
0x06 |
ISO 15765-4 CAN |
11 bit ID, 500 Kbaud |
Yes |
0x07 |
ISO 15765-4 CAN |
29 bit ID, 500 Kbaud |
Yes |
0x08 |
ISO 15765-4 CAN |
11 bit ID, 250 Kbaud |
Yes |
0x09 |
ISO 15765-4 CAN |
29 bit ID, 250 Kbaud |
Yes |
0x0A |
SAE J1939 CAN |
29 bit ID, 250 Kbaud |
Yes |
0x0B |
USER1 CAN |
11 bit ID, 125 Kbaud |
Yes |
0x0C |
USER2 CAN |
11 bit ID, 50 Kbaud |
Yes |
Support & Contact
For questions start a discussion on Github, for support open an issue. Your feedback and questions are greatly appreciated and will help improve this project !
Thank you for using or contributing to this project.
Follow our updates by leaving a star to this repository !
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_obdii-0.10.1b0.tar.gz.
File metadata
- Download URL: py_obdii-0.10.1b0.tar.gz
- Upload date:
- Size: 650.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43ebb33bdd2158451fdbedf881bab97c8744f00ab5762f63928303711374e313
|
|
| MD5 |
146e2287d5bf8f4a61486b2e703d7ef3
|
|
| BLAKE2b-256 |
ccfb8b44f4aa5f6bc6ff5ff719339d96fa392ea7fba00c91cbe36d696b86acdb
|
Provenance
The following attestation bundles were made for py_obdii-0.10.1b0.tar.gz:
Publisher:
publish-to-pypi.yml on PaulMarisOUMary/OBDII
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_obdii-0.10.1b0.tar.gz -
Subject digest:
43ebb33bdd2158451fdbedf881bab97c8744f00ab5762f63928303711374e313 - Sigstore transparency entry: 1449650121
- Sigstore integration time:
-
Permalink:
PaulMarisOUMary/OBDII@1b9de33ee3772fe4b40b9d916b2f3198a5e6e8e1 -
Branch / Tag:
refs/tags/v0.10.1b - Owner: https://github.com/PaulMarisOUMary
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@1b9de33ee3772fe4b40b9d916b2f3198a5e6e8e1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file py_obdii-0.10.1b0-py3-none-any.whl.
File metadata
- Download URL: py_obdii-0.10.1b0-py3-none-any.whl
- Upload date:
- Size: 49.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64aafa21ad6b95e9312b16ad00c0f29cd6efba1d7670cd26b3a0e7a49ee95f9d
|
|
| MD5 |
d9d12cd94f564949c25d040c2d878197
|
|
| BLAKE2b-256 |
4c719c0717c2d8756db3da2b5cf228b1847bb346a40cbffb2c04b9751c69b398
|
Provenance
The following attestation bundles were made for py_obdii-0.10.1b0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on PaulMarisOUMary/OBDII
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_obdii-0.10.1b0-py3-none-any.whl -
Subject digest:
64aafa21ad6b95e9312b16ad00c0f29cd6efba1d7670cd26b3a0e7a49ee95f9d - Sigstore transparency entry: 1449650128
- Sigstore integration time:
-
Permalink:
PaulMarisOUMary/OBDII@1b9de33ee3772fe4b40b9d916b2f3198a5e6e8e1 -
Branch / Tag:
refs/tags/v0.10.1b - Owner: https://github.com/PaulMarisOUMary
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@1b9de33ee3772fe4b40b9d916b2f3198a5e6e8e1 -
Trigger Event:
push
-
Statement type: