npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

obd-utils

v0.2.1

Published

Provides utilities for OBD2

Downloads

100

Readme

OBD Utils

The aim of this library is to provide utility methods to make it easier to work with the OBD-II protocol. This library only provides the interface/helper functions to make it easier to work with the protocol, and does NOT provides any bindings/transport to communicate with the underlying hardware.

A large part of the implementation is borrowed from EricSmekens's node-bluetooth-obd project.

CLI Usage:

# e.g. parse an OBD response
$ npx obd-utils parse "41 05 3C"
{
    "mode": "41",
    "pid": "05",
    "name": "temp",
    "unit": "Celsius",
    "value": 20
}

# e.g. get info for PID "05", i.e. engine temperature sensor
$ npx obd-utils info 05
{
    "mode": "01",
    "pid": "05",
    "bytes": 1,
    "name": "temp",
    "description": "Engine Coolant Temperature",
    "min": -40,
    "max": 215,
    "unit": "Celsius"
}

Programmatic Usage:

import { parseOBDResponse, getPIDInfo, getAllPIDs } from "obd-utils";

// Parse an OBD response
const parsedCommand = parseOBDResponse("41 05 3C");
console.log(parsedCommand);
/**
 * The resulting output will resemble:
 * IParsedOBDResponse {
 *      mode: '41',
 *      pid: '05',
 *      name: 'temp',
 *      unit: 'Celsius',
 *      value: '60'
 * }
 */

// Get the info for a PID
const info = getPIDInfo("0C");
console.log(info);
/**
 * The resulting output will resemble:
 * IObdPIDDescriptor {
 *      mode: '01',
 *      pid: '0C',
 *      bytes: 2,
 *      name: 'rpm',
 *      description: 'Engine RPM',
 *      min: 0,
 *      max: 16383.75,
 *      unit: 'rev/min'
 * }
 */

// List all PID IDs
const allPids = getAllPIDs();
console.log(allPids);
/**
 * The resulting output will resemble:
 * Array<IObdPIDDescriptor> [
 *    ...,
 *    {
 *       mode: '01',
 *       pid: '0C',
 *       bytes: 2,
 *       name: 'rpm',
 *       description: 'Engine RPM',
 *       min: 0,
 *       max: 16383.75,
 *       unit: 'rev/min'
 *    }
 * ]
 */

OBD2 list of PIDs

