Linux tip, Fedora tip / howto: setting up an OBD2 Bluetooth adapter |
Try my online puzzle page with Calcudoku, Killer Sudoku and online Sudoku.
setting up an OBD2 Bluetooth adapter My car was behaving a bit more sluggishly than I expected, so I decided to investigate. The goal was to plug an OBD2 bluetooth adapter into the OBD2 port of my car (a 2004 Opel/Vauxhall Astra 1.6) and make it talk to an Acer Aspire One laptop running Linux (CentOS 6.3).The end goal is to get graphs like this one (click on it for a larger version): We'll work our way from the car "upwards":
Check your service manual or look online to find the location of the connector in your car. In my case I had to use a flat head screwdriver to flip open a panel below the handbrake to expose the connector. After browsing some reviews, I ended up getting this one: "Supper Mini Bluetooth Car Code Reader / ELM327 Power 2" (for £11.95). This is what it looks like (note the small bluetooth symbol after the "POWER2"):
And this is what it looks like connected (the red light is always on):
Note: just now I found that my car battery is dead, after not having used the car for a few days, and left the adapter in. I can't be sure it was the adapter that drained the battery (I won't leave it in anymore though). The adapter is tiny (those squares are 5mm x 5mm):
After connecting it, lsusb shows this (the various numbers may be different for you): I had most success with the blueman bluetooth software. To install, run: The gnome bluetooth software only gave me trouble. You can ditch it by running (as root): Once installed, there should appear a small bluetooth icon in your panel (you can double check you're using the Blueman applet by selecting the "About" option).
Turn on the laptop, and once started up and logged in, right-click the bluetooth icon in the panel and select "Setup new device...", then click the "Forward" button. In the dialog that appears next, a device "OBDII" should show up in the list. Select it, and then click "Forward". Next, select "Use Custom Passkey", and type "1234" as the key (this number may be different for your OBD2 adapter): Next, select "Serial Port": After that, you should get a confirmation like this:
I managed this with the "ScanTool" program, downloaded from the ScanTool.net downloads page. Get the scantool_net121src.zip source archive. There may be other, better solutions by now (send me a note using the form below if you know of one :-). For example, freediag looks interesting. Create a directory for it, and unzip the source: Some changes need to be made to the makefile and source code:
In the file globals.h, uncomment line 9: I fixed a bug in the logging code in main.c, and added the logging of timestamps. Download a copy of the updated main.c. The file serial.c must be changed so it uses termios: there's a patch for this on the ubuntu forums. Alternatively, download an already patched version of serial.c. Now you should be good to compile, so run make (send me a note if you get any compilation errors). When you run ScanTool, it'll show you a warning (just click "CONTINUE"):
Next, click "Sensor Data" to see screens like this one (as you can see from the numbers, I didn't start the engine yet): [Sat Feb 14 21:54:29 2015][TX]010D[/TX] You can see the incoming data rate is about 2 pieces of information a second. You can set which data ScanTool should query, so bear in mind that if you're reading a lot of them, the resulting resolution will not be great (conversely, if you'd like to log the engine RPM twice a second, for example, enable the reading of that sensor only). I wrote a small Perl script: process_comm_log.pl that converts the logfile to a data file that gnuplot can use.
|
Send me your comments!
Something didn't work as expected? You'd like to add some useful info to this tip? Use the form below to send me your comments. (Don't forget to fill out the super-lame CAPTCHA below..)