0.1.3 • Published 6 months ago

minervasobd-utils v0.1.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months 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 PID reference table

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
9760PIDs supported 61-80Bit Encoded
9861Demanded engine Percent Torque%
9962Actual engine - percent torque%
10063Engine reference torqueN*m
10164Engine pct. torque(idle)%
10266Mass air flow sensor(A)g/s
10367Engine coolant temperature(sensor 1)Celsius
10468Intake air temperature(sensor 1)Celsius
1056BExhaust gas recirculation temperatureCelsius
1066DFuel pressure control systemCelsius
1076EInjection pressure control systemCelsius
10873Exhaust pressureCelsius
10978Exhaust Gas temperature Bank 1Celsius
1107CDiesel particular filter temperatureCelsius
11180PIDs supported 81-A0Bit Encoded
1128DThrottle position G%
1138EEngine Friction - Percent Torque%
114A0PIDs supported A1-C0Bit Encoded
115A2Cylinder fuel ratemg/stroke
116A4Transmission actual gearratio
117A5Commanded Diesel Exhaust Fluid Dosing%
118A6Odometerkm
119C0PIDs supported C1-E0Bit Encoded

LICENSE

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

0.1.0

6 months ago

0.1.2

6 months ago

0.1.1

6 months ago

0.0.9

7 months ago

0.0.8

7 months ago

0.1.3

6 months ago

0.0.5

12 months ago

0.0.6

11 months ago

0.0.4

12 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago