Getting Started with OBD-II
Eventually on your journey into the world of embedded electronics, you will want to "hack" a vehicle for data. As with many other integrated systems, there is a specific 'language' for talking with vehicles. This tutorial will give a basic introduction to the On-Board Diagnostics (OBD) specification that vehicles and other industrial machines use to communicate with the outside world.
Looking to get hands-on with OBD-II?
We've got you covered!
SparkFun OBD-II UARTWIG-09555
Macchina A0 OBD-II Development ModuleDEV-17493
MIKROE OBDII ClickDEV-20207
So what exactly is the OBD specification, and why do we care? According to the Environmental Protection Agency's website:
On-Board Diagnostics, or "OBD," is a computer-based system built into all 1996 and later light-duty vehicles and trucks, as required by the Clean Air Act Amendments of 1990. OBD systems are designed to monitor the performance of some of an engine's major components including those responsible for controlling emissions.
In other words, OBD is the language of the Engine Control Unit (ECU), and it was designed to help fight emissions and engine failures.
Saving the planet is great (shout out to you citizen scientists!), but what this also means is we can access other features of the car and collect information from and on those parts. Learning how to work with those protocols also means that you can determine what that Malfunction Indicator Light (MIL) (aka the Check Engine Light) on your dash is referring to when it tells you there's an engine problem. If you or your mechanic has ever read the DTCs (Diagnostic Trouble Codes) on your vehicle, they are using OBD-II.
Unfortunately, the actual protocols themselves are not available publicly (if only they'd open source!), but we've attempted to collect and clarify as much as possible.
Any vehicle manufacture from 1996 or later is required by law to have the OBD-II computer system. You can access this system through the Data Link Connector (DLC). It is a 16 pin connector that can tell you which protocol your car communicates with, depending on which pins are populated in it.
In cars, it will be located under the dash, near the driver's seat, or in the vicinity of the ashtray -- somewhere easily accessible from the driver's seat without the use of tools to access it (i.e., you don't need a screw driver to pull off a panel to get to it).