Index | PID | Description | Units ------------ |------------ | -------------| -------------- 1 | 00 | PIDs supported 00-20 | Bit Encoded 2 | 01 | Monitor status since DTCs cleared | Bit Encoded 3 | 02 | DTC that caused required freeze frame data storage | Bit Encoded 4 | 03 | Fuel system 1 and 2 status | Bit Encoded 5 | 04 | Calculated LOAD Value | % 6 | 05 | Engine Coolant Temperature | Celsius 7 | 06 | Short Term Fuel Trim - Bank 1,3 | % 8 | 07 | Long Term Fuel Trim - Bank 1,3 | % 9 | 08 | Short Term Fuel Trim - Bank 2,4 | % 10 | 09 | Long Term Fuel Trim - Bank 2,4 | % 11 | 0A | Fuel Pressure | kPa 12 | 0B | Intake Manifold Absolute Pressure | kPa 13 | 0C | Engine RPM | rev/min 14 | 0D | Vehicle Speed Sensor | km/h 15 | 0E | Ignition Timing Advance for #1 Cylinder | degrees relative to #1 cylinder 16 | 0F | Intake Air Temperature | Celsius 17 | 10 | Air Flow Rate from Mass Air Flow Sensor | g/s 18 | 11 | Absolute Throttle Position | % 19 | 12 | Commanded Secondary Air Status | Bit Encoded 20 | 13 | Location of Oxygen Sensors | Bit Encoded 21 | 14 | Bank 1 - Sensor 1/Bank 1 - Sensor 1 Oxygen Sensor Output Voltage / Short Term Fuel Trim | V 22 | 15 | Bank 1 - Sensor 2/Bank 1 - Sensor 2 Oxygen Sensor Output Voltage / Short Term Fuel Trim | V 23 | 16 | Bank 1 - Sensor 3/Bank 2 - Sensor 1 Oxygen Sensor Output Voltage / Short Term Fuel Trim | V 24 | 17 | Bank 1 - Sensor 4/Bank 2 - Sensor 2 Oxygen Sensor Output Voltage / Short Term Fuel Trim | V 25 | 18 | Bank 2 - Sensor 1/Bank 3 - Sensor 1 Oxygen Sensor Output Voltage / Short Term Fuel Trim | V 26 | 19 | Bank 2 - Sensor 2/Bank 3 - Sensor 2 Oxygen Sensor Output Voltage / Short Term Fuel Trim | V 27 | 1A | Bank 2 - Sensor 3/Bank 4 - Sensor 1 Oxygen Sensor Output Voltage / Short Term Fuel Trim | V 28 | 1B | Bank 2 - Sensor 4/Bank 4 - Sensor 2 Oxygen Sensor Output Voltage / Short Term Fuel Trim | V 29 | 1C | OBD requirements to which vehicle is designed | Bit Encoded 30 | 1D | Location of oxygen sensors | Bit Encoded 31 | 1E | Auxiliary Input Status | Bit Encoded 32 | 1F | Time Since Engine Start | seconds 33 | 20 | PIDs supported 21-40 | Bit Encoded 34 | 21 | Distance Travelled While MIL is Activated | km 35 | 22 | Fuel Rail Pressure relative to manifold vacuum | kPa 36 | 23 | Fuel Rail Pressure (diesel) | kPa 37 | 24 | Bank 1 - Sensor 1/Bank 1 - Sensor 1 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage | (ratio) 38 | 25 | Bank 1 - Sensor 2/Bank 1 - Sensor 2 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage | (ratio) 39 | 26 | Bank 1 - Sensor 3 /Bank 2 - Sensor 1(wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage | (ratio) 40 | 27 | Bank 1 - Sensor 4 /Bank 2 - Sensor 2(wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage | (ratio) 41 | 28 | Bank 2 - Sensor 1 /Bank 3 - Sensor 1(wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage | (ratio) 42 | 29 | Bank 2 - Sensor 2 /Bank 3 - Sensor 2(wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage | (ratio) 43 | 2A | Bank 2 - Sensor 3 /Bank 4 - Sensor 1(wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage | (ratio) 44 | 2B | Bank 2 - Sensor 4 /Bank 4 - Sensor 2(wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage | (ratio) 45 | 2C | Commanded EGR | % 46 | 2D | EGR Error | % 47 | 2E | Commanded Evaporative Purge | % 48 | 2F | Fuel Level Input | % 49 | 30 | Number of warm-ups since diagnostic trouble codes cleared | 50 | 31 | Distance since diagnostic trouble codes cleared | km 51 | 32 | Evap System Vapour Pressure | Pa 52 | 33 | Barometric Pressure | kPa 53 | 34 | Bank 1 - Sensor 1/Bank 1 - Sensor 1 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current | (ratio) 54 | 35 | Bank 1 - Sensor 2/Bank 1 - Sensor 2 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current | (ratio) 55 | 36 | Bank 1 - Sensor 3/Bank 2 - Sensor 1 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current | (ratio) 56 | 37 | Bank 1 - Sensor 4/Bank 2 - Sensor 2 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current | (ratio) 57 | 38 | Bank 2 - Sensor 1/Bank 3 - Sensor 1 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current | (ratio) 58 | 39 | Bank 2 - Sensor 2/Bank 3 - Sensor 2 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current | (ratio) 59 | 3A | Bank 2 - Sensor 3/Bank 4 - Sensor 1 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current | (ratio) 60 | 3B | Bank 2 - Sensor 4/Bank 4 - Sensor 2 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current | (ratio) 61 | 3C | Catalyst Temperature Bank 1 / Sensor 1 | Celsius 62 | 3D | Catalyst Temperature Bank 2 / Sensor 1 | Celsius 63 | 3E | Catalyst Temperature Bank 1 / Sensor 2 | Celsius 64 | 3F | Catalyst Temperature Bank 2 / Sensor 2 | Celsius 65 | 40 | PIDs supported 41-60 | Bit Encoded 66 | 41 | Monitor status this driving cycle | Bit Encoded 67 | 42 | Control module voltage | V 68 | 43 | Absolute Load Value | % 69 | 44 | Fuel/air Commanded Equivalence Ratio | (ratio) 70 | 45 | Relative Throttle Position | % 71 | 46 | Ambient air temperature | Celsius 72 | 47 | Absolute Throttle Position B | % 73 | 48 | Absolute Throttle Position C | % 74 | 49 | Accelerator Pedal Position D | % 75 | 4A | Accelerator Pedal Position E | % 76 | 4B | Accelerator Pedal Position F | % 77 | 4C | Commanded Throttle Actuator Control | % 78 | 4D | Time run by the engine while MIL activated | minutes 79 | 4E | Time since diagnostic trouble codes cleared | minutes 80 | 4F | External Test Equipment Configuration #1 | Bit Encoded 81 | 50 | External Test Equipment Configuration #2 | Bit Encoded 82 | 51 | Fuel Type | Bit Encoded 83 | 52 | Ethanol fuel % | % 84 | 53 | Absolute Evap system Vapor Pressure | kPa 85 | 54 | Evap system vapor pressure | Pa 86 | 55 | Short term secondary oxygen sensor trim bank 1 and bank 3 | % 87 | 56 | Long term secondary oxygen sensor trim bank 1 and bank 3 | % 88 | 57 | Short term secondary oxygen sensor trim bank 2 and bank 4 | % 89 | 58 | Long term secondary oxygen sensor trim bank 2 and bank 4 | % 90 | 59 | Fuel rail pressure (absolute) | kPa 91 | 5A | Relative accelerator pedal position | % 92 | 5B | Hybrid battery pack remaining life | % 93 | 5C | Engine oil temperature | °C 94 | 5D | Fuel injection timing | ° 95 | 5E | Engine fuel rate | L/h 96 | 5F | Emission requirements to which vehicle is designed | Bit Encoded 97 | 62 | Actual engine - percent torque | % 98 | 67 | Engine coolant temperature | Celsius 99 | 6B | Exhaust gas recirculation temperature | Celsius 100 | 6D | Fuel pressure control system | Celsius 101 | 6E | Injection pressure control system | Celsius 102 | 73 | Exhaust pressure | Celsius 103 | 78 | Exhaust Gas temperature Bank 1 | Celsius

LICENSE

This module is available under a Apache 2.0 license, see also the LICENSE file for details.