LJ Archive

Be a Mechanic...with Android and Linux!

Bill Childers

Issue #234, October 2013

“Check Engine Soon”—that little orange light on your car's instrument panel is possibly one of the more annoying things about modern automobiles. Ever had it pop on during a trip and wonder whether it was just something mundane, like your gas cap being loose, or whether it's something deathly serious and a piston could come shooting out the side of your engine block at any time? Well, thanks to an inexpensive little piece of hardware and an Android tablet, I'll help you decode that little orange light in your car.

The human race has had automobiles for more than 100 years now, but we've had computer monitors and control engine operation only for around 30 years or so. The first computer controls were primitive, hard to work with and expensive. Each automotive manufacturer had its own computer systems, protocols, connectors and trouble-code definitions. I worked as a mechanic during the late 1980s and early 1990s, and I remember those systems well—not fondly, of course, but well. Some of those systems required you to do crazy things like jump a connector with a piece of wire, then turn the key on and off three times and observe the Check Engine light as it flashed on and off. You'd have to count the number of flashes accurately and then look up the “trouble code” that flashed in a service manual, and you might get a clue as to what was wrong with the vehicle. Those early diagnostic systems made seasoned mechanics who were used to troubleshooting the machinery of an engine rather than its electronics shudder with trepidation. Over time, the manufacturers made the systems better. The Society of Automotive Engineers made the connector, protocol and trouble codes a standard in 1996, and with that, we've got the system in place today: OBD-II (Onboard Diagnostics, 2nd revision).

OBD-II Basics

Any car sold in the United States after 1996 uses the OBD-II computer system, so the majority of cars on the road today have this system. Thanks to OBD-II's standardization and age, lots of tools have been released to work with the system. Because OBD-II defines the connector and protocol, that means you need both a hardware device to interface with the connector and some software to speak the protocol.

The hardware I use is the Soliport ELM327 Bluetooth OBD-II Scanner (see the Amazon link in the Resources section of this article). It's a very inexpensive (less than $20) dongle that plugs in to the OBD-II port under your dashboard, draws its power directly from the car and converts the OBD-II-specific signals to serial-over-Bluetooth. There are other OBD-II scan tools on the market. Some are just plain-old cables to hook straight into a computer's RS-232 serial port, and others are as fancy as full-on bridges to a Wi-Fi network. And, there are other manufacturers of Bluetooth OBD-II scan tools, but just make sure whatever you get is based on the ELM327 chipset.

Another piece of hardware you'll need is a computer of some kind. Any Linux-powered laptop with Bluetooth will suffice, but the form factor is kind of clunky when you're dealing with a cramped automotive cockpit. (See the Using a Laptop to Scan Your OBD-II System sidebar if you want to use a laptop.) My personal preference is to use an Android device to interpret the signals coming from the OBD-II system in the car. I use a Nexus 7 tablet for this, but any Android device should work. I've used a Motorola Droid RAZR and the very first HTC G1 Android phone for this as well.

Figure 1. Tools of the Trade: a Nexus 7 Tablet and a Soliport Bluetooth OBD-II Scanner

Software-wise, my choice for this on Android is Torque, an excellent app that not only can collect all the OBD-II stats, but also graph and log them in myriad ways. (There's also a free version, Torque Lite, that has a fair deal of the functionality of the full version.) Grab either one from the Google Play store.

Note that this solution is for read-only access to the OBD-II system in the car. You can't modify the running parameters of the vehicle with this adapter, unfortunately (or fortunately, perhaps, as it's very easy to make a mess of things). Flashing your car's computer with a new fuel curve or ignition timing map is a nontrivial exercise that requires an adapter with different voltage levels and different software. So, don't worry about breaking your car with this solution—you're just “peeking under the hood”.

Using Torque and the Soliport Bluetooth Adapter

The Soliport adapter comes with a little CD-ROM in the box, but it's not required for use with an Android device. To get started, you first need to find the OBD-II port in your car. In most cars sold in the United States, the port is under the dash on the driver's side of the car. Find the port, and plug the Soliport in to it.

