A Python-based tool that connects to a vehicle's OBD-II port and fetches real-time diagnostic data — such as speed, RPM, engine temperature, fuel level, and more — directly from the car's ECU.
- 🔌 Connects to any car via a Bluetooth / USB OBD-II adapter (ELM327)
- 📊 Reads live data: speed, RPM, coolant temperature, fuel level, throttle position, and more
- 🧠 Decodes raw OBD-II PIDs into human-readable values
- 💾 Logs data to CSV for later analysis
- 🧪 Includes a mock mode (
OBD-mock.py) for testing without a car or adapter - ⚡ Lightweight — works on a laptop or Raspberry Pi in the car
- Python 3
python-OBD— library for OBD-II communication- PySerial — handles the serial/Bluetooth connection to the adapter
graph LR
A[Car ECU] -->|OBD-II Port| B[ELM327 Adapter]
B -->|Bluetooth / USB / Serial| C[Python Script]
C --> D[python-OBD Decoder]
D --> E[Live Terminal Display]
D --> F[(CSV Log File)]
Flow: The car's ECU exposes live sensor data through the OBD-II port → an ELM327 adapter translates this into a serial/Bluetooth signal → the Python script connects to that adapter, sends PID requests, decodes the responses, and displays or logs the results.
OBD-Python/
├── OBD-v6.py # Latest/main version — run this one
├── OBD-v5.py # Earlier iteration
├── OBD-v4.py # Earlier iteration
├── OBD-v3.py # Earlier iteration
├── OBD-v2.py # Earlier iteration
├── OBD-v1.py # First working version
├── OBD-mock.py # Simulated OBD data — no adapter/car needed
├── veh_config.json # Per-vehicle configuration
├── obd_dataset.csv # Sample dataset
├── obd_log_20250705_155130.csv # Example logged session
└── README.md
🚧 Note: This repo currently has several versioned files (
OBD-v1.py→OBD-v6.py) from active development.OBD-v6.pyis the most current — the older versions are kept for reference but will likely be moved into an/archivefolder in a future cleanup. If you're just trying the project, start withOBD-v6.py.
# Clone the repository
git clone https://github.com/QaximGhumman/OBD-Python.git
cd OBD-Python
# Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install obd pyserialpython OBD-mock.pyThis simulates OBD-II responses so you can see how the tool works before connecting real hardware.
- Plug an ELM327 OBD-II adapter (Bluetooth or USB) into your car's OBD-II port (usually under the dashboard)
- Pair/connect the adapter to your laptop or Raspberry Pi
- Update
veh_config.jsonwith your adapter's connection details if needed - Run:
python OBD-v6.py- You'll see live data streaming in the terminal:
Speed: 42 km/h
RPM: 2100
Coolant Temp: 89°C
Fuel Level: 63%
import obd
connection = obd.OBD() # auto-connects to USB or RF port
cmd = obd.commands.SPEED
response = connection.query(cmd)
print(f"Speed: {response.value}")- Add a live graph (speed/RPM over time) using Matplotlib
- Build a simple GUI dashboard
- Support exporting to a database (SQLite)
- Add DTC (trouble code) reading & clearing
- Consolidate
OBD-v1.py–OBD-v6.pyinto a single, documented entry point
Want to help with any of these? Check out CONTRIBUTING.md — there are good-first-issue ideas ready to go.
Contributions are welcome! See CONTRIBUTING.md for setup instructions, how to test without a car using OBD-mock.py, and a list of good first issues.
This project is licensed under the MIT License.
Qasim Ali Ghumman Portfolio · LinkedIn · contactqaxim@gmail.com