Communicating with OBD-2 (On-Board Diagnostics) Systems

Hardware components:
ELM327 OBD2/OBDII USB Car Diagnostic Interface
× 1
Db410c blue 2a
Qualcomm DragonBoard 410c
× 1
Pi 3 02
Raspberry Pi 3 Model B
× 1
Software apps and online services:
10
Microsoft Windows 10 IoT Core

 

Communicating with OBD-2 (On-Board Diagnostics) Systems

STORY

Introduction

OBD (On-Board Diagnostics) is a computer-based system designed primarily to monitor the performance of vehicle engines and to control vehicle emissions. The OBD systems have been mandatory for all cars and light trucks built in the US back in 1996. The second-generation system, OBD2, sets some communication standards that allow external devices to communicate with the controller modules of the vehicle through the DLC port. Real-time performance parameters of the vehicle such as Engine RPM, Vehicle Speed, Air Flow Rate, etc. can be extracted easily. The OBD2 system also updates the vehicle operating conditions through the diagnostic trouble codes (DTCs).

In this work, a device integrated a ELM327L protocol interpreter processor is introduced to perform the communication with OBD2 system. To demonstrate the communication with OBD2 systems, a DragonBoard (or Raspberry Pi) is used to communicate with the ELM327 and request data from the OBD2 system. Some essential AT commands are also introduced to customize the behaviors of the ELM327L. In addition, examples of acquiring vehicle operating information such as Vehicle speed and Engine RPM are demonstrated. Based on these examples, it is possible to develop portable applications to diagnose personal vehicles using the DTC codes.

Connect to OBD2 Systems

Although OBD systems can be accessed easily through a standard DLC port, the communication hardware interfaces behind the DLC port depend on the automakers. In particular, there are at least 5 communication protocols correspond to each communication hardware interfaces The DLC port consists of 16 pins which some specific pins are reserved for dedicated communication interfaces.

ELM327L – OBD to RS-232 Interpreter

It is possible to design the communication interface hardware for a specific protocol that the automaker provides. However, ELM327L processor is an all-in-one solution that can interface with almost available protocols. In fact, ELM327L is an OBD to RS-232 interpreter chip in which it converts the protocols supported by the OBD2 system to the RS232 protocol and vice versa.

Block diagram of Communicating with OBD-2 (On-Board Diagnostics) Systems

Block diagram of Communicating with OBD-2 (On-Board Diagnostics) Systems

ELM327 USB Car Diagnostic Tool

This work uses a device called ELM327 USB Car Diagnostic Tool to access to the OBD system. This tool also integrates a FTDI 232 UART-USB chip to allow a connection to a USB interface. In addition, the tool packs all necessary electronic components such as the connectors of the DLC port and USB port into a compact plastic shell. There are several tools that integrate the ELM327L processor with interfaces such as Bluetooth or WiFi on the market. However, serial communication with the RS-232 protocol is opted for simplicity and ease of use.

Communicating with the ELM327L

There are two type of commands that the DragonBoard/Raspberry Pi can direct the ELM327L. Commands are intended for the ELM327L’s internal configuration will begin with the characters AT, while OBD commands for the vehicle are only allowed to contain the ASCII codes for hexadecimal digits (0 to 9 and A to F). Whether it is an AT type internal command or a hex string for the OBD bus, all messages to the ELM327L must be terminated will a carriage return character (hex ‘0D’) before it will be acted upon. [1]

The ELM327L is not case-sensitive; therefore, the commands such as ATZ, atz, and AtZ are all the same when the DragonBoard/Raspberry Pi sends to the ELM327L. The ELM327L also ignores space characters and all control characters (tab, etc.). For example, the commands ATS 0 and ATS0 to remove the spaces in the OBD response message are also the same. The DragonBoard/Raspberry Pi can take advantage of this to save the sending characters and improve the communication speed.

Setting ELM327L Serial Baud Rate

The default baud rate of the ELM327L is 38400 kbps. Technically, the baud rate of the ELM327L is advisable to operate at a maximum speed of 115000 kbps. However, the USB Car Diagnostic Tool comes with an integrated USB to RS-232 interface using a popular FTDI-232 chip. Thus, the higher baud rate of 500000 bps (500 kbps) can be achieved easily. The following commands are used to permanently set the communication speed for serial communication of ELM327L to 250000 bps (250 kbps). The commands can be executed in programs such as the HyperTerminal or the Serial Monitor tool in the Arduino IDE. The SerialUART sample from Microsoft can serve as a Serial Communication Terminal too.

Setting baud rate (250 kbps) commands: (please refer to the ELM327L datasheet for configure with different baud rates)

AT PP 0C SV 10

AT PP 0C ON

OBD message structure

The OBD2 standards require that each OBD command or request that is sent to the system must adhere to a set format. The first byte sent (known as the MODE) describes the type of data being requested, while the second byte (and possibly a third or more) specifies the actual information that is required. The bytes which follow after the mode byte are known as the parameter identification or PID. [1]

Read More: Communicating with OBD-2 (On-Board Diagnostics) Systems

 


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top