Setting Up Your OBD2 Bluetooth Adapter with Blueman on Linux

Are you looking to dive into the diagnostics of your car using open-source tools? Connecting an OBD2 Bluetooth adapter to your vehicle and linking it to a Linux laptop is a powerful way to access real-time data and understand your car’s performance. This guide will walk you through setting up an OBD2 Bluetooth adapter using Blueman on a Linux system, allowing you to monitor your vehicle’s health and performance metrics effectively. We will focus on using the Blueman Obd2 connection for a seamless experience.

The goal is to replicate the setup that allows you to visualize your car’s data, much like the example below, by connecting to your car’s OBD2 port with a Bluetooth adapter and using Linux software for data interpretation.

Let’s break down the process step-by-step, starting from your car and moving towards your Linux laptop setup.

1. Identifying Your Car’s OBD2 Port

Almost all modern cars are equipped with an OBD2 (On-Board Diagnostics II) port. This standardized port allows you to access your car’s computer system for diagnostics and performance monitoring. The first step is to locate this port in your vehicle.

For many vehicles, the OBD2 port is located within the driver’s side interior, often under the dashboard. In my 2004 Opel/Vauxhall Astra 1.6, it was concealed by a panel beneath the handbrake. Your car’s service manual is the best resource to pinpoint the exact location. Online forums and car-specific websites can also provide valuable information.

Once you’ve located the port, ensure it’s easily accessible for connecting your Bluetooth adapter.

2. Choosing the Right OBD2 Bluetooth Adapter

The market offers a wide variety of OBD2 Bluetooth adapters. If you are considering using iOS-based apps, you might need to look for a Wi-Fi OBD2 adapter instead of Bluetooth. However, for Linux-based systems, a Bluetooth adapter is typically the more straightforward choice, especially when integrating with Blueman OBD2 software.

After reviewing several options and user feedback, I opted for the “Supper Mini Bluetooth Car Code Reader / ELM327 Power 2,” readily available online. This adapter is a popular choice due to its compatibility and ease of use.

This particular model, recognizable by the small Bluetooth symbol after “POWER2”, is compact and efficient. When connected to your car’s OBD2 port, it usually indicates power with a red LED.

Important Note: It’s worth mentioning a potential issue I encountered. After leaving the adapter plugged in for a few days without using my car, I found my car battery was drained. While I can’t definitively say the adapter was the sole cause, it’s prudent to unplug the adapter when the car is not in use to prevent potential battery drain.

3. Setting Up Bluetooth on Your Linux Laptop with Blueman

For Linux laptops lacking built-in Bluetooth, a USB Bluetooth adapter is necessary. I chose the Belkin mini Bluetooth adapter for its compact size and confirmed Linux compatibility, even though the official product page only mentions Windows. User reviews are often a reliable source for Linux compatibility information for various Bluetooth adapters.

After plugging in the adapter, you can verify its detection using the lsusb command in your terminal. The output should list your Bluetooth adapter.

For managing Bluetooth connections on Linux, Blueman is a robust and user-friendly Bluetooth manager. Install it using your distribution’s package manager. For Debian/Ubuntu-based systems, you can use: sudo apt-get install blueman. For RPM-based distributions like CentOS, the command is: yum install blueman.

While GNOME Bluetooth might be pre-installed, Blueman OBD2 setup tends to be smoother and more reliable. If you encounter issues with GNOME Bluetooth, you can remove it using: rpm -e gnome-bluetooth gnome-bluetooth-libs --nodeps on RPM-based systems.

Once installed, a Bluetooth icon should appear in your system panel. You can confirm you are running Blueman by checking the “About” section in the Bluetooth applet menu.

4. Connecting to the OBD2 Bluetooth Adapter via Blueman

Now, get into your car and turn the ignition to the “II” position (or the position that powers the car electronics without starting the engine). This activates the OBD2 port and your Bluetooth adapter.

