Log OBD data

OBD is a protocol that lets you request data from most non-EV 2008+ vehicles (cars, trucks).

In this section we outline how to log OBD data with your CANedge.

Note

We strongly recommend that you read our OBD2 intro before proceeding


Quickstart

1: Configure your device

For a quickstart, use our ‘plug & play’ OBD2 Configuration File for the CANedge1:

FW 01.08, 500K | FW 01.08, 500K (incl. GNSS/IMU)

Download the Configuration File to your SD card (replace the original) and safely eject the SD.

Note

This transmits popular OBD2 PIDs with 500K bit-rate and 11-bit IDs (supported by most non-EV cars). See also our section on how to systematically determine what your vehicle supports


2: Request and record OBD2 data

  1. Connect the CANedge to the OBD2 connector in your car via the OBD2-DB9 adapter[1]
  2. Verify that the device turns on and logs data (CH1 LED blinking)
  3. Open the recorded MF4 in asammdf and display the raw CAN trace
  4. If your car responds[2] you should see CAN frames with ID 7E8-7EF in your data
  5. If you do not see OBD2 responses, go to our ‘Validation’ section

3: DBC decode and plot OBD2 data

The asammdf GUI intro details how you can convert raw data from the CANedge into human-readable form - and e.g. create plots. You can use our free OBD2 DBC files to decode your data.

Note

Make sure to use the correct OBD2 DBC file depending on your vehicle (11-bit or 29-bit)

OBD2 data logger asammdf GUI

Validation: Determine bit-rate, request IDs, protocol and PIDs

This section lets you identify what OBD data your vehicle supports and how to request it.

How to load ‘partial’ config files

First, you will need to learn how to load a ‘partial’ config file:

  1. Open your Configuration File in the config editor
  2. Click the bottom menu ‘+’ to open the ‘Partial config loader’ tool
  3. Navigate to the relevant partial config JSON, open it and click ‘Merge files’

1: Identify bit-rate

OBD may use 500K or 250K bit-rates - below lets you identify which one to use:

  1. Load below ‘partial config’ (500K bit-rate) into your Configuration File
  2. Download the Configuration File to your SD (replace the original) and safely eject the SD
  3. Start your vehicle and leave it running for ~2 min[3]
  4. Connect the CANedge to the OBD2 connector in your vehicle via the OBD2-DB9 adapter[1]
  5. Power it for ~1 min, then disconnect the device and extract the SD card
  6. Open the logged MF4 in asammdf and display the raw CAN trace
  7. If the CAN trace includes a CAN Frame (as in below picture), the bit-rate is 500K
  8. If it only includes an Error Frame, update your CH1 bit-rate to 250K and repeat the above[4]

bit-rate test 'partial config'

OBD2 bit-rate validated

Example 1: The bit-rate is confirmed to be valid due to successful TX frame

OBD2 bit-rate wrong

Example 2: The bit-rate is confirmed to be invalid due to error frame and no TX frame


2: Identify request IDs and OBD protocol

Depending on your vehicle model/year, OBD may use one of below combinations:

  1. Request ID 7DF and OBD2/OBDonEDS protocol (most common in cars)
  2. Request ID 18DB33F1 and OBD2/OBDonEDS protocol
  3. Request ID 7DF and WWH-OBD/OBDonUDS protocol
  4. Request ID 18DB33F1 and WWH-OBD/OBDonUDS protocol

By requesting data via each of the 4 methods, we can test what the vehicle responds to:

  1. Load below ‘partial config’ into your Configuration File
  2. If your bit-rate is 250K instead of 500K, update CAN CH1 accordingly
  3. Start your vehicle and leave it running for ~2 min[3]
  4. Power the CANedge in your vehicle for ~2 min
  5. Open the resulting MF4 in asammdf and look for RX CAN Frame entries
  6. If the vehicle responds to 7DF OBD2/OBDonEDS requests, combination 1 is supported etc[7]

IDs, protocol and PIDs test 'partial config'

Note

If your vehicle output regular proprietary CAN IDs as well, you can look for the relevant response IDs by filtering for the ranges 7E8-7EF and 18DAF100-18DAF1FF


3: Look up supported PIDs

Next, you can determine which OBD PIDs are supported based on the CAN trace:

  1. Open our OBD PID lookup tool and select PID 00 (PIDs Supported [01 - 20])
  2. Find the relevant response frame via the CAN trace (see highlighted example below)[8]
  3. Copy/paste the relevant 4 payload bytes into the lookup tool’s payload[9]
  4. Review the resulting PID list and note down supported PIDs of interest
  5. Optionally repeat for PIDs 0x20, 0x40, … (if responses)

As an example, see below trace with responses to the 7DF OBD2/OBDonEDS requests:

OBD2 supported PIDs