Next, start the car, because the OBD-II port isn't powered until the car's ignition is on. (Make sure your garage door is open, please. I don't want to receive hate mail from your relatives on how you suffocated from carbon monoxide poisoning!) Next, you need to go through the standard Bluetooth pairing process to pair your Android device to the Soliport adapter. (The pairing code is 1234 if you can't find it in the instructions—coincidentally, it's the same combination that's on my luggage.)

Once you've got your Android device all paired up to the Soliport, you're ready to fire up Torque. Start Torque on your Android device, and you'll be greeted with the Torque main screen.

Figure 2. The Torque Home Screen

Setting Up Torque

Now that you have Torque up, select the little “settings” slider on the bottom left of the screen, and select “OBD2 Adapter Settings”. Set the connection type as Bluetooth, and choose the Soliport if prompted. Go back to the main settings screen and select your desired units (Imperial or Metric), and any other preferences you choose, then flip back to the Torque main screen.

Next, you're going to create a “profile” for your vehicle. Select the settings slider from the main screen as before, then select “Vehicle Profile” and “Create new profile”. Then, fill in the pertinent information about your vehicle. This information is used by Torque to compute things that can be calculated, like horsepower, fuel economy and other metrics. When you're done, go back to the main screen.

Checking for Fault Codes

Let's start by doing basic diagnostics on your car. From the main screen, select Fault Codes, then press the large magnifying glass to start a scan of your car's computer for trouble codes. If your Check Engine light is on, you'll probably find your issue represented as a code here. My father's 2001 Chevy Silverado pickup was showing a Check Engine light, and I ran a quick scan on it with Torque. It resulted in a trouble code of P1416. A quick Google search of that trouble code showed that it was the Secondary Air Valve, Bank 2. It turned out that was a little smog system valve right on top of the engine, on the passenger side. Amazon.com had that particular part for $37, and we had it at his house in two days.

I had the Check Engine light on my wife's Durango pop on not long after, and I used the tool to scan her car. Her car came back with a P0440 code, which means “Evaporative Emission Control System Malfunction”. I searched a bit more on the Internet and found that the most common cause of this code is a broken or mis-installed fuel filler cap. It turned out that was exactly the case—her fuel filler cap wasn't tightened all the way. I tightened the cap and cleared the code via the Torque app, and it never returned.

Getting Performance Data

Those two cases listed above more than paid for the cost of the Soliport adapter and the Torque application, but Torque can do so much more. Torque can pull data from sources other than your OBD-II sensors. It also can poll your Android device's accelerometer and GPS. This means it can do performance calculations, such as 0–60 mph time (or 0–100 kph time), 1/4 mile time or even horsepower calculations. This requires that you get your car's data entered correctly into the vehicle profile during setup time, particularly the vehicle weight (including your weight as driver, and any other stuff you may have inside the car). If you do performance testing, make sure you're doing it safely—and don't violate any laws in your locality.

However, I think one of the coolest things that Torque and the Soliport adapter can do is they can act as an auxiliary instrument panel for your car. Any bit of information that passes through the OBD-II sensors can be logged, graphed or placed on a digital dial. You can pick and choose how you want that information presented as well—including the size and position of the graphs and dials. This information can be extremely valuable, for instance, displaying the current engine manifold vacuum. As a general rule, under cruise conditions, higher manifold vacuum means higher fuel economy, so having this gauge up can be handy on long trips.

Figure 3. Torque's Virtual Instrument Panel

Torque also has other features, like the ability to log your data for future analysis. It also can graph that data and correlate it to your GPS position and accelerometer data. This can be useful if you happen to be an amateur racer and would like to get information about your car's performance at certain points on the racetrack. Most people won't need that ability, but it's nice to know that the developer of Torque thought that out. All the data necessary to do those calculations is there, it just needs to be glued together.

Closing

Computer control systems in cars used to be mysterious, overly complicated, finicky pieces of technological voodoo to even the most seasoned mechanic. Scan tools were proprietary and cost thousands of dollars, and mechanics needed a special tool for each car manufacturer. With the advent of OBD-II and inexpensive computers, it's now easy to de-mystify and diagnose your car. Don't let the strange terms fool you—like the computers you're already familiar with, an automobile is just a collection of technology and machinery, and you can troubleshoot it just like a computer.

Bill Childers is an IT Manager in Silicon Valley, where he lives with his wife and two children. He enjoys Linux far too much, and probably should get more sun from time to time.

LJ Archive