Harness the power of Linux and Raspberry Pi to create your own advanced OBD2 dashboard. This guide will walk you through setting up a system to monitor your vehicle’s performance data, diagnose issues, and gain deeper insights into your car’s operation.
Functionality at a Glance
This Linux Obd2 Dashboard project provides a comprehensive suite of features for vehicle diagnostics and monitoring:
- Real-time Measurement Data: Effortlessly query and display a wide range of PID (Parameter ID) values (from 0x00 to 0x4E), giving you live data on engine performance, sensor readings, and more.
- Vehicle Information Query: Decode your VIN (Vehicle Identification Number) to access detailed vehicle information, including manufacturer, country of origin, model year, and serial number.
- Diagnostic Trouble Code (DTC) Reading: Read and interpret error codes with plain text descriptions using an integrated database, helping you understand and address vehicle issues effectively.
- CAN Raw Data Display (CAN-Trace): Monitor raw CAN bus data for advanced diagnostics and troubleshooting.
- Automatic Hardware and Baud Rate Detection: The system automatically detects your CAN hardware and baud rate for seamless setup.
- HTML5 Web Interface: Access your OBD2 dashboard remotely through a user-friendly HTML5 web interface.
- Android OpenXC Compatibility: Integrate with Android devices using the OpenXC platform for mobile vehicle data access.
Visualizing Your Vehicle’s Data
Explore the visual interface of your Linux OBD2 dashboard:
Initial screen of the Linux OBD2 dashboard software, showcasing a clean and informative layout for vehicle data monitoring.
PID selection interface, allowing users to customize the parameters displayed on their Linux OBD2 dashboard for focused vehicle monitoring.
List view display on the Linux OBD2 dashboard, presenting real-time vehicle data in an organized and easy-to-read format.
Error code display feature within the Linux OBD2 dashboard, translating cryptic DTC codes into understandable descriptions for vehicle diagnostics.
Hardware Essentials
To build your Linux OBD2 dashboard, you’ll need the following hardware components:
- Linux PC: A Raspberry Pi (any model) is ideal for its compact size and affordability. Other Linux-based PCs will also work.
- Tiny-CAN Interface: A Tiny-CAN interface like the Tiny-CAN I-XL from MHS-Elektronik is required for CAN bus communication.
- OBD-CAN Cable: An OBD-II to CAN cable to connect your Tiny-CAN interface to your vehicle’s OBD-II port.
Essential OBD2 cable, connecting the Tiny-CAN interface to your vehicle’s OBD-II port for data communication with your Linux OBD2 dashboard system.
Step-by-Step Installation Guide
Follow these instructions to set up your Linux OBD2 dashboard:
1. Install Tiny-CAN Software:
- Begin by installing the Tiny-CAN software package. For the OBD-Display software to function, only the “libmhstcan.so” library is necessary. The “OBD-Display” software will search for this file in the “/opt/tiny_can/can_api” directory.
- Download the appropriate “tiny_can_raspberry_XXX.tar.gz” file from MHS-Elektronik. Replace “XXX” with the latest version number.
- Unpack the downloaded archive into the “/opt” directory.
- Remove the archive file after extraction.
- Set the correct access rights for the “/opt” directory using the following commands:
$ sudo chgrp pi /opt
$ sudo chmod -R 775 /opt
$ cd /opt
$ mv /home/pi/tiny_can_raspberry_XXX.tar.gz .
$ tar -xzvf tiny_can_raspberry_XXX.tar.gz
$ rm tiny_can_rasberry_XXX.tar.gz
2. Compile Tiny-CAN API (Usually Not Necessary):
- Navigate to the Tiny-CAN API source directory and compile:
$ cd /opt/tiny_can/can_api/src/mhstcan/linux
$ make
$ mv libmhstcan.so ../../..
- Note: The “libmhstcan.so” library is often included in the package, making compilation unnecessary in most cases.
3. Install Git:
- If Git is not already installed on your Raspberry Pi, install it using:
$ sudo apt-get install git
4. Obtain OBD-Display Software from GitHub:
- Clone the OBD-Display repository from GitHub into the “/opt” directory:
$ cd /opt
$ git clone https://github.com/MHS-Elektronik/OBD-Display.git
5. Install Development Packages:
- Install the necessary GTK2.0 development packages for compiling the OBD-Display software:
$ sudo apt-get install gtk2.0-dev
6. Compile OBD-Display Software:
- Compile the OBD-Display software:
$ cd /opt/OBD-Display/linux
$ make
7. Set Up Web Page (HTML5 Interface):
- Configure the HTML5 web interface:
$ cd /var/www
$ sudo chown -R pi html
$ sudo chgrp -R pi html
$ cd html
$ cp -R /opt/OBD-Display/www/* .
8. Start OBD-Display:
- Run the OBD-Display application:
$ cd /opt/OBD-Display/linux/bin
$ ./ObdDisplay
Accessing the HTML5 Web Interface
Once the OBD-Display software is running, you can access the HTML5 web interface from any device on your network. Simply navigate to the IP address of your Raspberry Pi in a web browser.
HTML5 web interface of the Linux OBD2 dashboard, providing remote access to vehicle data and diagnostic information through a web browser.
OpenXC Integration for Android
OBD-Display supports the OpenXC platform, allowing you to connect your Android device and use apps designed for OpenXC to visualize your vehicle data.
OpenXC is an open standard API for automotive data, originally developed by Ford and Bug Labs. For more information, visit http://openxcplatform.com and the source code repository at https://github.com/openxc.
OBD-Display emulates the OpenXC hardware and provides data in the “OpenXC JSON Message Format” over TCP/IP. The data format is detailed here: https://github.com/openxc/openxc-message-format/blob/master/JSON.mkd.
Setting up the “OpenXC Enabler” Android App:
- Install the App: Download the “OpenXC Enabler” APK from https://github.com/openxc/openxc-android/releases or find it on Google Play. The source code is available at https://github.com/openxc/openxc-android.
- Configure Connection: In the OpenXC Enabler app settings, set the “Vehicle Interface” to “Network.”
- Enter Network Details: Set the “Network host address” to the IP address of your Raspberry Pi running OBD-Display. The “Network port” is fixed at 50001.
OpenXC Enabler app setup screen on Android, configuring network settings to connect to the Linux OBD2 dashboard for mobile data access.
Using the OpenXC Dashboard App:
Once configured, you can use the OpenXC Enabler app or other compatible OpenXC dashboard apps to view your vehicle’s data on your Android device.
OpenXC Dashboard app interface on Android, displaying vehicle parameters received from the Linux OBD2 dashboard for mobile monitoring.
Sources and Further Reading
This project draws upon and incorporates elements from several open-source projects and valuable resources:
- OBD-II API from Ethan Vaughan: Core files “obd_db.c” and “obd_decode.c” are based on the OBD-II API by Ethan Vaughan: https://github.com/ejvaughan/obdii
- ISO-TP Linux Kernel Driver from Oliver Hartkopp: The ISO-TP driver implementation incorporates code from Oliver Hartkopp’s driver: https://github.com/hartkopp/can-isotp
- Emotive Transport and Diagnostic Protocols Document: A highly recommended resource for in-depth understanding of vehicle diagnostic protocols: http://www.emotive.de/documents/WebcastsProtected/Transport-Diagnoseprotokolle.pdf
- pyvin Library: For VIN decoding functionality: https://github.com/iotlabsltd/pyvin/tree/master/pyvin
- NHTSA Manufacturer Information: ftp://ftp.nhtsa.dot.gov/manufacture
- Wikipedia – Vehicle Identification Number: https://de.wikipedia.org/wiki/Fahrzeug-Identifizierungsnummer
- Wikipedia – On-board diagnostics: https://en.wikipedia.org/wiki/On-board_diagnostics
- Wikipedia – ISO 15765-2: https://de.wikipedia.org/wiki/ISO_15765-2
Image Credits
- VW Beetle Background Graphic: https://commons.wikimedia.org/wiki/File:Der_Samtrote_Sonderkäfer.jpg by Marco Strohmeier (Public Domain)
- OBD-connector Image: https://commons.wikimedia.org/wiki/File:OBD2-Buchse-Stecker-Belegung.jpg by https://de.wikipedia.org/wiki/Benutzer:Losch (CC BY-SA 4.0)
Note: Image files were adapted for use in this project.
Useful Tips and Tricks
Enhance your Linux OBD2 dashboard experience with these tips:
Automatic Program Startup:
To automatically launch the OBD-Display program on Raspberry Pi boot (especially useful for headless setups), copy the “ObdDisplay.desktop” file:
$ sudo cp /opt/ObdDisplay/tools/ObdDisplay.desktop /etc/xdg/autostart
Disable Screensaver:
Prevent the screensaver from activating and interrupting your dashboard display by modifying the LightDM configuration:
$ sudo leafpad /etc/lightdm/lightdm.conf
In the “SeatDefaults” section, adjust or add the “xserver-command” line:
[SeatDefaults]
....
xserver-command=X -s 0 -dpms
....
Rotate Screen Display:
Rotate the screen output by 180 degrees if needed (e.g., for display mounting orientation) by editing the Raspberry Pi boot configuration:
$ sudo leafpad /boot/config.txt
Add the following line to the file:
lcd_rotate=2
Reboot your Raspberry Pi for the rotation to take effect.
Hide Mouse Pointer:
For a cleaner dashboard display without a mouse cursor, install the “unclutter” package:
$ sudo apt-get install unclutter
After rebooting, the mouse pointer will be hidden.
Future Development (To-Dos)
The OBD-Display project is continually evolving. Here are some planned enhancements:
- Further Testing and Refinement
- SocketCAN Customization: Develop a SocketCAN Tiny-CAN API driver for broader compatibility.
- Expanded OBD-API Database: Extend the “obd_db.c/obd_decode” database with more PIDs and vehicle information.
- Variable PID Polling Intervals: Implement different polling intervals for individual PIDs to optimize data acquisition.
- Dynamic PID Querying: Query only PIDs that are currently displayed for efficient resource usage.
- Comprehensive OBD-API Documentation
- GUI Porting to GTK3: Migrate the graphical interface to the newer GTK3 library.
This Linux OBD2 dashboard project empowers you to take control of your vehicle diagnostics and monitoring. By combining the versatility of Linux, the affordability of Raspberry Pi, and readily available hardware, you can create a powerful and customizable car data display system.