If we copy the first response (ID 7E8) bytes into the tool, we get below result for PID 0x00:

OBD2 lookup tool example

Note

A typical non-EV car may support 40-80 OBD PIDs out of the ~200 possible PIDs


Other topics

Config examples

As per our validation section, OBD may be communicated in 4 ways. Below we provide ‘partial’ configs for each method as a starting points for your own transmit list:

  1. 11-bit-OBD2/OBDonEDS 'partial config'
  2. 11-bit-WWH-OBD/OBDonUDS 'partial config'
  3. 29-bit-OBD2/OBDonEDS 'partial config'
  4. 29-bit-WWH-OBD/OBDonUDS 'partial config'

Note

The above examples use 500K bit-rate for CAN CH1 - change this if your vehicle uses 250K


Add new OBD2 PID requests

If you want to add new PID requests, we recommend to first go through the validation step to identify supported PIDs for your vehicle, then include those of interest in your transmit list:

  1. Start out with the relevant ‘partial’ config from the above list
  2. In CAN CH1 remove requests that are not supported by your vehicle
  3. For each PID you wish to add, add a new entry to the transmit list
  4. In the entry, copy all fields from the entry above
  5. In the data payload field, set the 3rd byte to match the hex PID value
  6. Update the entry name to something suitable, then repeat for the next PID
  7. When your list is complete, review all period and offset values
  8. Ensure the offset values ‘space out’ all messages by 300-500 ms[5]
  9. Ensure offset < period for all entries, otherwise the Configuration File will be invalid

Multi-frame OBD2 data (ISO TP)

Some OBD2 communication involves multi-frame data, e.g. DTCs, VIN and more. To request such data, you need to use flow control frames - and to decode the data, you need to use suitable software. See our UDS section for details.


OBD2 & battery consumption

The CANedge consumes <1W[10], which is not an issue for your car battery in practical use cases. In most cases, the device also turns off with your car (or 10-20 min after). However, if this is not the case and you request OBD data, the device may ‘wake up’ the car sensors.

In such scenarios, there are a couple of options:

  1. Simply disconnect the device between trips
  2. Re-wire your vehicle OBD2 connector so that the power pin is linked to the ignition
  3. Use a DB9-DC splitter and a cigarette-to-DC adapter to power the device
  4. Turn the OBD transmit list on/off via a control signal as outlined in the CANedge Docs

Use GNSS speed to control OBD transmission

A common way to start/stop your CAN CH1 OBD2 transmission is by using a GPS-based Speed signal. This will be easy if you have a CANmod.gps or a CANedge incl. GPS/IMU.

Below we provide two ‘partial’ Configuration Files. Both files start transmission on CAN 1 only when the Speed signal is above 0.1 m/s - and stops when below 0.09 m/s. Further, they also control the logging on other channels based on the same logic (CAN 2, CAN internal). This way, you avoid battery drainage and only record data if the car is moving. You can load this into your own Configuration File with the ‘Partial config loader’ editor tool.[6]

FW 01.08 (CANmod.gps on CAN 2) | FW 01.08 (incl. GNSS/IMU)


[1](1, 2) We strongly recommend using one of our OBD-DB9 adapters as 3rd party cables often use different pinouts.
[3](1, 2) The vehicle ECUs may take some time to boot up and acknowledge CAN frames, hence it is useful to wait for a few minutes with the vehicle turned on
[4]Even if the bit-rate is valid, disconnecting the device from an active CAN bus may result in error frames. As such, you should focus on whether the log file contains a CAN Frame or not
[7]A vehicle may produce responses to multiple combinations (e.g. 7DF with both OBDonEDS and OBDonUDS). In such cases, we recommend to look at which PIDs are supported by each method
[8]For OBD2/OBDonEDS this will start with payload 06 41 00. For WWH-OBD/OBDonUDS it will start with payload 07 62 F4 00
[9]For OBD2/OBDonEDS, copy/paste the 4th to 7th bytes. For WWH-OBD/OBDonUDS, copy/paste the 5th to 8th bytes. Regardless of the protocol used, the bytes should be pasted into the 4 available fields in the OBD2 lookup tool
[2]If you see no MF4 log file and/or no OBD2 responses, go to the section on systematically determining your vehicle’s OBD support
[5]In the plug & play config, this is ensured by having a sequence of transmit messages be sent out over a 5000 ms period. If you need to add more transmit messages than what fits in that list, you should expand the period accordingly
[10]The CANedge3 consumes up to 2.5W during active LTE transfer
[6]The partial config example may require adjustment (e.g. if your CANmod.gps uses another firmware than 01.03.01 or if you’ve modified the CAN ID for the message containing Speed). Further, you should always test this out to verify that it is working as intended before leaving the device for a longer period in your vehicle