Guide: Debug raw PID queries

If you want to investigate the raw request and response messages of PID queries, keep reading. If you are unsure of what a PID is you can start by reading this: https://en.wikipedia.org/wiki/OBD-II_PIDs

First step is to enable debug logging on your AutoPi device:

  • On my.autopi.io go to Settings > Advanced
  • Next choose System and go to section Logging > Level
  • Choose value debug and press Save (the minion process must be restarted for the change to take effect)

Note: Debug log level or below is only recommended when needed for debugging scenarios as it consumes system resources. For normal operation use warning or info log level.

Now when debug logging is enabled we are able to see all raw data transmitted and received between the STN-chip (communicates with the bus of the vehicle) and the Raspberry Pi.

When logged on to the system via SSH (https://community.autopi.io/t/guide-how-to-ssh-to-your-dongle) it is possible to follow the traffic live with the shell command:

sudo tail -f /var/log/salt/minion | grep obd

In the below log output example we will look at the PID query for speed. In order to see this log output on your device it is required to have a PID Logger setup for PID speed. On my.autopi.io you can see all configured PID loggers below Car Explorer > Loggers.

2020-05-19 11:16:56,874 [obd.obd          :269 ][DEBUG   ][2152] Querying command: 010D: Vehicle Speed
2020-05-19 11:16:56,875 [obd.interfaces.elm327:1027][DEBUG   ][2152] Write: '010D\r'
2020-05-19 11:16:56,909 [obd.interfaces.elm327:1082][DEBUG   ][2152] Read: b'7E8 03 41 0D 33 \r\r>'
2020-05-19 11:16:56,913 [salt.loaded.ext.engines.obd_manager:157 ][DEBUG   ][2152] Got query result: 51 kph

The raw request message sent from the Raspberry Pi to the STN/vehicle is:

2020-05-19 11:16:56,875 [obd.interfaces.elm327:1027][DEBUG   ][2152] Write: '010D\r'

And the raw response message sent from the STN/vehicle to the Raspberry Pi is:

2020-05-19 11:16:56,909 [obd.interfaces.elm327:1082][DEBUG   ][2152] Read: b'7E8 03 41 0D 33 \r\r>'

If a PID is queried that is not supported by the vehicle a NO DATA response is found.

Not working?

Check the log file on the device to see if there are warnings and/or errors: https://community.autopi.io/t/guide-how-to-retrieve-logs-from-your-device/

Need help?

Please visit our documentation site http://docs.autopi.io/ or contact support@autopi.io.

2 Likes