On your Linux laptop, with Blueman running, right-click the Bluetooth icon in the panel and select “Setup new device…” then proceed by clicking “Forward.”

Blueman will scan for available Bluetooth devices. Your “OBDII” adapter should appear in the list. Select it and click “Forward.”

You’ll be prompted for a passkey. Choose “Use Custom Passkey” and enter “1234” as the key. This is a common default passkey for many OBD2 adapters, but consult your adapter’s documentation if it’s different.

Next, select “Serial Port” as the service you want to use for the connection.

Upon successful pairing, Blueman should display a confirmation message indicating a successful connection to your OBD2 adapter.

5. Setting Up OBD2 Software on Linux: ScanTool

With the Bluetooth connection established using Blueman OBD2, the next step is to configure software to interpret the OBD2 data. “ScanTool” is a program that supports the OBDII protocol and allows data logging. You can download it from the ScanTool.net downloads page. Look for the scantool_net121src.zip source archive.

While ScanTool is a functional option, it’s worth noting that the landscape of OBD2 software for Linux has evolved. Explore alternatives like freediag which offers potentially enhanced features and compatibility.

To proceed with ScanTool, create a directory, move the downloaded zip file into it, and extract the contents:

mkdir scantool
mv scantool_net121src.zip scantool
cd scantool
unzip scantool_net121src.zip

(If unzip is not installed, install it using yum install unzip or apt-get install unzip as root).

Some modifications are needed to the makefile and source code to ensure successful compilation on modern Linux systems:

  • In the makefile, replace lines with AL_LIBS = -lalleg with AL_LIBS = allegro-config –libs`(ensure you have Allegro library and development files installed, potentially viayum install allegro allegro-develorapt-get install liballegro4-dev`).
  • Before ifdef MINGDIR (around line 17), add DEFINES += -DTERMIOS.
  • Change line 29: LIBS = -ldzcom $(AL_LIBS) to LIBS = $(AL_LIBS).
  • Change line 43: BIN = ScanTool.exe to BIN = ScanTool.

You can find a pre-modified makefile online if needed. In globals.h, uncomment //#define LOG_COMMS to enable serial communication logging.

To include timestamps in your logs, you might need to update main.c. Patched versions are often available in online forums or repositories dedicated to OBD2 and Linux.

The serial.c file needs adjustments for termios compatibility. Patches for this are available on forums like the Ubuntu Forums, or you can find pre-patched versions online.

After applying these changes, compile the software using make. Address any compilation errors that arise.

6. Running ScanTool to Read OBD2 Data

ScanTool is configured to read serial data from /dev/ttyS3, but Blueman typically creates a serial device as /dev/rfcomm0. To bridge this, create a symbolic link:

cd /dev
rm -f ttyS3
ln -s rfcomm0 ttyS3
chmod 766 rfcomm0

Run ScanTool. It might display a warning message—simply click “CONTINUE.”

Click “Sensor Data” to access real-time data screens. Initially, without the engine running, the values will reflect the car in its ignition-on state.

7. Processing and Visualizing Logged OBD2 Data

ScanTool logs data to comm_log.txt. With timestamp logging enabled, each line includes a timestamp, TX/RX indicator, and data. The data logging rate is approximately two data points per second. The resolution depends on the number of sensors you are monitoring. For higher resolution on specific parameters like engine RPM, focus logging on those sensors only.

A Perl script like process_comm_log.pl can convert the log file into a data file suitable for Gnuplot. You’ll need to adjust the date format in the script’s regular expression. Execute the script with: process_comm_log.pl comm_log.txt to generate trip.dat.

Finally, use Gnuplot with a script like trip.gp to create graphs from trip.dat. Run gnuplot trip.gp to produce trip.png, visualizing your car’s performance data as shown at the beginning of this guide.

This comprehensive guide should equip you to set up your own Blueman OBD2 system on Linux, enabling you to explore your car’s data and gain deeper insights into its operation.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *