# 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...

---

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](https://en.wikipedia.org/wiki/OBD-II_PIDs).

First step is to enable debug logging on your [AutoPi](https://www.autopi.io) device:

* On [my.autopi.io](https://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](https://www.autopi.io/hardware/autopi-canfd-pro) bus of the vehicle) and the
Raspberry Pi.

When logged on to the system [via SSH](/developer_guides/how_to_ssh_to_your_device.md) it is possible to
follow the traffic live with the following shell command:

```bash
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'](/cloud/obd_library/community_library.mdx)
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 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 instead.
