Tag Archives: ISO9141

Arduino OBD-II Interface


For my CS 497 Spring 2011 course, I worked on an independent study project creating an Arduino-based OBD-II (vehicle onboard diagnostic) interface written in C.

First, I assembled an interface between an Arduino Uno and the ISO9141 bus that most vehicles prior to 2008 use. An open-source project called OBDuino describes how to assemble such an interface, available here. Second, I wrote software for the Arduino to poll information from the vehicle’s engine control unit (ECU), such as instantaneous information like RPM and vehicle speed, and also diagnostic feedback, and display it in real time on an attached LCD screen. Third, I added an Arduino data-logging shield to allow the capturing of long-term data from a vehicle in a spreadsheet-ready format.

Download the presentation I gave on this project.

Download the source code used for this project.

Update – 3/27/11

Since my last progress update, I have written software for the Arduino to:

  • Interface with my automobile’s ISO-9141 bus, and
  • Begin polling for parameter IDs (PIDs)

Before the Arduino can begin polling data from the automobile’s ECU, it must first establish a serial connection. The initialization sequence was adapted from ISO standard 9141-2:1994, available at the Engineering library. Once started, it sends address 0x33 to the ECU at 5-baud to “bit-bang” the ECU and establish a serial connection. The Arduino then switches into normal serial communication at 10.4kbps and waits for a return address of 0x55 from the ECU followed by two keywords. The Arduino sends back the inverse of the second keyword and, upon a response of 0xCC (the inverse of 0x33) from the ECU, the Arduino displays “Init. Success!” on its LCD screen. Initialization usually takes a few seconds to complete, and the connection must be re-initialized if the ECU is not polled for data within 5 seconds.

Screen shot 2011-03-27 at 11.12.07 PM


Displayed on the LCD screen above are instantaneous readings from the four PIDs currently polled by the Arduino. Clockwise from the top-left corner, these include:

  • Engine RPM
  • Vehicle speed
  • Mass airflow (MAF) sensor, which can be used to calculate instantaneous MPG
  • Engine coolant temperature

Values update every 200ms on the LCD. Polling for PIDs involves sending a byte-encoded message to the ECU requesting a value for a PID defined in the SAE J1979 standard. The ECU then responds with a byte-encoded value that the Arduino can decode and extract information from to display on screen. Currently, the system only polls for these four PIDs, but will be expanded to poll for several more.

Upcoming Tasks

In addition to adding more PIDs to poll, I will mainly be focusing on implementing a data logger shield to hold data captured by the Arduino and display in spreadsheet form on a computer.

The data logger shield sits on top of the Arduino unit, and uses pins not used by the LCD or serial communication. The shield also contains a real-time clock to add a timestamp next to data read from the ECU. Data is stored on a 2GB SD card.



The ability to log large amounts of data from a vehicle demonstrates the usefulness for this system to offer diagnostic capabilities with a high degree of precision and temporal resolution. Implementing and programming this data logger shield, as well as graphically displaying spreadsheet data, should consume the remainder of the time allotted for myproject.

Update – 4/12/11

I’ve added the data logging shield and a way to compute MPG from the MAF (mass air flow) and VSS (vehicle speed sensor) PIDs.

Here are some Excel graphs plotted from data over a 20 minute period (844 data points). Click for larger graphs.