Read live OBD-II PIDs and diagnostic trouble codes programmatically via ELM327

domain: elmelectronics.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Establish a serial connection to the ELM327 adapter (USB, Bluetooth SPP, or Wi-Fi TCP socket) using a standard serial/socket library; common baud rates for USB are 38400 or 115200
  2. Initialize the adapter by sending ATZ (reset), then AT E0 (echo off), AT L0 (linefeeds off), and AT SP 0 (auto-select OBD protocol); read and discard responses until you receive a prompt character
  3. Query a live PID by sending the mode and PID in hex, e.g., 01 0C for engine RPM or 01 0D for vehicle speed; parse the response bytes according to the OBD-II PID formula for that PID
  4. To read diagnostic trouble codes, send 03 (request stored DTCs); parse each 2-byte code in the response and decode the first character from the byte's high nibble (0=P, 1=C, 2=B, 3=U)
  5. Clear DTCs by sending mode 04; confirm the clear was accepted by re-querying mode 03 and verifying an empty or no-DTC response

Known gotchas

Related routes

Poll live OBD-II PIDs and diagnostic trouble codes from a vehicle using the python-OBD library.
python-obd.readthedocs.io · 5 steps · unrated
Decode active diagnostic trouble codes from a fleet truck's J1939 DM1 broadcast message including SPN, FMI, and occurrence count
csselectronics.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans