28 comments

[ 5.3 ms ] story [ 62.9 ms ] thread
I’ve been using Open Torque Viewer combined with the Torque App and a basic OBDII bluetooth sensor to log my car’s sensor data over the past month and a half. Charts are in the link.

Plotting was done with seaborn - the code is available as an ipython notebook : http://ryancompton.net/assets/torque/mpg_plots.py.html

Aren't these Bluetooth sensors a great access point for hackers?

I can't find the article but I think this was in the news lately.

I used to develop OBD diagnostic software[0], the ones used by mechanics.

For the cars I developed for, usually actuators had some preconditions that had to be met before they could go off. For example you shouldn't be able to tell the car to brake via OBD if the car is not still.

At the moment, I can't think of something 'dangerous' that could be done via ODB.

[0] http://www.texa.com/

One thing you can do without connecting is sniff -n- track. Regardless if you connect, you can sniff things like tire pressure monitor transmitters or bluetooth addresses.

At least officially there is no publicly known database of license plate pix and sniffed MAC addresses. Obviously being blindingly obvious idea, there probably is a secret one. So you only need enough optical data gathering to match MACs to plates with excellent lines of sight and OCR and so forth, then you can get away with deploying simple RF sniffers all over the place that don't need LOS and can be much cheaper.

Note that you can track cops this way, not just victims ^H^H err consumers I mean. And obviously the "smarter" the car the easier this tracking works, you're not going to track a restored 1972 Gran Torino off its bluetooth.

Via documented OBD mechanisms? Yeah, probably not much.

Via a standard Bluetooth<-> CAN interface plugged into the OBD port?

Lots can be done, because generally the OBD port will expose the main CAN network and once you reverse engineer whatever inter-module messaging the manufacturer is using, you can act as a real module (for example, the throttle pedal) and all sorts of Bad Things are possible.

Here's a great write-up, which is also a good primer on automotive control reversing techniques for the uninitiated:

http://illmatics.com/car_hacking.pdf

Thanks for putting that together! Charts and the statistics are quite interesting and its good to know about driving habits. I am gonna give Open Torque Viewer a try soon.
Just FYI, AutoZone and places like that will read a check engine light for free. Did this once and found out I needed a new gas tank cap.
Wow, that's a pretty epic sensor coverage on that car.

How does that work? I had to Google it, and came up with this example status: http://www.obd-codes.com/p0452. It seems to be based off a fuel-tank pressure sensor. Neat.

It was the OBD code + expertise from the AutoZone employee. He read the code that corresponded to a fuel leak detected somewhere and said the most likely cause is that the gas cap was not on tight enough. He said I can either try to re-tighten the cap, or just get a new one for $6 or so.
The only time my 1990 Honda Civic (original owner, looks like shit (both of us)) failed emissions test was a worn gas cap. When to $AUTO_PARTS_STORE, bought a cheap cap, passed test.
I think gas-cap tightness sensors are pretty common, possibly mandatory? My 2004 hyundai accent, probably the cheapest car you could get in NA in that time, throws a CEL if you don't tighten the gas cap past 3 clicks or so, it's even documented in the user manual.
It's all related to emissions control. There are a number of sensors on modern cars that measure oxygen in exhaust gases, pressure in the fuel tank (to ensure vapors don't escape) and pressure in the EGR system (to lower NOx emissions).

And that's just the basic setup. Higher-end cars monitor even more.

Yep, reading out data from your car through an OBD2 port is super interesting. I used to drive a 4.4L V8 Land Rover and it was very interesting to find out that it would use ~$0.50 worth of petrol within 30 seconds of starting, just to warm the engine up. Then the consumption fell down significantly - quite high in city driving,then lowest I have ever seen while cruising at 120-140km/h(80-90mph), and peaking at its highest at top speed of 200km/h(120mph). It was very interesting to see.
The physics/chemistry of engines is interesting. Heat is also a big factor in pollution, in theory, when adequate, there would be no toxic residue after combustion.
>> I used to drive a 4.4L V8 Land Rover and it was very interesting to find out that it would use ~$0.50 worth of petrol within 30 seconds of starting, just to warm the engine up

The reason is to reduce emissions. An ex-GM guy once told me that you'll produce more NOx and CO starting your car than the entire trip. The catalyst need to be hot to clean the stuff up. They probably run it rich to get more fuel into the catalytic converter to heat it.

This is likely right, it's also the reason when you start up most car you'll see the rpm stay higher than normal idle for a couple seconds. Heating up the catalyzer so it can do its job.
Not only heating up the catalytic converter, but heating up the engine in general. Efficiency is pretty low when the engine is cold.
Which is also why you (and your kids) should never hang around the back of a car that has just been started.

The stuff coming out the tailpipe is orders of magnitude worse than after it's warmed up.

Thanks for this. This is awesome! I have been wanting to monitor my car, and was wondering this in the last couple of months.
I wouldn't be so certain that the error in speed measurements is due to the speedometer. Car speedometers work by measuring wheel rotations, using knowledge of the wheel diameter and calculating the speed. You can get errors when the wheel slips (very unlikely except at very low speeds), and when the wheel diameter is less or more than the assumption (level of tread wear, tyre inflation). For a given journey (and over a period of days) this error will be pretty constant and linear in nature - the faster you go, the greater the error by some factor. Regulations mean that it's much more likely to over-report than under-report the speed, but I'd assume that this would be by a fairly constant amount.

GPS speed is calculated by distance travelled between 2 positions in a given time. The problem is that GPS positions aren't completely accurate. Rounding errors, atmospheric effects and signal reflection can all affect the accuracy of the position. At low speeds, these errors can be as big as the distance travelled between measurements. The GPS speed may not take into account altitude (which is considerably less accurate on consumer GPS receivers), and so would under-report speed going up or down hills. It will also assume perfectly straight lines between points, while your car may in fact be travelling a less straight path. There's also likely to be a degree of averaging involved in the calculation, which would filter out small speed changes reflected in your speedometer data.

Your plot shows times when the GPS speed was as high as 20 mph when the car speedometer was reporting 0 mph. No car with a functioning speedometer will report 0 mph when it's actually moving at over 20 mph.

The convergence at higher speeds is probably more to do with the accuracy of GPS speed measurements at high speed than it is to do with the accuracy of a car speedometer at high speeds.

Author came very close to demonstrating some other cool Torque feature such as coupling the GPS and car position data to the mass of the car (which you manually enter) and torque outputs a fairly accurate measure of instant or peak measured horsepower. Oh look my ancient '97 Saturn really does accelerate at 120 horsepower as calculated based off 2nd derivative of position and input mass. And, likewise, by continuous monitor of the stats and doing some very simple timing, torque can output 0-60, 0-100, quarter mile, etc, you hit reset, it waits until the throttle position sensor is slammed or it sees over 0 mph then times until it sees 60 or 100 or whatever. I think it can do braking distance the same way although its been awhile since I tried.

Its interesting to watch the other readouts like coolant temperature. How long does it REALLY take a car to warm up in the winter vs the summer and stuff like that.

I believe I have the same no-name adapter the author has, and it works well. One common discussion topic for torque users is finding a BT adapter that auto powers off when the car shuts off, so you can leave the device plugged in all the time if you want without killing the car battery.

And a final additional commentary is the community is always discussing / trading map files. So on my wife's prius if you download the special prius map file you can do deeper diagnosis and see the voltage across battery #11 or whatever which is moderately interesting, but without the map file it doesn't know how to map the additional telemetry packets into individual cell voltages or whatever. Google will help. Not all cars have enhanced mapping data of course.

Anything like this for iPhone or USB to a laptop? [Edit] Obviously the USB OBD II connection exists: Any recommendations for hardware/software?
I purchased this hardware from Amazon that is iOS compatible: iKKEGOL WiFi OBD-II ODB2

And I downloaded EngineLink from the appstore. You connect to the sensor via Wifi (dont need to be on a wifi network, the sensor creates one that you connect to), then start up the app and you are good to go. There are many apps that will work with the sensor though, so check out a few and see which works best for your needs.

Possible to export the data out of the EngineLink app?

Make more sense to create your own and shoot that data to a box in the cloud for analysis? Or this already exists in some open source form?

Glad you're enjoying Open Torque Viewer.

It's my creation. :)