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 wikipedia page.
First step is to enable debug logging on your AutoPi device:
- On my.autopi.io go to Device > Advanced Settings
- 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 a lot of system resources. For normal operation use warning or info log level.
Now that debug logging is enabled we are able to see all raw data transmitted and received between the STN-chip (the chip responsible for communication with the CAN bus of the vehicle) and the Raspberry Pi.
When logged on to the system via SSH it is possible to follow the traffic live with the following shell command:
sudo tail -f /var/log/salt/minion | grep obd
In the example log output below 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. Take a look at the 'Community Library' guide on more information about how to set those up.
2020-05-19 11:16:56,874 [obd.obd :269 ][DEBUG ][2152] Querying command: 010D: Vehicle Speed2020-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 instead.
Discussion
If you'd like to discuss this topic with us or other fellow community members, you can do so on our community page dedicated for this guide: Debug Raw PID Queries.
note
In case you have any questions, don't hesitate to contact us at support@autopi.io.