#!/bin/bash # # obd-sweep.sh -- query every PID jmccorm has seen on a JEEP platform # in order, print each response with a separator # banner. Useful for spotting PIDs that return broken # / nonsensical / silent data on YOUR vehicle. # # Usage: # obd-sweep.sh # raw decimal bytes via obd.sh # obd-sweep.sh --decoded # human-readable values via obd2.py # # Originally created: 2023 by Josh McCormick (jmccorm) for the Jeep # Wrangler JL / Gladiator JT community. # Originally called the sweep target # "obd2a" in his own setup; this version # uses the on-site obd.sh by default and # obd2.py with --decoded. # Last updated: 05.2026 (polish by magikh0e) # # WHY SWEEP # "You'll find that some of [these PIDs] are broken in a really # obvious way" -- jmccorm. Running a known set in fixed order # makes it trivial to scan the output by eye for PIDs that: # - return nothing (NO RESPONSE) # - return obviously-out-of-range values (e.g. 240C coolant temp) # - return values that don't change as the vehicle state changes # - return values inconsistent with related PIDs (RPM=0 while # engine is clearly running, etc.) # # WHICH PIDS # The list below is jmccorm's curated set, not the entire 0x00-0xFF # range. These are PIDs his vehicle (JL Wrangler) responds to plus # a few common ones worth checking. Inline comments group them by # OBD-II category so you can correlate what you're seeing on the # wire with what the field is supposed to mean. # # REQUIRES # - on-site obd.sh (default) scripts/obd.txt # or # - on-site obd2.py (with --decoded) scripts/obd2.py # - can-utils (for the underlying transport) # - SocketCAN interface up at 500 kbps (CAN-C) # - vehicle running (most PIDs return nothing with ignition only) # # REVISION NOTES (2026-05-16) # - Swapped jmccorm's `obd2a` invocation for the on-site `obd.sh` # so the script is self-contained. Added `--decoded` flag for # the obd2.py path when you want labels + units instead of bytes. # - Stripped the "0x" prefix from each PID when calling obd.sh # (which takes plain hex without the prefix). # - Grouped the PIDs by category in the source so the reader knows # what each one is at a glance. # - Added a final-status check so the script exits non-zero if # either obd.sh or obd2.py is missing. set -u DECODED=0 if [ "${1:-}" = "--decoded" ]; then DECODED=1 fi # Locate the underlying query tool relative to this script's dir. HERE="$(cd "$(dirname "$0")" && pwd)" OBD_SH="$HERE/obd.sh" OBD2_PY="$HERE/obd2.py" if [ "$DECODED" -eq 1 ]; then if [ ! -x "$OBD2_PY" ] && ! command -v python3 >/dev/null 2>&1; then echo "ERROR: --decoded requires obd2.py + python3" >&2 exit 1 fi QUERY() { python3 "$OBD2_PY" "$1"; } else if [ ! -e "$OBD_SH" ]; then echo "ERROR: $OBD_SH not found" >&2 exit 1 fi # obd.sh takes plain hex without the 0x prefix. QUERY() { bash "$OBD_SH" "${1#0x}"; } fi # The PID list. Grouped by OBD-II category for readability; the # script just iterates them all in order. PIDS=" 0x00 # PIDs supported [01-20] (bitfield) 0x04 # Calculated engine load % 0x05 # Engine coolant temperature C 0x06 # Short-term fuel trim - Bank 1 % 0x07 # Long-term fuel trim - Bank 1 % 0x0A # Fuel rail pressure (gauge) kPa 0x0B # Intake manifold absolute pressure kPa 0x0C # Engine RPM rpm 0x0D # Vehicle speed km/h 0x0E # Timing advance deg 0x0F # Intake air temperature C 0x11 # Throttle position % 0x13 # O2 sensors present (Banks 1 and 2) bitfield 0x15 # O2 sensor 2 voltage V 0x1C # OBD standards conformance enum 0x1F # Run time since engine start s 0x20 # PIDs supported [21-40] (bitfield) 0x21 # Distance traveled with MIL on km 0x2C # Commanded EGR % 0x2D # EGR error % 0x2E # Commanded evaporative purge % 0x2F # Fuel tank level input % 0x30 # Warm-ups since DTCs cleared count 0x31 # Distance since DTCs cleared km 0x32 # Evap system vapor pressure Pa 0x33 # Absolute barometric pressure kPa 0x34 # O2 sensor 1 wide-range lambda ratio 0x3C # Catalyst temp Bank 1 Sensor 1 C 0x40 # PIDs supported [41-60] (bitfield) 0x41 # Monitor status this drive cycle bitfield 0x42 # Control module voltage V 0x43 # Absolute load value % 0x44 # Commanded equivalence ratio ratio 0x45 # Relative throttle position % 0x46 # Ambient air temperature C 0x47 # Absolute throttle position B % 0x48 # Absolute throttle position C % 0x49 # Accelerator pedal position D % 0x4A # Accelerator pedal position E % 0x4C # Commanded throttle actuator control % 0x4F # Max value for fuel-air ratio / V / mA / kPa 0x51 # Fuel type enum 0x5E # Engine fuel rate L/h 0x60 # PIDs supported [61-80] (bitfield) 0x62 # Actual engine torque fraction % 0x63 # Engine reference torque Nm 0x68 # Intake air temperature sensor C 0x6B # Exhaust gas recirculation temperature C 0x6D # Fuel rail pressure (absolute) kPa 0x77 # Charge air cooler temperature (CACT) C 0x80 # PIDs supported [81-A0] (bitfield) 0x8E # Engine friction percent torque % 0x9D # Engine fuel rate (alternate) ? 0x9E # Engine exhaust flow rate ? 0xA0 # PIDs supported [A1-C0] (bitfield; A1-A6 reserved) 0xA6 # Odometer km " # Strip comments / blank lines, iterate. echo "$PIDS" | sed 's/#.*$//' | while read -r pid; do [ -z "$pid" ] && continue pid=$(echo "$pid" | tr -d '[:space:]') echo "$pid =======================================================" QUERY "$pid" echo "" done