0.2.1 • Published 3 years ago

obd-utils v0.2.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

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

IndexPIDDescriptionUnits
100PIDs supported 00-20Bit Encoded
201Monitor status since DTCs clearedBit Encoded
302DTC that caused required freeze frame data storageBit Encoded
403Fuel system 1 and 2 statusBit Encoded
504Calculated LOAD Value%
605Engine Coolant TemperatureCelsius
706Short Term Fuel Trim - Bank 1,3%
807Long Term Fuel Trim - Bank 1,3%
908Short Term Fuel Trim - Bank 2,4%
1009Long Term Fuel Trim - Bank 2,4%
110AFuel PressurekPa
120BIntake Manifold Absolute PressurekPa
130CEngine RPMrev/min
140DVehicle Speed Sensorkm/h
150EIgnition Timing Advance for #1 Cylinderdegrees relative to #1 cylinder
160FIntake Air TemperatureCelsius
1710Air Flow Rate from Mass Air Flow Sensorg/s
1811Absolute Throttle Position%
1912Commanded Secondary Air StatusBit Encoded
2013Location of Oxygen SensorsBit Encoded
2114Bank 1 - Sensor 1/Bank 1 - Sensor 1 Oxygen Sensor Output Voltage / Short Term Fuel TrimV
2215Bank 1 - Sensor 2/Bank 1 - Sensor 2 Oxygen Sensor Output Voltage / Short Term Fuel TrimV
2316Bank 1 - Sensor 3/Bank 2 - Sensor 1 Oxygen Sensor Output Voltage / Short Term Fuel TrimV
2417Bank 1 - Sensor 4/Bank 2 - Sensor 2 Oxygen Sensor Output Voltage / Short Term Fuel TrimV
2518Bank 2 - Sensor 1/Bank 3 - Sensor 1 Oxygen Sensor Output Voltage / Short Term Fuel TrimV
2619Bank 2 - Sensor 2/Bank 3 - Sensor 2 Oxygen Sensor Output Voltage / Short Term Fuel TrimV
271ABank 2 - Sensor 3/Bank 4 - Sensor 1 Oxygen Sensor Output Voltage / Short Term Fuel TrimV
281BBank 2 - Sensor 4/Bank 4 - Sensor 2 Oxygen Sensor Output Voltage / Short Term Fuel TrimV
291COBD requirements to which vehicle is designedBit Encoded
301DLocation of oxygen sensorsBit Encoded
311EAuxiliary Input StatusBit Encoded
321FTime Since Engine Startseconds
3320PIDs supported 21-40Bit Encoded
3421Distance Travelled While MIL is Activatedkm
3522Fuel Rail Pressure relative to manifold vacuumkPa
3623Fuel Rail Pressure (diesel)kPa
3724Bank 1 - Sensor 1/Bank 1 - Sensor 1 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage(ratio)
3825Bank 1 - Sensor 2/Bank 1 - Sensor 2 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage(ratio)
3926Bank 1 - Sensor 3 /Bank 2 - Sensor 1(wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage(ratio)
4027Bank 1 - Sensor 4 /Bank 2 - Sensor 2(wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage(ratio)
4128Bank 2 - Sensor 1 /Bank 3 - Sensor 1(wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage(ratio)
4229Bank 2 - Sensor 2 /Bank 3 - Sensor 2(wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage(ratio)
432ABank 2 - Sensor 3 /Bank 4 - Sensor 1(wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage(ratio)
442BBank 2 - Sensor 4 /Bank 4 - Sensor 2(wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Voltage(ratio)
452CCommanded EGR%
462DEGR Error%
472ECommanded Evaporative Purge%
482FFuel Level Input%
4930Number of warm-ups since diagnostic trouble codes cleared
5031Distance since diagnostic trouble codes clearedkm
5132Evap System Vapour PressurePa
5233Barometric PressurekPa
5334Bank 1 - Sensor 1/Bank 1 - Sensor 1 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current(ratio)
5435Bank 1 - Sensor 2/Bank 1 - Sensor 2 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current(ratio)
5536Bank 1 - Sensor 3/Bank 2 - Sensor 1 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current(ratio)
5637Bank 1 - Sensor 4/Bank 2 - Sensor 2 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current(ratio)
5738Bank 2 - Sensor 1/Bank 3 - Sensor 1 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current(ratio)
5839Bank 2 - Sensor 2/Bank 3 - Sensor 2 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current(ratio)
593ABank 2 - Sensor 3/Bank 4 - Sensor 1 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current(ratio)
603BBank 2 - Sensor 4/Bank 4 - Sensor 2 (wide range O2S) Oxygen Sensors Equivalence Ratio (lambda) / Current(ratio)
613CCatalyst Temperature Bank 1 / Sensor 1Celsius
623DCatalyst Temperature Bank 2 / Sensor 1Celsius
633ECatalyst Temperature Bank 1 / Sensor 2Celsius
643FCatalyst Temperature Bank 2 / Sensor 2Celsius
6540PIDs supported 41-60Bit Encoded
6641Monitor status this driving cycleBit Encoded
6742Control module voltageV
6843Absolute Load Value%
6944Fuel/air Commanded Equivalence Ratio(ratio)
7045Relative Throttle Position%
7146Ambient air temperatureCelsius
7247Absolute Throttle Position B%
7348Absolute Throttle Position C%
7449Accelerator Pedal Position D%
754AAccelerator Pedal Position E%
764BAccelerator Pedal Position F%
774CCommanded Throttle Actuator Control%
784DTime run by the engine while MIL activatedminutes
794ETime since diagnostic trouble codes clearedminutes
804FExternal Test Equipment Configuration #1Bit Encoded
8150External Test Equipment Configuration #2Bit Encoded
8251Fuel TypeBit Encoded
8352Ethanol fuel %%
8453Absolute Evap system Vapor PressurekPa
8554Evap system vapor pressurePa
8655Short term secondary oxygen sensor trim bank 1 and bank 3%
8756Long term secondary oxygen sensor trim bank 1 and bank 3%
8857Short term secondary oxygen sensor trim bank 2 and bank 4%
8958Long term secondary oxygen sensor trim bank 2 and bank 4%
9059Fuel rail pressure (absolute)kPa
915ARelative accelerator pedal position%
925BHybrid battery pack remaining life%
935CEngine oil temperature°C
945DFuel injection timing°
955EEngine fuel rateL/h
965FEmission requirements to which vehicle is designedBit Encoded
9762Actual engine - percent torque%
9867Engine coolant temperatureCelsius
996BExhaust gas recirculation temperatureCelsius
1006DFuel pressure control systemCelsius
1016EInjection pressure control systemCelsius
10273Exhaust pressureCelsius
10378Exhaust Gas temperature Bank 1Celsius

LICENSE

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

0.2.1

3 years ago

0.2.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.2-beta.2

3 years ago

0.0.2-beta.1

3 years ago

0.0.2-beta.0

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago