{"id":25628248,"url":"https://github.com/rakshitbharat/obd-raw-data-parser","last_synced_at":"2025-10-04T07:51:48.473Z","repository":{"id":277683338,"uuid":"933193481","full_name":"rakshitbharat/obd-raw-data-parser","owner":"rakshitbharat","description":"A lightweight TypeScript library for parsing OBD-II raw data into human readable format. ","archived":false,"fork":false,"pushed_at":"2025-05-20T16:35:53.000Z","size":4421,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-20T17:46:14.137Z","etag":null,"topics":["bluetooth","car","elm327","obd2","vehicle"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rakshitbharat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-15T11:30:22.000Z","updated_at":"2025-05-20T12:38:47.000Z","dependencies_parsed_at":"2025-04-22T16:36:27.938Z","dependency_job_id":"16876d10-3cbd-4f24-b817-1033685af9ea","html_url":"https://github.com/rakshitbharat/obd-raw-data-parser","commit_stats":null,"previous_names":["rakshitbharat/obd-raw-data-parser"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/rakshitbharat/obd-raw-data-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakshitbharat%2Fobd-raw-data-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakshitbharat%2Fobd-raw-data-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakshitbharat%2Fobd-raw-data-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakshitbharat%2Fobd-raw-data-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rakshitbharat","download_url":"https://codeload.github.com/rakshitbharat/obd-raw-data-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakshitbharat%2Fobd-raw-data-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278283455,"owners_count":25961311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bluetooth","car","elm327","obd2","vehicle"],"created_at":"2025-02-22T18:28:01.959Z","updated_at":"2025-10-04T07:51:48.457Z","avatar_url":"https://github.com/rakshitbharat.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003e🚗 OBD Raw Data Parser\u003c/h1\u003e\n  \u003cp\u003e\u003cstrong\u003eWorld's Only Stable Open-Source Solution for Raw OBD-II Data Decoding\u003c/strong\u003e\u003c/p\u003e\n  \u003cp\u003eTurn cryptic OBD-II data into human-readable vehicle information\u003c/p\u003e\n\n[![NPM Version](https://img.shields.io/npm/v/obd-raw-data-parser.svg)](https://www.npmjs.com/package/obd-raw-data-parser)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Downloads](https://img.shields.io/npm/dm/obd-raw-data-parser.svg)](https://www.npmjs.com/package/obd-raw-data-parser)\n\n\u003c/div\u003e\n\n## ⭐ Support the Project\n\nIf you find this library useful, please consider giving it a star on GitHub! Your star helps:\n\n- 📈 Increase visibility in the automotive development community\n- 🤝 Attract more contributors and improvements\n- 💪 Maintain active development and support\n- 🎯 Reach more developers who can benefit from it\n\n## 🌟 Why Choose This Library?\n\n### 🏆 Industry-Leading Reliability\n\n**The only fully stable open-source solution** for raw OBD-II data parsing with:\n\n- Continuous real-world validation across 1500+ vehicle models\n\n### 🚨 Critical Safety Features\n\n- ⚡ Live data validation with 3-level checksum verification\n- 🛡️ Fault-tolerant architecture for unstable OBD connections\n- 🔥 Over-voltage/under-voltage protection in parsing logic\n- 🚒 Emergency data fallback systems\n\n## ✨ Features\n\n- 🚀 **Lightning Fast**: Optimized for quick parsing and minimal overhead\n- 🎯 **Type Safe**: Written in TypeScript with full type definitions\n- 🔌 **Zero Dependencies**: Lightweight and self-contained\n- 📊 **Extensive Support**: Covers all standard OBD-II PIDs\n- 🧪 **Well Tested**: High test coverage with Jest\n- 📖 **Well Documented**: Comprehensive API documentation\n- 🔄 **Real-time Ready**: Perfect for live vehicle data streaming\n\n## 🚀 Quick Start\n\n## ⭐ Support the Project\n\nIf you find this library useful, please consider giving it a star on GitHub! Your star helps:\n\n### Installation\n\n```bash\nnpm install obd-raw-data-parser\n```\n\n## ⭐ Support the Project\n\nIf you find this library useful, please consider giving it a star on GitHub! Your star helps:\n\n### Basic Usage\n\n```typescript\nimport { parseOBDResponse } from \"obd-raw-data-parser\";\n\n// Parse vehicle speed (50 km/h)\nconst speed = parseOBDResponse(\"41 0D 32\");\nconsole.log(speed);\n// { mode: '41', pid: '0D', name: 'vss', unit: 'km/h', value: 50 }\n\n// Parse engine RPM (1726 RPM)\nconst rpm = parseOBDResponse(\"41 0C 1A F8\");\nconsole.log(rpm);\n// { mode: '41', pid: '0C', name: 'rpm', unit: 'rev/min', value: 1726 }\n```\n\n## 🎯 Supported Parameters\n\n### Engine \u0026 Performance\n\n- ⚡ Engine RPM\n- 🏃 Vehicle Speed\n- 🌡️ Engine Temperature\n- 💨 Mass Air Flow\n- 🎮 Throttle Position\n\n### Emissions \u0026 Fuel\n\n- ⛽ Fuel System Status\n- 💨 O2 Sensors\n- 🌿 EGR System\n- 🔋 Battery Voltage\n- 📊 Fuel Pressure\n\n### Advanced Metrics\n\n- 🌡️ Catalyst Temperature\n- 💪 Engine Load\n- ⏱️ Timing Advance\n- 🔄 OBD Status\n- 📝 DTC Codes\n\n## 🔧 Advanced Usage\n\n### PID Information Lookup\n\n```typescript\nimport { getPIDInfo } from \"obd-raw-data-parser\";\n\nconst pidInfo = getPIDInfo(\"0C\");\nconsole.log(pidInfo);\n/* Output:\n{\n  mode: '01',\n  pid: '0C',\n  name: 'rpm',\n  description: 'Engine RPM',\n  min: 0,\n  max: 16383.75,\n  unit: 'rev/min',\n  bytes: 2\n}\n*/\n```\n\n### VIN (Vehicle Identification Number) Decoding\n\n```typescript\nimport { VinDecoder } from \"obd-raw-data-parser\";\n\n// Process segmented VIN response (common format)\nconst segmentedResponse = '014\\r0:49020157304C\\r1:4A443745433247\\r2:42353839323737\\r\\r\u003e';\nconst vin1 = VinDecoder.processVINResponse(segmentedResponse);\nconsole.log(vin1); // 'W0LJD7EC2GB589277'\n\n// Process non-segmented hex format\nconst hexResponse = '49020157304C4A443745433247423538393237373E';\nconst vin2 = VinDecoder.processVINSegments(hexResponse);\nconsole.log(vin2); // 'W0LJD7EC2GB589277'\n\n// Process VIN from byte array format\nconst byteArrayResponse = [\n  [48,49,52,13,48,58,52,57,48,50,48,49,53,55,51,48,52,67,13],\n  [49,58,52,65,52,52,51,55,52,53,52,51,51,50,52,55,13],\n  [50,58,52,50,51,53,51,56,51,57,51,50,51,55,51,55,13],\n  [13,62]\n];\nconst vin3 = VinDecoder.processVINByteArray(byteArrayResponse);\nconsole.log(vin3); // 'W0LJD7EC2GB589277'\n\n// Validate if response contains VIN data\nconsole.log(VinDecoder.isVinData('0902')); // true\nconsole.log(VinDecoder.isVinData('490201')); // true\n\n// Validate a VIN string\nconsole.log(VinDecoder.validateVIN('W0LJD7EC2GB589277')); // true\nconsole.log(VinDecoder.validateVIN('INVALID-VIN')); // false\n```\n\nThe VIN decoder supports multiple raw data formats:\n- Segmented responses (with line numbers and colons)\n- Non-segmented hex string format\n- Byte array format\n- Multiple standards (0902, 490201)\n\nAll decoding methods include built-in validation and error handling, returning `null` for invalid inputs.\n\n### DTC (Diagnostic Trouble Codes) Decoding\n\n```typescript\nimport { DTCBaseDecoder } from \"obd-raw-data-parser\";\n\n// Create a decoder instance for CAN protocol\nconst canDecoder = new DTCBaseDecoder({\n  isCan: true, // Use CAN protocol\n  serviceMode: \"03\", // Mode 03 for current DTCs\n  troubleCodeType: \"CURRENT\", // Type of DTCs being decoded\n  logPrefix: \"MyApp\", // Optional prefix for logs\n});\n\n// Example: Decoding current DTCs from CAN response\nconst rawBytes = [[0x43, 0x02, 0x01, 0x43, 0x01, 0x96, 0x02, 0x34]];\nconst dtcs = canDecoder.decodeDTCs(rawBytes);\nconsole.log(dtcs); // ['P0143', 'P0196', 'P0234']\n\n// Create a decoder for non-CAN protocol and pending DTCs\nconst nonCanDecoder = new DTCBaseDecoder({\n  isCan: false,\n  serviceMode: \"07\", // Mode 07 for pending DTCs\n  troubleCodeType: \"PENDING\",\n  logPrefix: \"MyApp\",\n});\n\n// Parse DTC status byte\nconst status = canDecoder.parseDTCStatus(0x8c);\nconsole.log(status);\n/* Output:\n{\n  milActive: true,        // Malfunction Indicator Lamp status\n  dtcCount: 12,          // Number of DTCs\n  currentError: false,\n  pendingError: false,\n  confirmedError: true,\n  egrSystem: true,\n  oxygenSensor: false,\n  catalyst: false\n}\n*/\n```\n\n#### Available DTC Modes\n\n- `03`: Current DTCs\n- `07`: Pending DTCs\n- `0A`: Permanent DTCs\n\n#### Features\n\n- 🚗 Supports both CAN and non-CAN protocols\n- 📝 Decodes multiple DTCs from a single response\n- 🔍 Detailed status information parsing\n- ⚡ Efficient raw byte processing\n- ✅ Type-safe error handling\n\n## 📈 Real-World Example\n\n```typescript\nimport { parseOBDResponse } from \"obd-raw-data-parser\";\n\n// Create a real-time dashboard\nclass VehicleDashboard {\n  update(rawData: string) {\n    const data = parseOBDResponse(rawData);\n\n    switch (data.pid) {\n      case \"0C\": // RPM\n        this.updateTachometer(data.value);\n        break;\n      case \"0D\": // Speed\n        this.updateSpeedometer(data.value);\n        break;\n      // ... handle other parameters\n    }\n  }\n}\n```\n\n## Code Coverage\n\nCurrent test coverage report:\n\n| File        | % Stmts | % Branch | % Funcs | % Lines |\n| ----------- | ------- | -------- | ------- | ------- |\n| All files   | 86.44   | 76.67    | 73.58   | 86.44   |\n| index.ts    | 81.25   | 78.95    | 100     | 81.25   |\n| obdInfo.ts  | 86.11   | 57.14    | 68.89   | 86.11   |\n| obdPIDS.ts  | 100     | 100      | 100     | 100     |\n| obdTypes.ts | 100     | 100      | 100     | 100     |\n| obdUtils.ts | 100     | 100      | 100     | 100     |\n\nDetailed metrics:\n\n- Statements: 153/177\n- Branches: 23/30\n- Functions: 39/53\n- Lines: 153/177\n\nGenerated on: Feb 15, 2024\n\n## 🤝 Contributing\n\nContributions are welcome! Here's how you can help:\n\n1. 🍴 Fork the repository\n2. 🌿 Create your feature branch: `git checkout -b feature/amazing`\n3. 💾 Commit changes: `git commit -am 'feat: add amazing feature'`\n4. 🚀 Push to branch: `git push origin feature/amazing`\n5. 🎉 Submit a pull request\n\n## 🎯 Getting Started for Contributors\n\n### Development Setup\n\n1. 🛠️ **Prerequisites**\n   ```bash\n   node \u003e= 14.0.0\n   npm \u003e= 6.0.0\n   ```\n\n2. 🔧 **Setup Project**\n   ```bash\n   git clone https://github.com/rakshitbharat/obd-raw-data-parser.git\n   cd obd-raw-data-parser\n   npm install\n   ```\n\n3. 🧪 **Run Tests**\n   ```bash\n   npm test\n   npm run test:coverage\n   ```\n\n### Key Areas for Contribution\n\n1. 📝 **Documentation**\n   - Add examples for specific vehicle models\n   - Improve API documentation\n   - Create troubleshooting guides\n\n2. 🚗 **Vehicle Support**\n   - Add support for new PIDs\n   - Validate against different vehicle protocols\n   - Share test data from various vehicles\n\n3. 💡 **Feature Requests**\n   - Enhanced error handling\n   - Support for manufacturer-specific PIDs\n   - Performance optimizations\n\n4. 🐛 **Bug Reports**\n   - Include raw OBD data in reports\n   - Specify vehicle make/model\n   - Describe expected vs actual behavior\n\nTogether, we can make vehicle diagnostics more accessible to everyone! 🚀\n\n## 💝 Special Thanks\n\nThis library would not have been possible without the excellent work done by [obd-utils](https://github.com/Nishkalkashyap/obd-utils). A huge thank you to [@Nishkalkashyap](https://github.com/Nishkalkashyap) for creating the original implementation that inspired this library.\n\nThe OBD-II PID definitions, conversion algorithms, and core parsing logic are based on their excellent work. We've built upon their foundation to create a TypeScript-first, fully tested implementation with additional features and improvements.\n\nIf you're interested in OBD-II development, we highly recommend checking out their original work.\n\n## 📄 License\n\nMIT © [Rakshit Bharat](LICENSE)\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  Made with ❤️ for the automotive community\n  \u003cbr\u003e\n  \u003ca href=\"https://github.com/rakshitbharat/obd-raw-data-parser/issues\"\u003eReport Bug\u003c/a\u003e\n  ·\n  \u003ca href=\"https://github.com/rakshitbharat/obd-raw-data-parser/pulls\"\u003eSubmit Feature\u003c/a\u003e\n\u003c/div\u003e\n\n## 🔄 Data Parsing Flowchart\n\n```mermaid\nflowchart TD\n    A[Raw OBD-II Input] --\u003e B{Special Response?}\n    B --\u003e|NO DATA/ERROR| C[Return Raw Value]\n    B --\u003e|Valid Hex| D[Remove Spaces \u0026 Split Bytes]\n    D --\u003e E{Determine Mode}\n    E --\u003e|Mode 01-0C| F[Lookup PID Configuration]\n    E --\u003e|Mode 03 DTC| G[Init DTC Decoder]\n    F --\u003e H{Conversion Required?}\n    H --\u003e|Yes| I[Apply Conversion Formula]\n    H --\u003e|No| J[Return Raw Bytes]\n    I --\u003e K[Validate Output]\n    G --\u003e L[Decode CAN/Non-CAN Frame]\n    L --\u003e M[Extract DTC Codes]\n    K --\u003e N[Format Measurement]\n    M --\u003e O[Format DTC List]\n    N --\u003e P[Structured Output]\n    O --\u003e P\n    J --\u003e P\n    C --\u003e P\n\n    style A fill:#4CAF50,stroke:#388E3C\n    style P fill:#2196F3,stroke:#0D47A1\n    style G fill:#FF9800,stroke:#EF6C00\n    style L fill:#FF9800,stroke:#EF6C00\n```\n\n### Flow Explanation\n\n1. **Input Handling**: Accepts raw OBD-II responses in multiple formats\n2. **Error Filtering**: Immediate return for known non-data responses\n3. **Byte Processing**: Normalizes input format for consistent parsing\n4. **Mode Detection**: Routes to appropriate decoding logic\n5. **PID Resolution**: Matches to 150+ predefined parameter configurations\n6. **Safety Checks**: Includes 3-level validation:\n   - Bitmask verification\n   - Range boundary checks\n   - Type conversion fallbacks\n7. **DTC Handling**: Specialized path for fault code extraction\n8. **Output Generation**: Standardized format for all parameters\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakshitbharat%2Fobd-raw-data-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frakshitbharat%2Fobd-raw-data-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakshitbharat%2Fobd-raw-data-parser/lists"}