OBD Reader

From OpenMBD
Jump to: navigation, search


General description

OBD stands for On Board Diagnostics, since the introduction of the second version of OBD, simply named OBD2, there is a standardized list of Diagnostic Trouble Codes. Similarly there are standard Parameter ID's to get information like the throttle position and RPM from the car. OBD2 supports several communication protocols but cars from 2008 must have a CAN implementation. So it is possible to read out the OBD2 information when you can send and receive CAN messages. This section shows how you can do this with the E407 and HANcoder.

Hardware

To connect the E407 to the car some hardware is needed. The E407 doesn't have a CAN transceiver so this has to be mounted externally. For this example we will use the SN65HVD230 but you can use another if you desire. Now we still need a cable between the car and the SN65HVD230. For this there are OBD2 cables available on the internet.

Connection diagram

ConnectionDiagram


Simulink Model

A simple simulink model has been made to illustrate how to get the information from the car. To understand this section some knowledge about the OBD2 protocol is required. It should also be understood that there is a limit to the amount of messages that the car can send, thus the rate of information depends on the amount of different PID's that are requested. This is not a limit of the CAN bus bandwidth but of the implementation of the protocol in the car.

Initialisation

The OBD2 information will be read over CAN so the CANbus should be initialized. In this example CAN channel 1 is used for the OBD2 communication. According to the standard the baudrate can either be 250kb/s or 500kb/s and the identifiers can be normal (11-bit) or extended (29-bit). Check the baudrate and identifier type of your car and use these in the CAN initialization block. In this demo we will be using a Volkswagen Up and it has a 500kb/s CAN bus and it uses the standard identifiers. A CAN config block must be included in the model to activate the CAN bus.
OBD2 CANsettings.png

In the picture above of the CAN config block parameters it can be seen that the baudrate is set to 500kbit/s and the reception filter Mode is set to 'Receive both 11- and 29-bit identifiers'. The settings on the generic tab are left at the default settings.

Sending the PID requests

Receiving the data

Processing the data